Add basic tests for ed25519 keys
This commit is contained in:
parent
487c923791
commit
673ce40133
22
tests/crypto/test_ed25519.py
Normal file
22
tests/crypto/test_ed25519.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
from libp2p.crypto.ed25519 import create_new_key_pair
|
||||||
|
from libp2p.crypto.serialization import deserialize_private_key, deserialize_public_key
|
||||||
|
|
||||||
|
|
||||||
|
def test_public_key_serialize_deserialize_round_trip():
|
||||||
|
key_pair = create_new_key_pair()
|
||||||
|
public_key = key_pair.public_key
|
||||||
|
|
||||||
|
public_key_bytes = public_key.serialize()
|
||||||
|
another_public_key = deserialize_public_key(public_key_bytes)
|
||||||
|
|
||||||
|
assert public_key == another_public_key
|
||||||
|
|
||||||
|
|
||||||
|
def test_private_key_serialize_deserialize_round_trip():
|
||||||
|
key_pair = create_new_key_pair()
|
||||||
|
private_key = key_pair.private_key
|
||||||
|
|
||||||
|
private_key_bytes = private_key.serialize()
|
||||||
|
another_private_key = deserialize_private_key(private_key_bytes)
|
||||||
|
|
||||||
|
assert private_key == another_private_key
|
Loading…
Reference in New Issue
Block a user