bip32_slip10_key_derivator

Module for BIP32 SLIP-0010 keys derivation.

References

https://github.com/satoshilabs/slips/blob/master/slip-0010.md https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

class Bip32Slip10DerivatorConst

Bases: object

Class container for BIP32 SLIP-0010 derivator constants.

PRIV_KEY_PREFIX: bytes = b'\x00'
class Bip32Slip10EcdsaDerivator

Bases: IBip32KeyDerivator

BIP32 SLIP-0010 ECDSA key derivator class. It allows keys derivation for ECDSA curves in according to BIP32 SLIP-0010.

static IsPublicDerivationSupported() bool

Get if public derivation is supported.

Returns:

True if supported, false otherwise.

Return type:

bool

classmethod CkdPriv(priv_key: Bip32PrivateKey, pub_key: Bip32PublicKey, index: Bip32KeyIndex) Tuple[bytes, bytes]

Derive a child key with the specified index using private derivation.

Parameters:
  • priv_key (Bip32PrivateKey object) – Bip32PrivateKey object

  • pub_key (Bip32PublicKey object) – Bip32PublicKey object

  • index (Bip32KeyIndex object) – Key index

Returns:

Private key bytes (index 0) and chain code bytes (index 1)

Return type:

tuple[bytes, bytes]

Raises:

Bip32KeyError – If the index results in an invalid key

classmethod CkdPub(pub_key: Bip32PublicKey, index: Bip32KeyIndex) Tuple[Union[bytes, IPoint], bytes]

Derive a child key with the specified index using public derivation.

Parameters:
  • pub_key (Bip32PublicKey object) – Bip32PublicKey object

  • index (Bip32KeyIndex object) – Key index

Returns:

Public key bytes or point (index 0) and chain code bytes (index 1)

Return type:

tuple[bytes or IPoint, bytes]

Raises:

Bip32KeyError – If the index results in an invalid key

class Bip32Slip10Ed25519Derivator

Bases: IBip32KeyDerivator

BIP32 SLIP-0010 ed25519 key derivator class. It allows keys derivation for ed25519 curves in according to BIP32 SLIP-0010.

static IsPublicDerivationSupported() bool

Get if public derivation is supported.

Returns:

True if supported, false otherwise.

Return type:

bool

classmethod CkdPriv(priv_key: Bip32PrivateKey, pub_key: Bip32PublicKey, index: Bip32KeyIndex) Tuple[bytes, bytes]

Derive a child key with the specified index using private derivation.

Parameters:
  • priv_key (Bip32PrivateKey object) – Bip32PrivateKey object

  • pub_key (Bip32PublicKey object) – Bip32PublicKey object

  • index (Bip32KeyIndex object) – Key index

Returns:

Private key bytes (index 0) and chain code bytes (index 1)

Return type:

tuple[bytes, bytes]

Raises:

Bip32KeyError – If the index results in an invalid key

classmethod CkdPub(pub_key: Bip32PublicKey, index: Bip32KeyIndex) Tuple[Union[bytes, IPoint], bytes]

Derive a child key with the specified index using public derivation.

Parameters:
  • pub_key (Bip32PublicKey object) – Bip32PublicKey object

  • index (Bip32KeyIndex object) – Key index

Returns:

Public key bytes or point (index 0) and chain code bytes (index 1)

Return type:

tuple[bytes or IPoint, bytes]

Raises:

Bip32KeyError – If the index results in an invalid key