
    ei$                         U d Z ddlmZ ddlmZmZmZmZmZ ddl	m
Z
mZmZ ej        Zeed<   ddlmZmZ ddlmZ dd	lmZ dd
lmZ  G d d          Z G d de
          ZdS )zm
Module for BIP44 keys derivation.
Reference: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
    )Union   )Bip32KeyDataBip32KeyIndexBip32KeyNetVersions
Bip32ConstBip32Slip10Secp256k1)	Bip44BaseBip44ChangesBip44Levels_BIP44_BTC_KEY_NET_VER_MAIN)BipCoinsBipCoinConf)	CoinsConf)Slip44)DER_PATH_NON_HARDENED_FULLc                   L    e Zd ZU dZdZeed<    ej        d          Z	e
ed<   dS )
Bip44Constz$Class container for BIP44 constants.zBIP-0044	SPEC_NAME,   PURPOSEN)__name__
__module____qualname____doc__r   str__annotations__r   HardenIndexr   int     f/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/static_dependencies/bip/bip44/bip44.pyr   r   +   sG         ..  Is,=,R00GS00000r!   r   c                       e Zd ZdZededefd            Zededefd            Z	defdZ
defdZd	edefd
ZdedefdZdedefdZedefd            ZdS )Bip44zq
    BIP44 class.
    It allows master key generation and children keys derivation in according to BIP-0044.
    
seed_bytesreturnc                    t          t          j                                        t          j        dt          t          dt          dt          j        	                    d          i          }| 
                    ||          S )a  
        Create a Bip44Base object from the specified seed (e.g. BIP39 seed).

        Args:
            seed_bytes (bytes)  : Seed bytes
            coin_type (BipCoins): Coin type, shall be a Bip44Coins enum

        Returns:
            Bip44Base object: Bip44Base object

        Raises:
            TypeError: If coin type is not a Bip44Coins enum
            ValueError: If the seed is too short
            Bip32KeyError: If the seed is not suitable for master key generation
        FNhrpaddr_hrp)
coin_namescoin_idx
is_testnetdef_pathkey_net_verwif_net_ver	bip32_clsaddr_params)r   r   Cosmos	CoinNamesr   ATOMr   r   r	   
ParamByKey	_FromSeed)clsr%   confs      r"   FromSeedzBip44.FromSeed>   sx    (  '1133[/3* y'22:>>
 
 
 }}Z!# # 	#r!   
ex_key_strc                 h    |                      |t                              t                              S )a  
        Create a Bip44Base object from the specified extended key.

        Args:
            ex_key_str (str)    : Extended key string
            coin_type (BipCoins): Coin type, shall be a Bip44Coins enum

        Returns:
            Bip44Base object: Bip44Base object

        Raises:
            TypeError: If coin type is not a Bip44Coins enum
            Bip32KeyError: If the extended key is not valid
        )_FromExtendedKeyBip44ConfGetter	GetConfig	coin_type)r7   r:   s     r"   FromExtendedKeyzBip44.FromExtendedKeyb   s(    & ##J0I0I)0T0TUUUr!   c                 @    |                      t          j                  S )aA  
        Derive a child key from the purpose and return a new Bip44Base object.

        Returns:
            Bip44Base object: Bip44Base object

        Raises:
            Bip44DepthError: If current depth is not suitable for deriving keys
            Bip32KeyError: If the derivation results in an invalid key
        )_PurposeGenericr   r   selfs    r"   PurposezBip44.Purpose   s     ##J$6777r!   c                 *    |                                  S )a]  
        Derive a child key from the coin type specified at construction and return a new Bip44Base object.

        Returns:
            Bip44Base object: Bip44Base object

        Raises:
            Bip44DepthError: If current depth is not suitable for deriving keys
            Bip32KeyError: If the derivation results in an invalid key
        )_CoinGenericrC   s    r"   Coinz
Bip44.Coin   s       """r!   acc_idxc                 ,    |                      |          S )a  
        Derive a child key from the specified account index and return a new Bip44Base object.

        Args:
            acc_idx (int): Account index

        Returns:
            Bip44Base object: Bip44Base object

        Raises:
            Bip44DepthError: If current depth is not suitable for deriving keys
            Bip32KeyError: If the derivation results in an invalid key
        )_AccountGeneric)rD   rI   s     r"   AccountzBip44.Account   s     ##G,,,r!   change_typec                 ,    |                      |          S )a  
        Derive a child key from the specified change type and return a new Bip44Base object.

        Args:
            change_type (Bip44Changes): Change type, must a Bip44Changes enum

        Returns:
            Bip44Base object: Bip44Base object

        Raises:
            TypeError: If change type is not a Bip44Changes enum
            Bip44DepthError: If current depth is not suitable for deriving keys
            Bip32KeyError: If the derivation results in an invalid key
        )_ChangeGeneric)rD   rM   s     r"   ChangezBip44.Change   s      "";///r!   addr_idxc                 ,    |                      |          S )a  
        Derive a child key from the specified address index and return a new Bip44Base object.

        Args:
            addr_idx (int): Address index

        Returns:
            Bip44Base object: Bip44Base object

        Raises:
            Bip44DepthError: If current depth is not suitable for deriving keys
            Bip32KeyError: If the derivation results in an invalid key
        )_AddressIndexGeneric)rD   rQ   s     r"   AddressIndexzBip44.AddressIndex   s     ((222r!   c                      t           j        S )z_
        Get specification name.

        Returns:
            str: Specification name
        )r   r   r    r!   r"   SpecNamezBip44.SpecName  s     ##r!   N)r   r   r   r   classmethodbytesr
   r9   r   r@   rE   rH   r   rL   r   rP   rT   staticmethodrV   r    r!   r"   r$   r$   4   sO         !#"!#'0!# !# !# [!#F V$'V,5V V V [V`8 8 8 8 8#i # # # #--!*- - - -"0(0-60 0 0 0$3"3'03 3 3 3" $c $ $ $ \$ $ $r!   r$   N)r   typingr   bip32r   r   r   r   r	   
bip44_baser
   r   r   MAIN_NET_KEY_NET_VERSIONSr   r   conf.commonr   r   	coin_confr   slip.slip44r   r   r   r$   r    r!   r"   <module>ra      s;  *         f f f f f f f f f f f f f f = = = = = = = = = =3=3W 0 W W W 0 / / / / / / / ! ! ! ! ! !             4 4 4 4 4 41 1 1 1 1 1 1 1U$ U$ U$ U$ U$I U$ U$ U$ U$ U$r!   