Refactor using of crypto functions #1796
|
@ -2,7 +2,7 @@
|
||||||
import unittest
|
import unittest
|
||||||
from binascii import unhexlify
|
from binascii import unhexlify
|
||||||
|
|
||||||
from pybitmessage import addresses, shared
|
from pybitmessage import addresses, highlevelcrypto
|
||||||
|
|
||||||
from .samples import (
|
from .samples import (
|
||||||
sample_address, sample_daddr3_512, sample_daddr4_512,
|
sample_address, sample_daddr3_512, sample_daddr4_512,
|
||||||
|
@ -65,9 +65,21 @@ class TestAddresses(unittest.TestCase):
|
||||||
"""Decode WIFs of [chan] bitmessage and check the keys"""
|
"""Decode WIFs of [chan] bitmessage and check the keys"""
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
sample_wif_privsigningkey,
|
sample_wif_privsigningkey,
|
||||||
shared.decodeWalletImportFormat(
|
highlevelcrypto.decodeWalletImportFormat(
|
||||||
b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm'))
|
b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm'))
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
sample_wif_privencryptionkey,
|
sample_wif_privencryptionkey,
|
||||||
shared.decodeWalletImportFormat(
|
highlevelcrypto.decodeWalletImportFormat(
|
||||||
b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHqpA'))
|
b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHqpA'))
|
||||||
|
self.assertEqual(
|
||||||
|
b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm',
|
||||||
|
highlevelcrypto.encodeWalletImportFormat(
|
||||||
|
sample_wif_privsigningkey))
|
||||||
|
self.assertEqual(
|
||||||
|
b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHqpA',
|
||||||
|
highlevelcrypto.encodeWalletImportFormat(
|
||||||
|
sample_wif_privencryptionkey))
|
||||||
|
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
highlevelcrypto.decodeWalletImportFormat(
|
||||||
|
b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHq')
|
||||||
|
|
Reference in New Issue
Block a user