Expose PjParam::receiver_pubkey() over FFI - #1771
Merged
Merged
Conversation
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).
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.
FFI consumers need the receiver's ephemeral HPKE public key as the
key for deduplicating and resuming sender sessions, matching what
the
payjoin-clireference already does. Until now the FFI PjParam was anopaque 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. Thisonly 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:
AI
in the body of this PR.