Bookmark
Cryptography
Identity Objects
class Identity()
An identity is a cryptographic keypair that can be used to sign messages.
__
init__
def __init__(signing_key: ecdsa.SigningKey)
Create a new identity from a signing key.
from_
seed
@staticmethod
def from_seed(seed: str, index: int) -> "Identity"
Create a new identity from a seed and index.
generate
@staticmethod
def generate() -> "Identity"
Generate a random new identity.
from_
string
@staticmethod
def from_string(private_key_hex: str) -> "Identity"
Create a new identity from a private key.
private_
key
@property
def private_key() -> str
Property to access the private key of the identity.
address
@property
def address() -> str
Property to access the address of the identity.
sign
def sign(data: bytes) -> str
Sign the provided data.
sign_
digest
def sign_digest(digest: bytes) -> str
Sign the provided digest.
sign_
registration
def sign_registration(contract_address: str, sequence: int) -> str
Sign the registration data for the Almanac contract.
verify_
digest
@staticmethod
def verify_digest(address: str, digest: bytes, signature: str) -> bool
Verify that the signature is correct for the provided signer address and digest.