Skip to content

Expose PjParam::receiver_pubkey() over FFI - #1771

Merged
chavic merged 1 commit into
payjoin:masterfrom
DanGould:ffi-pjparam-receiver-pubkey
Jul 29, 2026
Merged

Expose PjParam::receiver_pubkey() over FFI#1771
chavic merged 1 commit into
payjoin:masterfrom
DanGould:ffi-pjparam-receiver-pubkey

Conversation

@DanGould

@DanGould DanGould commented Jul 29, 2026

Copy link
Copy Markdown
Member

FFI consumers need the receiver's ephemeral HPKE public key as the
key for deduplicating and resuming sender sessions, matching what
the payjoin-cli reference already does. Until now the FFI PjParam was an
opaque object with no exported methods, forcing wallets to scrape the
compressed key out of the endpoint fragment and reimplement URI-format
knowledge that belongs in the library.

Add a #[uniffi::export] getter returning the 33-byte compressed key,
mirroring the existing SenderSessionHistory::fallback_tx() pattern. This
only bridges to FFI what core already exposes as pub for exactly this
purpose; the genuinely-internal fields stay pub(crate).

Uniffi has no fixed-size-array type, so we return a vec rather than [u8; 33]

I found this while hacking on WasabiWallet and realizing it needed to index on the pk as the reference payjoin-cli does.

Disclosure: Co-authored by: Claude Code

Pull Request Checklist

Please confirm the following before requesting review:

FFI consumers need the receiver's ephemeral HPKE public key as the
key for deduplicating and resuming sender sessions, matching what
payjoin-cli already does natively. Until now the FFI PjParam was an
opaque object with no exported methods, forcing wallets to scrape the
compressed key out of the endpoint fragment and reimplement URI-format
knowledge that belongs in the library.

Add a #[uniffi::export] getter returning the 33-byte compressed key,
mirroring the existing SenderSessionHistory::fallback_tx() pattern. This
only bridges to FFI what core already exposes as pub for exactly this
purpose; the genuinely-internal fields stay pub(crate).

@chavic chavic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK
Since this key's meaning is fixed by BIP 77 rather than by implementation internals, it's safe to expose; #1082 kept it public in core for this.

@chavic
chavic merged commit a5ff964 into payjoin:master Jul 29, 2026
35 checks passed
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