libp2p / js-libp2p

The JavaScript Implementation of libp2p networking stack.
https://libp2p.io
Other
2.26k stars 436 forks source link

fix: make plaintext public key follow to the specs #2599

Open oott123 opened 2 weeks ago

oott123 commented 2 weeks ago

Title

fix: make plaintext public key follow to the specs

Description

In js, all "public keys" are marshaled using protobuf PublicKey message.

However, according to specs and other implementations, the Data field should contains the raw key, instead of the protobuf marshaled key, and then put in to the exchange.

Otherwise, js-libp2p will not connect to golang or rust libp2p, raising the "Public key did not match id" error, if only plaintext selected for encryption.

Notes & open questions

Should we involve some cross-implementation tests to check if any further issue like that?

Change checklist

oott123 commented 2 weeks ago

So weird that tests are still failed. I think I have finished all the changes required... have no clue now