-
Notifications
You must be signed in to change notification settings - Fork 455
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!: remove localPeer from secureInbound and secureOutbound #2304
Conversation
Blocked waiting for the next breaking change milestone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but I added a few questions for the tests. Much nicer to have each encrypter have the peerId within them.
approved, but not approving because tests are failing and I believe we're still waiting on another package
encrypter.secureInbound(remotePeer, inbound), | ||
encrypter.secureOutbound(localPeer, outbound, wrongPeer) | ||
encrypter.secureInbound(inbound, remotePeer), | ||
encrypter.secureOutbound(outbound, wrongPeer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, do we need an encrypterRemote
here like we have in packages/connection-encrypter-plaintext/test/index.spec.ts ?
If we can do either/or, it would be nice to use the same setup to not cause confusion and questions like this one :)
If we can't, maybe a comment explaining why? (maybe only for libp2p noobs like myself)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would make the test easier to read but this encrypter is stateless which is why it works as-is.
cryptoRemote.secureInbound(localConn), | ||
crypto.secureOutbound(remoteConn, remotePeer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar question about dissimilarities between encrypters we create&call for secureInbound
and secureOutbound
calls
Requiring the local peer id in connection encryption appears to be historical cruft. The more current approach would be to have a `ConnectionEncrypter` be specific to a single peer id, passed in during instantiation in its Components. BREAKING CHANGE: removes `localPeer: PeerId` first parameter from `secureInbound` and `secureOutbound` in `ConnectionEncrypter` --------- Co-authored-by: Alex Potsides <[email protected]>
Requiring the local peer id in connection encryption appears to be historical cruft. The more current approach would be to have a `ConnectionEncrypter` be specific to a single peer id, passed in during instantiation in its Components. BREAKING CHANGE: removes `localPeer: PeerId` first parameter from `secureInbound` and `secureOutbound` in `ConnectionEncrypter` --------- Co-authored-by: Alex Potsides <[email protected]>
Requiring the local peer id in connection encryption appears to be historical cruft. The more current approach would be to have a `ConnectionEncrypter` be specific to a single peer id, passed in during instantiation in its Components. BREAKING CHANGE: removes `localPeer: PeerId` first parameter from `secureInbound` and `secureOutbound` in `ConnectionEncrypter` --------- Co-authored-by: Alex Potsides <[email protected]>
Description
localPeer: PeerId
first parameter fromsecureInbound
andsecureOutbound
inConnectionEncrypter
Requiring the local peer id in connection encryption appears to be historical cruft. The more current approach would be to have a
ConnectionEncrypter
be specific to a single peer id, passed in during instantiation in its Components.Change checklist