Unify mailbox ShortId derivation on HpkePublicKey#1763
Open
Jolah1 wants to merge 1 commit into
Open
Conversation
The sender's create_poll_request duplicated the receiver's ShortId derivation inline, marked with a TODO. Sender and receiver must derive mailbox IDs identically for a session to work, so keeping two copies risks silently drifting apart and breaking mailbox agreement. Move the derivation onto HpkePublicKey::short_id() as the single definition and call it from both the receiver's SessionContext mailbox methods and the sender's create_poll_request.
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.
Sender and receiver must derive mailbox
ShortIds identically for an Async Payjoin session to work. The receiver had this derivation as a helper (short_id_from_pubkey), while the sender'screate_poll_request()inlined an equivalent copy marked with a// TODO unify with receiver's fn short_id_from_pubkey. Two independent copies of the derivation risk silently drifting apart and breaking mailbox agreement.This moves the derivation onto the key type as
HpkePublicKey::short_id()(pub(crate), incore/hpke.rs) as the single definition, and calls it from both the receiver'sSessionContextmailbox methods and the sender'screate_poll_request(). Pure refactor, no behavior change — the existing v2 integration tests exercise sender/receiver mailbox agreement end-to-end and pass unchanged.Closes #1708
Disclosure: co-authored by Claude Code — implementation written by Claude Code, reviewed by me.
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.