Skip to content

Commit 5478171

Browse files
authored
Merge pull request #29 from chainxlab/axiom90/const-docs
Axiom90/const docs
2 parents 386af5f + 684bab5 commit 5478171

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed

docs/const.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
=====
2+
Const
3+
=====
4+
5+
.. autoclass:: hdwallet.const.SLIP10_ED25519_CONST
6+
:members:
7+
8+
.. autoclass:: hdwallet.const.KHOLAW_ED25519_CONST
9+
:members:
10+
11+
.. autoclass:: hdwallet.const.SLIP10_SECP256K1_CONST
12+
:members:
13+
14+
.. autoclass:: hdwallet.const.PUBLIC_KEY_TYPES
15+
:members:
16+
17+
.. autoclass:: hdwallet.const.WIF_TYPES
18+
:members:
19+
20+
.. autoclass:: hdwallet.const.ELECTRUM_V2_MODES
21+
:members:

docs/toctree.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ HDWallet
2020
Elliptic Curve Cryptographys (ECCs) <ecc.rst>
2121
Hierarchical Deterministic's (HD's) <hds.rst>
2222
Addresses <addresses.rst>
23+
Consts <const.rst>

hdwallet/const.py

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,63 @@ def __init__(self, data: Union[set, tuple, dict], **kwargs):
3939

4040

4141
class SLIP10_ED25519_CONST:
42+
"""
43+
``SLIP10-ED25519`` Constants.
44+
45+
+-------------------------+--------------+
46+
| Name | Value |
47+
+=========================+==============+
48+
| PRIVATE_KEY_BYTE_LENGTH | 32 |
49+
+-------------------------+--------------+
50+
| PUBLIC_KEY_PREFIX | ``0x00`` |
51+
+-------------------------+--------------+
52+
| PUBLIC_KEY_BYTE_LENGTH | 32 |
53+
+-------------------------+--------------+
54+
"""
4255

4356
PRIVATE_KEY_BYTE_LENGTH: int = 32
4457
PUBLIC_KEY_PREFIX: bytes = b"\x00"
4558
PUBLIC_KEY_BYTE_LENGTH: int = 32
4659

4760

4861
class KHOLAW_ED25519_CONST(SLIP10_ED25519_CONST):
62+
"""
63+
``KHOLAW-ED25519`` Constants.
64+
65+
+-------------------------+--------------+
66+
| Name | Value |
67+
+=========================+==============+
68+
| PRIVATE_KEY_BYTE_LENGTH | 64 |
69+
+-------------------------+--------------+
70+
| PUBLIC_KEY_PREFIX | ``0x00`` |
71+
+-------------------------+--------------+
72+
| PUBLIC_KEY_BYTE_LENGTH | 32 |
73+
+-------------------------+--------------+
74+
"""
4975

5076
PRIVATE_KEY_BYTE_LENGTH: int = 64
5177

5278

5379
class SLIP10_SECP256K1_CONST:
80+
"""
81+
``SLIP10-SECP256K1`` Constants.
82+
83+
+-------------------------------------+-------------+
84+
| Name | Value |
85+
+=====================================+=============+
86+
| USE | 'coincurve' |
87+
+-------------------------------------+-------------+
88+
| POINT_COORDINATE_BYTE_LENGTH | 32 |
89+
+-------------------------------------+-------------+
90+
| PRIVATE_KEY_BYTE_LENGTH | 32 |
91+
+-------------------------------------+-------------+
92+
| PUBLIC_KEY_PREFIX | ``0x04`` |
93+
+-------------------------------------+-------------+
94+
| PUBLIC_KEY_COMPRESSED_BYTE_LENGTH | 33 |
95+
+-------------------------------------+-------------+
96+
| PUBLIC_KEY_UNCOMPRESSED_BYTE_LENGTH | 65 |
97+
+-------------------------------------+-------------+
98+
"""
5499

55100
USE: Literal["coincurve", "ecdsa"] = "coincurve"
56101
POINT_COORDINATE_BYTE_LENGTH: int = 32
@@ -166,36 +211,90 @@ class XPublicKeyVersions(ExtendedKeyVersions):
166211

167212

168213
class PUBLIC_KEY_TYPES:
214+
"""
215+
``PUBLIC_KEY_TYPES`` Constants.
216+
217+
+----------------+-----------------+
218+
| Name | Value |
219+
+================+=================+
220+
| COMPRESSED | 'uncompressed' |
221+
+----------------+-----------------+
222+
| UNCOMPRESSED | 'compressed' |
223+
+----------------+-----------------+
224+
"""
169225

170226
UNCOMPRESSED: str = "uncompressed"
171227
COMPRESSED: str = "compressed"
172228

173229
@classmethod
174230
def get_types(cls) -> List[str]:
231+
"""
232+
Get a list of all public key types.
233+
234+
:return: List of public key types.
235+
:rtype: List[str]
236+
"""
237+
175238
return [
176239
cls.UNCOMPRESSED, cls.COMPRESSED
177240
]
178241

179242

180243
class WIF_TYPES:
244+
"""
245+
``WIF_TYPES`` Constants.
246+
247+
+----------------+------------------+
248+
| Name | Value |
249+
+================+==================+
250+
| WIF | 'wif' |
251+
+----------------+------------------+
252+
| WIF_COMPRESSED | 'wif-compressed' |
253+
+----------------+------------------+
254+
"""
181255

182256
WIF: str = "wif"
183257
WIF_COMPRESSED: str = "wif-compressed"
184258

185259
@classmethod
186260
def get_types(cls) -> List[str]:
261+
"""
262+
Get a list of all WIF types.
263+
264+
:return: List of WIF types.
265+
:rtype: List[str]
266+
"""
267+
187268
return [
188269
cls.WIF, cls.WIF_COMPRESSED
189270
]
190271

191272

192273
class ELECTRUM_V2_MODES:
274+
"""
275+
``PUBLIC_KEY_TYPES`` Constants.
276+
277+
+----------------+-----------------+
278+
| Name | Value |
279+
+================+=================+
280+
| STANDARD | 'standard' |
281+
+----------------+-----------------+
282+
| SEGWIT | 'segwit' |
283+
+----------------+-----------------+
284+
"""
193285

194286
STANDARD: str = "standard"
195287
SEGWIT: str = "segwit"
196288

197289
@classmethod
198290
def get_modes(cls) -> List[str]:
291+
"""
292+
Get a list of all Electrum V2 modes.
293+
294+
:return: List of Electrum V2 modes.
295+
:rtype: List[str]
296+
"""
297+
199298
return [
200299
cls.STANDARD, cls.SEGWIT
201300
]

0 commit comments

Comments
 (0)