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

support inline public keys #101

Closed tobowers closed 4 years ago

tobowers commented 4 years ago

We are having trouble because we are using Secp256k1 from Go in our pubsub messages. Go does not set the "key" field of a message when publishing with an inline key. So javascript rejects any signed Go message (using Secp256k1).

There is a TODO here: https://github.com/libp2p/js-libp2p-pubsub/blob/master/src/message/sign.js#L76-L77

Well, hopefully this PR allows for that TODO to happen.

All this does is check if the peerID has identity encoding and if it does, attempt to recover the public key from the encoding.

tobowers commented 4 years ago

I fixed the lint failure here.

tobowers commented 4 years ago

What's the best way for me to help make the @0.12.x happen?

vasco-santos commented 4 years ago

Thanks for helping on it!

Go to this branch: https://github.com/libp2p/js-peer-id/tree/0.12.x Make these changes and within a new branch create a PR to add the new code to 0.12.x. This way, I can release this from the 0.12.x codebase

vasco-santos commented 4 years ago

Also, please take into account that in this version you are using the older libp2p-crypto.

https://github.com/libp2p/js-libp2p-crypto/tree/v0.16.2

tobowers commented 4 years ago

cool - that was pretty straight forward #102

vasco-santos commented 4 years ago

Thanks for getting it!

vasco-santos commented 4 years ago

Shipped 0.13.3 with this