From bd8ca8d3945572923e372efd43231caae2e195d9 Mon Sep 17 00:00:00 2001 From: "William K. Santiago" Date: Sun, 23 Aug 2026 09:08:04 -0400 Subject: [PATCH] Expose nip55_max_batch_size() FFI so the batch cap has a single source --- keep-mobile/src/lib.rs | 5 +++++ keep-mobile/src/nip55.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/keep-mobile/src/lib.rs b/keep-mobile/src/lib.rs index 1e1b58f1..dbf95d97 100644 --- a/keep-mobile/src/lib.rs +++ b/keep-mobile/src/lib.rs @@ -144,6 +144,11 @@ pub fn backup_min_passphrase_length() -> u32 { keep_core::backup::MIN_PASSPHRASE_LEN as u32 } +#[uniffi::export] +pub fn nip55_max_batch_size() -> u32 { + nip55::MAX_BATCH_SIZE as u32 +} + #[uniffi::export] pub fn recover_nsec( share_data: Vec, diff --git a/keep-mobile/src/nip55.rs b/keep-mobile/src/nip55.rs index 02deb295..4ec9e328 100644 --- a/keep-mobile/src/nip55.rs +++ b/keep-mobile/src/nip55.rs @@ -30,7 +30,7 @@ const RATE_LIMIT_WINDOW: Duration = Duration::from_secs(60); // alone is not a sufficient DoS guard. const MAX_REQUESTS_PER_WINDOW: u32 = 60; const MAX_BACKOFF: Duration = Duration::from_secs(300); -const MAX_BATCH_SIZE: usize = 20; +pub(crate) const MAX_BATCH_SIZE: usize = 20; const MAX_RATE_LIMIT_ENTRIES: usize = 1000; const MAX_PERMISSIONS_COUNT: usize = 32; const MAX_PERMISSIONS_JSON_BYTES: usize = 8 * 1024;