Skip to content

Commit feb511f

Browse files
committed
Update: documentation typo errors
1 parent 2f53c3e commit feb511f

File tree

3 files changed

+29
-22
lines changed

3 files changed

+29
-22
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
[![Documentation Status](https://readthedocs.org/projects/bip38/badge/?version=master)](https://bip38.readthedocs.io)
66
[![PyPI License](https://img.shields.io/pypi/l/bip38?color=black)](https://pypi.org/project/bip38)
77
[![PyPI Python Version](https://img.shields.io/pypi/pyversions/bip38.svg)](https://pypi.org/project/bip38)
8-
9-
[comment]: <> ([![Coverage Status]&#40;https://coveralls.io/repos/github/meherett/python-bip38/badge.svg?branch=master&#41;]&#40;https://coveralls.io/github/meherett/python-bip38&#41;)
8+
[![Coverage Status](https://coveralls.io/repos/github/meherett/python-bip38/badge.svg?branch=master)](https://coveralls.io/github/meherett/python-bip38)
109

1110
Python library for implementation of Bitcoin Improvement Proposal - 0038 / BIP38 protocol. It supports both [No EC-multiply](https://github.com/bitcoin/bips/blob/master/bip-0038.mediawiki#encryption-when-ec-multiply-flag-is-not-used) and [EC-multiply](https://github.com/bitcoin/bips/blob/master/bip-0038.mediawiki#encryption-when-ec-multiply-mode-is-used) modes.
1211

bip38/bip38.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,14 @@ def encode_wif(private_key: Union[str, bytes]) -> Tuple[str, str]:
285285

286286
def private_key_to_wif(private_key: Union[str, bytes], wif_type: Literal["wif", "wif-compressed"] = "wif-compressed") -> str:
287287
"""
288-
Private key to Wallet Important Fromat (WFI) converter
288+
Private key to Wallet Important Format (WIF) converter
289289
290290
:param private_key: Private key
291291
:type private_key: Union[str, bytes]
292-
:param wif_type: Wallet Important Fromat (WFI) type, default to ``wif-compressed``
292+
:param wif_type: Wallet Important Format (WIF) type, default to ``wif-compressed``
293293
:type wif_type: Literal["wif", "wif-compressed"]
294294
295-
:returns: str -- Wallet Important Fromat
295+
:returns: str -- Wallet Important Format
296296
297297
>>> from bip38 import private_key_to_wif
298298
>>> private_key_to_wif(private_key="cbf4b9f70470856bb4f40f80b87edb90865997ffee6df315ab166d713af433a5")
@@ -339,9 +339,9 @@ def decode_wif(wif: str) -> Tuple[bytes, Literal["wif", "wif-compressed"], bytes
339339

340340
def wif_to_private_key(wif: str) -> str:
341341
"""
342-
Wallet Important Fromat (WFI) to Private key converter
342+
Wallet Important Format (WIF) to Private key converter
343343
344-
:param wif: Wallet Important Fromat
344+
:param wif: Wallet Important Format
345345
:type wif: str
346346
347347
:returns: str -- Private key
@@ -358,12 +358,12 @@ def wif_to_private_key(wif: str) -> str:
358358

359359
def get_wif_type(wif: str) -> Literal["wif", "wif-compressed"]:
360360
"""
361-
Get Wallet Important Fromat (WFI) type
361+
Get Wallet Important Format (WIF) type
362362
363-
:param wif: Wallet Important Fromat
363+
:param wif: Wallet Important Format
364364
:type wif: str
365365
366-
:returns: Literal["wif", "wif-compressed"] -- WFI type
366+
:returns: Literal["wif", "wif-compressed"] -- WIF type
367367
368368
>>> from bip38 import get_wif_type
369369
>>> get_wif_type(wif="L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP")
@@ -377,12 +377,12 @@ def get_wif_type(wif: str) -> Literal["wif", "wif-compressed"]:
377377

378378
def get_wif_checksum(wif: str) -> str:
379379
"""
380-
Get Wallet Important Fromat (WFI) checksum
380+
Get Wallet Important Format (WIF) checksum
381381
382-
:param wif: Wallet Important Fromat
382+
:param wif: Wallet Important Format
383383
:type wif: str
384384
385-
:returns: str -- WFI checksum
385+
:returns: str -- WIF checksum
386386
387387
>>> from bip38 import get_wif_checksum
388388
>>> get_wif_checksum(wif="L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP")
@@ -406,10 +406,14 @@ def public_key_to_addresses(public_key: Union[str, bytes], network: Literal["mai
406406
:returns: str -- Address
407407
408408
>>> from bip38 import public_key_to_addresses
409-
>>> public_key_to_addresses(public_key="02d2ce831dd06e5c1f5b1121ef34c2af4bcb01b126e309234adbc3561b60c9360e")
409+
>>> public_key_to_addresses(public_key="02d2ce831dd06e5c1f5b1121ef34c2af4bcb01b126e309234adbc3561b60c9360e", network="mainnet")
410410
'164MQi977u9GUteHr4EPH27VkkdxmfCvGW'
411-
>>> public_key_to_addresses(public_key="04d2ce831dd06e5c1f5b1121ef34c2af4bcb01b126e309234adbc3561b60c9360ea7f23327b49ba7f10d17fad15f068b8807dbbc9e4ace5d4a0b40264eefaf31a4")
411+
>>> public_key_to_addresses(public_key="04d2ce831dd06e5c1f5b1121ef34c2af4bcb01b126e309234adbc3561b60c9360ea7f23327b49ba7f10d17fad15f068b8807dbbc9e4ace5d4a0b40264eefaf31a4", network="mainnet")
412412
'1Jq6MksXQVWzrznvZzxkV6oY57oWXD9TXB'
413+
>>> public_key_to_addresses(public_key="02d2ce831dd06e5c1f5b1121ef34c2af4bcb01b126e309234adbc3561b60c9360e", network="testnet")
414+
'mkaJhmE5vvaXG17uZdCm6wKpckEfnG4yt9'
415+
>>> public_key_to_addresses(public_key="04d2ce831dd06e5c1f5b1121ef34c2af4bcb01b126e309234adbc3561b60c9360ea7f23327b49ba7f10d17fad15f068b8807dbbc9e4ace5d4a0b40264eefaf31a4", network="testnet")
416+
'myM3eoxWDWxFe7GYHZw8K21rw7QDNZeDYM'
413417
"""
414418

415419
if network not in ["mainnet", "testnet"]:
@@ -652,7 +656,7 @@ def confirm_code(
652656
:type confirmation_code: str
653657
:param network: Network type
654658
:type network: Literal["mainnet", "testnet"], default to ``mainnet``
655-
:param detail: To show in deatil, default to ``False``
659+
:param detail: To show in detail, default to ``False``
656660
:type detail: bool
657661
658662
:returns: Union[str, dict] -- Confirmation of address info's
@@ -751,7 +755,7 @@ def bip38_decrypt(
751755
:type passphrase: str
752756
:param network: Network type
753757
:type network: Literal["mainnet", "testnet"], default to ``mainnet``
754-
:param detail: To show in deatil, default to ``False``
758+
:param detail: To show in detail, default to ``False``
755759
:type detail: bool
756760
757761
:returns: Union[str, dict] -- WIF or All private Key info's

docs/index.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ _______________
7070
PRIVATE_KEY: str = "cbf4b9f70470856bb4f40f80b87edb90865997ffee6df315ab166d713af433a5"
7171
# Passphrase / password
7272
PASSPHRASE: str = "meherett" # u"\u03D2\u0301\u0000\U00010400\U0001F4A9"
73+
# Network type
74+
NETWORK: Literal["mainnet", "testnet"] = "mainnet"
7375
# To show detail
7476
DETAIL: bool = True
7577
# Wallet important format's
@@ -83,12 +85,12 @@ _______________
8385
print("WIF:", WIF)
8486

8587
encrypted_wif: str = bip38_encrypt(
86-
wif=WIF, passphrase=PASSPHRASE
88+
wif=WIF, passphrase=PASSPHRASE, network=NETWORK
8789
)
8890
print("BIP38 Encrypted WIF:", encrypted_wif)
8991

9092
print("BIP38 Decrypted:", json.dumps(bip38_decrypt(
91-
encrypted_wif=encrypted_wif, passphrase=PASSPHRASE, detail=DETAIL
93+
encrypted_wif=encrypted_wif, passphrase=PASSPHRASE, network=NETWORK, detail=DETAIL
9294
), indent=4))
9395

9496
print("-" * 125)
@@ -152,6 +154,8 @@ EC multiply:
152154

153155
# Passphrase / password
154156
PASSPHRASE: str = "meherett" # u"\u03D2\u0301\u0000\U00010400\U0001F4A9"
157+
# Network type
158+
NETWORK: Literal["mainnet", "testnet"] = "mainnet"
155159
# To show detail
156160
DETAIL: bool = True
157161
# List of samples with owner salt, seed, public key type, lot, and sequence
@@ -182,16 +186,16 @@ EC multiply:
182186
print("Intermediate Passphrase:", intermediate_passphrase)
183187

184188
encrypted_wif: dict = create_new_encrypted_wif(
185-
intermediate_passphrase=intermediate_passphrase, public_key_type=SAMPLE["public_key_type"], seed=SAMPLE["seed"]
189+
intermediate_passphrase=intermediate_passphrase, public_key_type=SAMPLE["public_key_type"], seed=SAMPLE["seed"], network=NETWORK
186190
)
187191
print("Encrypted WIF:", json.dumps(encrypted_wif, indent=4))
188192

189193
print("Confirm Code:", json.dumps(confirm_code(
190-
passphrase=PASSPHRASE, confirmation_code=encrypted_wif["confirmation_code"], detail=DETAIL
194+
passphrase=PASSPHRASE, confirmation_code=encrypted_wif["confirmation_code"], network=NETWORK, detail=DETAIL
191195
), indent=4))
192196

193197
print("BIP38 Decrypted:", json.dumps(bip38_decrypt(
194-
encrypted_wif=encrypted_wif["encrypted_wif"], passphrase=PASSPHRASE, detail=DETAIL
198+
encrypted_wif=encrypted_wif["encrypted_wif"], passphrase=PASSPHRASE, network=NETWORK, detail=DETAIL
195199
), indent=4))
196200

197201
print("-" * 125)

0 commit comments

Comments
 (0)