Skip to content

Commit 606c003

Browse files
committed
Add a test for WIF decoding
1 parent 9a568bd commit 606c003

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/tests/samples.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,10 @@
4040
sample_sig_sha1 = unhexlify(
4141
'304502203b50123af78b4e40f5f819ae5b8786f48826e56d0f3e65744708a493f5b65de1'
4242
'0221009ddce2981ea143c0ac70404a535327e774adce8eebbae2d35104f1d326255f9a')
43+
44+
45+
# [chan] bitmessage
46+
sample_wif_privsigningkey = unhexlify(
47+
b'a2e8b841a531c1c558ee0680c396789c7a2ea3ac4795ae3f000caf9fe367d144')
48+
sample_wif_privencryptionkey = unhexlify(
49+
b'114ec0e2dca24a826a0eed064b0405b0ac148abc3b1d52729697f4d7b873fdc6')

src/tests/test_addresses.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
import unittest
33
from binascii import unhexlify
44

5-
from pybitmessage import addresses
5+
from pybitmessage import addresses, shared
66

7-
from .samples import sample_address, sample_ripe
7+
from .samples import (
8+
sample_address, sample_ripe,
9+
sample_wif_privsigningkey, sample_wif_privencryptionkey)
810

911

1012
class TestAddresses(unittest.TestCase):
@@ -33,3 +35,14 @@ def test_encode(self):
3335
self.assertEqual(
3436
sample_address,
3537
addresses.encodeAddress(2, 1, unhexlify(sample_ripe)))
38+
39+
def test_wif(self):
40+
"""Decode WIFs of [chan] bitmessage and check the keys"""
41+
self.assertEqual(
42+
sample_wif_privsigningkey,
43+
shared.decodeWalletImportFormat(
44+
b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm'))
45+
self.assertEqual(
46+
sample_wif_privencryptionkey,
47+
shared.decodeWalletImportFormat(
48+
b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHqpA'))

0 commit comments

Comments
 (0)