avantis_trader_sdk.crypto package

Submodules

avantis_trader_sdk.crypto.spki module

class avantis_trader_sdk.crypto.spki.ECDSASignatureRecord(**kwargs)[source]

Bases: Sequence

componentType = <NamedTypes object, types <NamedType object, type r=<Integer schema object, tagSet <TagSet object, tags 0:0:2>>>, <NamedType object, type s=<Integer schema object, tagSet <TagSet object, tags 0:0:2>>>>

Default collection of ASN.1 types of component (e.g. NamedType) object imposing size constraint on |ASN.1| objects

class avantis_trader_sdk.crypto.spki.SPKIAlgorithmIdentifierRecord(**kwargs)[source]

Bases: Sequence

componentType = <NamedTypes object, types <NamedType object, type algorithm=<ObjectIdentifier schema object, tagSet <TagSet object, tags 0:0:6>>>, <OptionalNamedType object, type parameters=<Any schema object, encoding iso-8859-1>>>

Default collection of ASN.1 types of component (e.g. NamedType) object imposing size constraint on |ASN.1| objects

class avantis_trader_sdk.crypto.spki.SPKIRecord(**kwargs)[source]

Bases: Sequence

componentType = <NamedTypes object, types <NamedType object, type algorithm=<SPKIAlgorithmIdentifierRecord schema object, tagSet=<TagSet object, tags 0:32:16>, subtypeSpec=<ConstraintsIntersection object>, componentType=<NamedTypes object, types <NamedType object, type algorithm=<ObjectIdentifier schema object, tagSet <TagSet object, tags 0:0:6>>>, <OptionalNamedType object, type parameters=<Any schema object, encoding iso-8859-1>>>, sizeSpec=<ConstraintsIntersection object>>>, <NamedType object, type subjectPublicKey=<BitString schema object, tagSet <TagSet object, tags 0:0:3>>>>

Default collection of ASN.1 types of component (e.g. NamedType) object imposing size constraint on |ASN.1| objects

avantis_trader_sdk.crypto.spki.der_encoded_public_key_to_eth_address(pubkey)[source]

Given a KMS Public Key, calculate the ethereum address.

Return type:

str

Parameters:

pubkey (bytes)

avantis_trader_sdk.crypto.spki.get_sig_r_s(signature)[source]

Given a KMS signature, calculate r and s.

Return type:

Tuple[int, int]

Parameters:

signature (bytes)

avantis_trader_sdk.crypto.spki.get_sig_r_s_v(msg_hash, signature, address)[source]

Given a message hash, a KMS signature and an ethereum address calculate r, s, and v.

Return type:

Tuple[int, int, int]

Parameters:
  • msg_hash (bytes)

  • signature (bytes)

  • address (str)

avantis_trader_sdk.crypto.spki.get_sig_v(msg_hash, r, s, expected_address)[source]

Given a message hash, r, s and an ethereum address, recover the recovery parameter v.

Return type:

int

Parameters:
  • msg_hash (bytes)

  • r (int)

  • s (int)

  • expected_address (str)

avantis_trader_sdk.crypto.spki.public_key_int_to_eth_address(pubkey)[source]

Given an integer public key, calculate the ethereum address.

Return type:

str

Parameters:

pubkey (int)

Module contents