libp2p / js-peer-id

peer-id implementation in JavaScript. Deprecated; use https://github.com/libp2p/js-libp2p-peer-id instead.
https://github.com/libp2p/js-libp2p-peer-id
MIT License
81 stars 44 forks source link

.createFromJSON does not check if public key and id match #79

Closed mkg20001 closed 5 years ago

mkg20001 commented 6 years ago

.createFromJSON only matches private key => id and private key => public key

Because the private key is optional the public key will not get matched against the id if it is missing.

mkg20001 commented 5 years ago

Is this fixed now?

jacobheun commented 5 years ago

Yes, it looks like it. We verify the private and pub key digests match (if there is a public key) and that the id and priv digest match, which inherently validate the public and id match.