mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Refactor ID to not use third-party type for cryptographic keys
Remove `ID.from_privkey` which would require specific knowledge per cryptosystem
This commit is contained in:
@ -111,13 +111,6 @@ def test_id_from_public_key():
|
||||
algo = multihash.Func.sha2_256
|
||||
mh_digest = multihash.digest(key_bin, algo)
|
||||
expected = ID(mh_digest.encode())
|
||||
actual = ID.from_pubkey(key)
|
||||
actual = ID.from_pubkey(key_bin)
|
||||
|
||||
assert actual == expected
|
||||
|
||||
|
||||
def test_id_from_private_key():
|
||||
key = RSA.generate(2048, e=65537)
|
||||
id_from_pub = ID.from_pubkey(key.publickey())
|
||||
id_from_priv = ID.from_privkey(key)
|
||||
assert id_from_pub == id_from_priv
|
||||
|
||||
Reference in New Issue
Block a user