Skip to content

Unify mailbox ShortId derivation on HpkePublicKey#1763

Open
Jolah1 wants to merge 1 commit into
payjoin:masterfrom
Jolah1:unify-short-id
Open

Unify mailbox ShortId derivation on HpkePublicKey#1763
Jolah1 wants to merge 1 commit into
payjoin:masterfrom
Jolah1:unify-short-id

Conversation

@Jolah1

@Jolah1 Jolah1 commented Jul 24, 2026

Copy link
Copy Markdown

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's create_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), in core/hpke.rs) as the single definition, and calls it from both the receiver's SessionContext mailbox methods and the sender's create_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:

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.
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.

Unify sender mailbox ShortId derivation with receiver's

1 participant