Repository navigation
fix: share the key encoding across encrypters and keep RSA peer keys - #3669
Merged
Merged
Conversation
The key type is now read from the key instead of guessed from its length. The wire format is unchanged, pinned by new tests for Ed25519 and RSA.
Encode the certificate key with publicKeyToProtobuf, dropping the duplicated key schema, and derive the remote peer id from the key directly.
… parsing the identity key twice
…-cleanups # Conflicts: # packages/connection-encrypter-tls/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Small cleanups to how connection encrypters encode public keys and derive peer ids, ahead of the crypto API changes.
Exchange.pubkeyfield is now declared asbytesholding a protobuf-encodedPublicKey, instead of an embeddedPublicKeymessage. Both encode to the same bytes, so the wire format is unchanged. New tests pin this for Ed25519 and RSA against a hand-built exchange. The key type is now read from the key instead of being guessed from its length, so a key whose type does not match its data is rejected.publicKeyToProtobuf, which replaces a duplicate copy of the key schema. The remote peer id is derived from the key directly. RSA remote peers previously came back without their public key; they now keep it.peerIdFromPublicKeyinstead of round-tripping through a CID.Change checklist