cardano_byron_legacy
Module for Cardano Byron legacy keys derivation.
- class CardanoByronLegacyConst
Bases:
object
Class container for Cardano Byron legacy constants.
- HD_PATH_KEY_PBKDF2_SALT: str = 'address-hashing'
- HD_PATH_KEY_PBKDF2_ROUNDS: int = 500
- HD_PATH_KEY_PBKDF2_OUT_BYTE_LEN: int = 32
- class CardanoByronLegacy(bip32_obj: Bip32Base)
Bases:
object
Cardano Byron legacy class. It allows master key generation, children keys derivation and addresses computation like the old Daedalus wallet. Addresses are in the Ddz… format, which contains the encrypted derivation path.
- classmethod FromSeed(seed_bytes: bytes) CardanoByronLegacy
Construct class from seed bytes.
- Parameters:
seed_bytes (bytes) – Seed bytes
- Returns:
CardanoByronLegacy object
- Return type:
CardanoByronLegacy object
- Bip32Object() Bip32Base
Return the BIP32 object.
- Returns:
Bip32Base object
- Return type:
Bip32Base object
- HdPathKey() bytes
Get the key used for HD path decryption/encryption.
- Returns:
Key bytes
- Return type:
bytes
- HdPathFromAddress(address: str) Bip32Path
Get the HD path from an address by decrypting it. The address shall be derived from the current object master key (i.e. self.m_bip32_obj) in order to successfully decrypt the path.
- Parameters:
address (str) – Address string
- Returns:
Bip32Path object
- Return type:
Bip32Path object
- Raises:
ValueError – If the address encoding is not valid or the path cannot be decrypted
- MasterPrivateKey() Bip32PrivateKey
Get the master private key.
- Returns:
Bip32PrivateKey object
- Return type:
Bip32PrivateKey object
- MasterPublicKey() Bip32PublicKey
Get the master public key.
- Returns:
Bip32PublicKey object
- Return type:
Bip32PublicKey object
- GetPrivateKey(first_idx: Union[int, Bip32KeyIndex], second_idx: Union[int, Bip32KeyIndex]) Bip32PrivateKey
Get the private key with the specified indexes. Derivation path: m/first_idx’/second_idx’ The indexes will be automatically hardened if not (e.g. 0, 1’ -> 0’, 1’).
- Parameters:
first_idx (int or Bip32KeyIndex object) – First index
second_idx (int or Bip32KeyIndex object) – Second index
- Returns:
IPrivateKey object
- Return type:
IPrivateKey object
- Raises:
Bip32KeyError – If the derivation results in an invalid key
Bip32PathError – If the path indexes are not valid
- GetPublicKey(first_idx: Union[int, Bip32KeyIndex], second_idx: Union[int, Bip32KeyIndex]) Bip32PublicKey
Get the public key with the specified indexes. Derivation path: m/first_idx’/second_idx’ The indexes will be automatically hardened if not (e.g. 0, 1’ -> 0’, 1’).
- Parameters:
first_idx (int or Bip32KeyIndex object) – First index
second_idx (int or Bip32KeyIndex object) – Second index
- Returns:
IPublicKey object
- Return type:
IPublicKey object
- Raises:
Bip32KeyError – If the derivation results in an invalid key
Bip32PathError – If the path indexes are not valid
- GetAddress(first_idx: Union[int, Bip32KeyIndex], second_idx: Union[int, Bip32KeyIndex]) str
Get the address with the specified indexes. Derivation path: m/first_idx’/second_idx’ The indexes will be automatically hardened if not (e.g. 0, 1’ -> 0’, 1’).
- Parameters:
first_idx (int or Bip32KeyIndex object) – First index
second_idx (int or Bip32KeyIndex object) – Second index
- Returns:
Address
- Return type:
str
- Raises:
Bip32KeyError – If the derivation results in an invalid key
Bip32PathError – If the path indexes are not valid