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.

Was this page helpful?

Bookmark