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:
Alex Stokes
2019-08-20 19:01:36 +02:00
parent 5d611801c7
commit 87d943aa39
3 changed files with 21 additions and 21 deletions

View File

@ -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())