Skip to content

Commit a5ff964

Browse files
authored
Expose PjParam::receiver_pubkey() over FFI (#1771)
2 parents 4fa4076 + efb7204 commit a5ff964

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

payjoin-ffi/src/send/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,18 @@ impl From<PjParam> for payjoin::uri::v2::PjParam {
252252
fn from(value: PjParam) -> Self { value.0 }
253253
}
254254

255+
#[uniffi::export]
256+
impl PjParam {
257+
/// The receiver's ephemeral HPKE public key, as 33 compressed bytes.
258+
///
259+
/// Stable for the lifetime of a receive session. Consumers use it to
260+
/// deduplicate and resume sender sessions and to ensure a receiver key
261+
/// is not reused across sessions, without parsing the endpoint fragment.
262+
pub fn receiver_pubkey(&self) -> Vec<u8> {
263+
self.0.receiver_pubkey().to_compressed_bytes().to_vec()
264+
}
265+
}
266+
255267
#[derive(uniffi::Object, Clone)]
256268
pub struct SenderSessionHistory(pub payjoin::send::v2::SessionHistory);
257269

0 commit comments

Comments
 (0)