addr_key_validator

Module with utility functions for validating address public keys.

class AddrKeyValidator

Bases: object

Class container for address utility functions.

static ValidateAndGetEd25519Key(pub_key: Union[bytes, IPublicKey]) IPublicKey

Validate and get a ed25519 public key.

Parameters:

pub_key (bytes or IPublicKey object) – Public key bytes or object

Returns:

IPublicKey object

Return type:

IPublicKey object

Raises:
  • TypeError – If the public key is not ed25519

  • ValueError – If the public key is not valid

static ValidateAndGetEd25519Blake2bKey(pub_key: Union[bytes, IPublicKey]) IPublicKey

Validate and get a ed25519-blake2b public key.

Parameters:

pub_key (bytes or IPublicKey object) – Public key bytes or object

Returns:

IPublicKey object

Return type:

IPublicKey object

Raises:
  • TypeError – If the public key is not ed25519-blake2b

  • ValueError – If the public key is not valid

static ValidateAndGetEd25519MoneroKey(pub_key: Union[bytes, IPublicKey]) IPublicKey

Validate and get a ed25519-monero public key.

Parameters:

pub_key (bytes or IPublicKey object) – Public key bytes or object

Returns:

IPublicKey object

Return type:

IPublicKey object

Raises:
  • TypeError – If the public key is not ed25519-monero

  • ValueError – If the public key is not valid

static ValidateAndGetNist256p1Key(pub_key: Union[bytes, IPublicKey]) IPublicKey

Validate and get a nist256p1 public key.

Parameters:

pub_key (bytes or IPublicKey object) – Public key bytes or object

Returns:

IPublicKey object

Return type:

IPublicKey object

Raises:
  • TypeError – If the public key is not nist256p1

  • ValueError – If the public key is not valid

static ValidateAndGetSecp256k1Key(pub_key: Union[bytes, IPublicKey]) IPublicKey

Validate and get a secp256k1 public key.

Parameters:

pub_key (bytes or IPublicKey object) – Public key bytes or object

Returns:

IPublicKey object

Return type:

IPublicKey object

Raises:
  • TypeError – If the public key is not secp256k1

  • ValueError – If the public key is not valid

static ValidateAndGetSr25519Key(pub_key: Union[bytes, IPublicKey]) IPublicKey

Validate and get a sr25519 public key.

Parameters:

pub_key (bytes or IPublicKey object) – Public key bytes or object

Returns:

IPublicKey object

Return type:

IPublicKey object

Raises:
  • TypeError – If the public key is not sr25519

  • ValueError – If the public key is not valid