[#2] Add methods sign and verify
This commit is contained in:
parent
97bc53c6f4
commit
4433fc425a
9 changed files with 102 additions and 10 deletions
|
@ -1,16 +1,23 @@
|
|||
import pytest
|
||||
|
||||
from frostfs_api.crypto.key_extension import KeyExtension
|
||||
from tests.helpers.convert import convert_bytes_format_127_to_256
|
||||
from tests.helpers.resources import WIF, PRIVATE_KEY
|
||||
|
||||
|
||||
@pytest.mark.crypto
|
||||
class TestKeyExtension:
|
||||
WIF = "L1YS4myg3xHPvi3FHeLaEt7G8upwJaWL5YLV7huviuUtXFpzBMqZ"
|
||||
PRIVATE_KEY = [
|
||||
-128, -5, 30, -36, -118, 85, -67, -6, 81, 43, 93, -38, 106, 21, -88, 127, 15, 125, -79, -17, -40, 77, -15,
|
||||
122, -88, 72, 109, -47, 125, -80, -40, -38
|
||||
]
|
||||
|
||||
def test_get_private_key_from_wif_success(self, client_key_extension: KeyExtension):
|
||||
private_key = client_key_extension.get_private_key_from_wif(self.WIF)
|
||||
private_key = client_key_extension.get_private_key_from_wif(WIF)
|
||||
|
||||
assert len(private_key) == 32, f"Not correct len of private key, expected: 32 Actual: {len(private_key)} "
|
||||
assert private_key == bytes(convert_bytes_format_127_to_256(self.PRIVATE_KEY)), f"Not match private key, Expected: {self.PRIVATE_KEY}, Actual: {private_key}"
|
||||
assert private_key == bytes(convert_bytes_format_127_to_256(PRIVATE_KEY)), \
|
||||
f"Not match private key, Expected: {PRIVATE_KEY}, Actual: {private_key}"
|
||||
|
||||
def test_get_private_key_empty_wif(self, client_key_extension: KeyExtension):
|
||||
with pytest.raises(ValueError, match="Empty WIF private"):
|
||||
client_key_extension.get_private_key_from_wif("")
|
||||
|
||||
def test_get_private_key_incorrect_wif(self, client_key_extension: KeyExtension):
|
||||
with pytest.raises(ValueError, match="Invalid checksum"):
|
||||
client_key_extension.get_private_key_from_wif("AAAAAAABBBBBBBBBBBCCCCCCCDDDDDDDDDDDDDDDDD")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue