MCPcopy
hub / github.com/raiden-network/raiden / LocalSigner

Class LocalSigner

raiden/utils/signer.py:83–99  ·  view source on GitHub ↗

Concrete Signer implementation using a local private key

Source from the content-addressed store, hash-verified

81
82
83class LocalSigner(Signer):
84 """Concrete Signer implementation using a local private key"""
85
86 private_key: keys.PrivateKey
87
88 def __init__(self, private_key: bytes) -> None:
89 self.private_key = keys.PrivateKey(private_key)
90 self.address = self.private_key.public_key.to_canonical_address()
91
92 def sign(self, data: bytes, v: int = 27) -> Signature:
93 """Sign data hash with local private key"""
94 assert v in (0, 27), "Raiden is only signing messages with v in (0, 27)"
95 _hash = eth_sign_sha3(data)
96 signature = self.private_key.sign_msg_hash(message_hash=_hash)
97 sig_bytes = signature.to_bytes()
98 # adjust last byte to v
99 return sig_bytes[:-1] + bytes([sig_bytes[-1] + v])

Callers 15

get_loginFunction · 0.90
mainFunction · 0.90
_make_clientsMethod · 0.90
matrix_api_shellFunction · 0.90
__init__Method · 0.90
get_last_iouFunction · 0.90
test_token_network_proxyFunction · 0.90

Calls

no outgoing calls