diff --git a/docs/const.rst b/docs/const.rst new file mode 100644 index 0000000..e4b0112 --- /dev/null +++ b/docs/const.rst @@ -0,0 +1,21 @@ +===== +Const +===== + +.. autoclass:: hdwallet.const.SLIP10_ED25519_CONST + :members: + +.. autoclass:: hdwallet.const.KHOLAW_ED25519_CONST + :members: + +.. autoclass:: hdwallet.const.SLIP10_SECP256K1_CONST + :members: + +.. autoclass:: hdwallet.const.PUBLIC_KEY_TYPES + :members: + +.. autoclass:: hdwallet.const.WIF_TYPES + :members: + +.. autoclass:: hdwallet.const.ELECTRUM_V2_MODES + :members: diff --git a/docs/toctree.rst b/docs/toctree.rst index ea231bc..b9f0993 100644 --- a/docs/toctree.rst +++ b/docs/toctree.rst @@ -20,3 +20,4 @@ HDWallet Elliptic Curve Cryptographys (ECCs) Hierarchical Deterministic's (HD's) Addresses + Consts diff --git a/hdwallet/const.py b/hdwallet/const.py index e33861b..002310a 100644 --- a/hdwallet/const.py +++ b/hdwallet/const.py @@ -39,6 +39,19 @@ def __init__(self, data: Union[set, tuple, dict], **kwargs): class SLIP10_ED25519_CONST: + """ + ``SLIP10-ED25519`` Constants. + + +-------------------------+--------------+ + | Name | Value | + +=========================+==============+ + | PRIVATE_KEY_BYTE_LENGTH | 32 | + +-------------------------+--------------+ + | PUBLIC_KEY_PREFIX | ``0x00`` | + +-------------------------+--------------+ + | PUBLIC_KEY_BYTE_LENGTH | 32 | + +-------------------------+--------------+ + """ PRIVATE_KEY_BYTE_LENGTH: int = 32 PUBLIC_KEY_PREFIX: bytes = b"\x00" @@ -46,11 +59,43 @@ class SLIP10_ED25519_CONST: class KHOLAW_ED25519_CONST(SLIP10_ED25519_CONST): + """ + ``KHOLAW-ED25519`` Constants. + + +-------------------------+--------------+ + | Name | Value | + +=========================+==============+ + | PRIVATE_KEY_BYTE_LENGTH | 64 | + +-------------------------+--------------+ + | PUBLIC_KEY_PREFIX | ``0x00`` | + +-------------------------+--------------+ + | PUBLIC_KEY_BYTE_LENGTH | 32 | + +-------------------------+--------------+ + """ PRIVATE_KEY_BYTE_LENGTH: int = 64 class SLIP10_SECP256K1_CONST: + """ + ``SLIP10-SECP256K1`` Constants. + + +-------------------------------------+-------------+ + | Name | Value | + +=====================================+=============+ + | USE | 'coincurve' | + +-------------------------------------+-------------+ + | POINT_COORDINATE_BYTE_LENGTH | 32 | + +-------------------------------------+-------------+ + | PRIVATE_KEY_BYTE_LENGTH | 32 | + +-------------------------------------+-------------+ + | PUBLIC_KEY_PREFIX | ``0x04`` | + +-------------------------------------+-------------+ + | PUBLIC_KEY_COMPRESSED_BYTE_LENGTH | 33 | + +-------------------------------------+-------------+ + | PUBLIC_KEY_UNCOMPRESSED_BYTE_LENGTH | 65 | + +-------------------------------------+-------------+ + """ USE: Literal["coincurve", "ecdsa"] = "coincurve" POINT_COORDINATE_BYTE_LENGTH: int = 32 @@ -166,36 +211,90 @@ class XPublicKeyVersions(ExtendedKeyVersions): class PUBLIC_KEY_TYPES: + """ + ``PUBLIC_KEY_TYPES`` Constants. + + +----------------+-----------------+ + | Name | Value | + +================+=================+ + | COMPRESSED | 'uncompressed' | + +----------------+-----------------+ + | UNCOMPRESSED | 'compressed' | + +----------------+-----------------+ + """ UNCOMPRESSED: str = "uncompressed" COMPRESSED: str = "compressed" @classmethod def get_types(cls) -> List[str]: + """ + Get a list of all public key types. + + :return: List of public key types. + :rtype: List[str] + """ + return [ cls.UNCOMPRESSED, cls.COMPRESSED ] class WIF_TYPES: + """ + ``WIF_TYPES`` Constants. + + +----------------+------------------+ + | Name | Value | + +================+==================+ + | WIF | 'wif' | + +----------------+------------------+ + | WIF_COMPRESSED | 'wif-compressed' | + +----------------+------------------+ + """ WIF: str = "wif" WIF_COMPRESSED: str = "wif-compressed" @classmethod def get_types(cls) -> List[str]: + """ + Get a list of all WIF types. + + :return: List of WIF types. + :rtype: List[str] + """ + return [ cls.WIF, cls.WIF_COMPRESSED ] class ELECTRUM_V2_MODES: + """ + ``PUBLIC_KEY_TYPES`` Constants. + + +----------------+-----------------+ + | Name | Value | + +================+=================+ + | STANDARD | 'standard' | + +----------------+-----------------+ + | SEGWIT | 'segwit' | + +----------------+-----------------+ + """ STANDARD: str = "standard" SEGWIT: str = "segwit" @classmethod def get_modes(cls) -> List[str]: + """ + Get a list of all Electrum V2 modes. + + :return: List of Electrum V2 modes. + :rtype: List[str] + """ + return [ cls.STANDARD, cls.SEGWIT ]