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
80 stars 44 forks source link

Missing ID validation #83

Closed alanshaw closed 2 years ago

alanshaw commented 6 years ago

Shouldn't there be some more validation of the ID passed to PeerId?

Currently it's checked to ensure it's a buffer...shouldn't it be checked to ensure it's a valid CID?

Also applies to the commonly used factory functions like createFromB58String, which will ensure the string is base 58 encoded but nothing else.

vogdb commented 2 years ago

Hi! Is this still actual? I see that factory functions have validations as of now.

cc @vasco-santos

vasco-santos commented 2 years ago

Hi! Is this still actual? I see that factory functions have validations as of now.

That's correct, thanks