bip32_kholaw_key_derivator_base

Module for BIP32 Khovratovich/Law keys derivation (base). Reference: https://github.com/LedgerHQ/orakolo/blob/master/papers/Ed25519_BIP%20Final.pdf

class Bip32KholawEd25519KeyDerivatorBase

Bases: IBip32KeyDerivator, ABC

BIP32 Khovratovich/Law ed25519 key derivator base class. It allows keys derivation for ed25519 curves in according to BIP32 Khovratovich/Law. It shall be inherited by child classes to customize the derivation algorithm.

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