xbr._eip712_authority_certificate

Classes

Functions

create_eip712_authority_certificate(→ dict)

Authority certificate: long-lived, on-chain L2.

recover_eip712_authority_certificate(→ bytes)

Recover the signer address the given EIP712 signature was signed with.

sign_eip712_authority_certificate(→ bytes)

Sign the given data using a EIP712 based signature with the provided private key.

Module Contents

class EIP712AuthorityCertificate(chainId: int, verifyingContract: bytes, validFrom: int, issuer: bytes, subject: bytes, realm: bytes, capabilities: int, meta: str, signatures: List[bytes] | None = None)[source]

Bases: xbr._eip712_certificate.EIP712Certificate

CAPABILITY_CONSUMER = 32[source]
CAPABILITY_INTERMEDIATE_CA = 2[source]
CAPABILITY_PRIVATE_RELAY = 8[source]
CAPABILITY_PROVIDER = 16[source]
CAPABILITY_PUBLIC_RELAY = 4[source]
CAPABILITY_ROOT_CA = 1[source]
__eq__(other: Any) bool[source]
__ne__(other: Any) bool[source]
__slots__ = ('chainId', 'verifyingContract', 'validFrom', 'issuer', 'subject', 'realm', 'capabilities',...[source]
__str__() str[source]
capabilities[source]
hash[source]
issuer[source]
static load(filename) EIP712AuthorityCertificate[source]

Load certificate from file.

Parameters:

filename

Returns:

marshal(binary: bool = False) Dict[str, Any][source]
meta[source]
static parse(obj, binary: bool = False) EIP712AuthorityCertificate[source]
realm[source]
recover(signature: bytes) bytes[source]
save(filename: str) int[source]

Save certificate to file. File format (serialized as CBOR):

[cert_hash: bytes, cert_eip712: Dict[str, Any], cert_signatures: List[bytes]]

Parameters:

filename

Returns:

sign(key: xbr._secmod.EthereumKey, binary: bool = False) bytes[source]
signatures = None[source]
subject[source]
create_eip712_authority_certificate(chainId: int, verifyingContract: bytes, validFrom: int, issuer: bytes, subject: bytes, realm: bytes, capabilities: int, meta: str) dict[source]

Authority certificate: long-lived, on-chain L2.

Parameters:
  • chainId

  • verifyingContract

  • validFrom

  • issuer

  • subject

  • realm

  • capabilities

  • meta

Returns:

recover_eip712_authority_certificate(chainId: int, verifyingContract: bytes, validFrom: int, issuer: bytes, subject: bytes, realm: bytes, capabilities: int, meta: str, signature: bytes) bytes[source]

Recover the signer address the given EIP712 signature was signed with.

Parameters:
  • chainId

  • verifyingContract

  • validFrom

  • issuer

  • subject

  • realm

  • capabilities

  • meta

  • signature

Returns:

The (computed) signer address the signature was signed with.

sign_eip712_authority_certificate(eth_privkey: bytes, chainId: int, verifyingContract: bytes, validFrom: int, issuer: bytes, subject: bytes, realm: bytes, capabilities: int, meta: str) bytes[source]

Sign the given data using a EIP712 based signature with the provided private key.

Parameters:
  • eth_privkey

  • chainId

  • verifyingContract

  • validFrom

  • issuer

  • subject

  • realm

  • capabilities

  • meta

Returns: