Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
Add: network option on examples & docs
Browse files Browse the repository at this point in the history
  • Loading branch information
meherett committed Oct 14, 2023
1 parent 05018dd commit 597b4a9
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@ When you import, replace `bip38` to `qtum_bip38` package name.
from qtum_bip38 import (
private_key_to_wif, bip38_encrypt, bip38_decrypt
)
from typing import List
from typing import (
List, Literal
)

import json

# Private key
PRIVATE_KEY: str = "cbf4b9f70470856bb4f40f80b87edb90865997ffee6df315ab166d713af433a5"
# Passphrase / password
PASSPHRASE: str = "qtum123" # u"\u03D2\u0301\u0000\U00010400\U0001F4A9"
# Network type
NETWORK: Literal["mainnet", "testnet"] = "mainnet"
# To show detail
DETAIL: bool = True
# Wallet important format's
Expand All @@ -60,12 +64,12 @@ for WIF in WIFs:
print("WIF:", WIF)

encrypted_wif: str = bip38_encrypt(
wif=WIF, passphrase=PASSPHRASE
wif=WIF, passphrase=PASSPHRASE, network=NETWORK
)
print("BIP38 Encrypted WIF:", encrypted_wif)

print("BIP38 Decrypted:", json.dumps(bip38_decrypt(
encrypted_wif=encrypted_wif, passphrase=PASSPHRASE, detail=DETAIL
encrypted_wif=encrypted_wif, passphrase=PASSPHRASE, network=NETWORK, detail=DETAIL
), indent=4))

print("-" * 125)
Expand Down Expand Up @@ -114,13 +118,17 @@ BIP38 Decrypted: {
from qtum_bip38 import (
intermediate_code, create_new_encrypted_wif, confirm_code, bip38_decrypt
)
from typing import List
from typing import (
List, Literal
)

import json
import os

# Passphrase / password
PASSPHRASE: str = "qtum123" # u"\u03D2\u0301\u0000\U00010400\U0001F4A9"
# Network type
NETWORK: Literal["mainnet", "testnet"] = "mainnet"
# To show detail
DETAIL: bool = True
# List of samples with owner salt, seed, public key type, lot, and sequence
Expand Down Expand Up @@ -151,16 +159,16 @@ for SAMPLE in SAMPLES:
print("Intermediate Passphrase:", intermediate_passphrase)

encrypted_wif: dict = create_new_encrypted_wif(
intermediate_passphrase=intermediate_passphrase, public_key_type=SAMPLE["public_key_type"], seed=SAMPLE["seed"]
intermediate_passphrase=intermediate_passphrase, public_key_type=SAMPLE["public_key_type"], seed=SAMPLE["seed"], network=NETWORK
)
print("Encrypted WIF:", json.dumps(encrypted_wif, indent=4))

print("Confirm Code:", json.dumps(confirm_code(
passphrase=PASSPHRASE, confirmation_code=encrypted_wif["confirmation_code"], detail=DETAIL
passphrase=PASSPHRASE, confirmation_code=encrypted_wif["confirmation_code"], network=NETWORK, detail=DETAIL
), indent=4))

print("BIP38 Decrypted:", json.dumps(bip38_decrypt(
encrypted_wif=encrypted_wif["encrypted_wif"], passphrase=PASSPHRASE, detail=DETAIL
encrypted_wif=encrypted_wif["encrypted_wif"], passphrase=PASSPHRASE, network=NETWORK, detail=DETAIL
), indent=4))

print("-" * 125)
Expand Down

0 comments on commit 597b4a9

Please sign in to comment.