mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-09 22:50:54 +00:00
Internalize the protobuf serialization to the concept of a Key
Given its use across various components of `libp2p` (not just peer IDs), it makes the abstraction cleaner to pull the serialization into the key class and expose the canonical serialization to bytes.
This commit is contained in:
@ -92,7 +92,7 @@ def test_id_from_public_key():
|
||||
key_pair = create_new_key_pair()
|
||||
public_key = key_pair.public_key
|
||||
|
||||
key_bin = public_key.serialize_to_protobuf().SerializeToString()
|
||||
key_bin = public_key.serialize()
|
||||
algo = multihash.Func.sha2_256
|
||||
mh_digest = multihash.digest(key_bin, algo)
|
||||
expected = ID(mh_digest.encode())
|
||||
|
||||
Reference in New Issue
Block a user