Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: send raw plaintext public key during handshake #2599

Merged
merged 6 commits into from
Aug 16, 2024

Conversation

oott123
Copy link
Contributor

@oott123 oott123 commented Jun 20, 2024

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

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

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

However, according to [specs](https://github.com/libp2p/specs/blob/master/plaintext/README.md) 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.
@oott123 oott123 requested a review from a team as a code owner June 20, 2024 16:32
@oott123 oott123 marked this pull request as draft June 21, 2024 02:32
Co-authored-by: Alex Potsides <[email protected]>
@oott123
Copy link
Contributor Author

oott123 commented Jun 21, 2024

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

@achingbrain achingbrain marked this pull request as ready for review August 16, 2024 12:23
@achingbrain achingbrain changed the title fix: make plaintext public key follow to the specs fix: send raw plaintext public key during handshake Aug 16, 2024
@achingbrain achingbrain merged commit 359265a into libp2p:main Aug 16, 2024
24 checks passed
@achingbrain achingbrain mentioned this pull request Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants