Skip to content

Commit 2ab6d8f

Browse files
committed
ffi(nostr-sdk): add ClientSigner::PrivateKeys due to kotlin limitation
1 parent f96f738 commit 2ab6d8f

File tree

1 file changed

+19
-2
lines changed
  • bindings/nostr-sdk-ffi/src/client/signer

1 file changed

+19
-2
lines changed

bindings/nostr-sdk-ffi/src/client/signer/mod.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,25 @@ pub mod nip46;
1313

1414
#[derive(Enum)]
1515
pub enum ClientSigner {
16-
Keys { signer: Arc<Keys> },
17-
NIP46 { signer: Arc<nip46::Nip46Signer> },
16+
#[cfg(target_os = "android")]
17+
PrivateKeys {
18+
signer: Arc<Keys>,
19+
},
20+
#[cfg(not(target_os = "android"))]
21+
Keys {
22+
signer: Arc<Keys>,
23+
},
24+
NIP46 {
25+
signer: Arc<nip46::Nip46Signer>,
26+
},
1827
}
1928

2029
impl From<ClientSigner> for signer::ClientSigner {
2130
fn from(value: ClientSigner) -> Self {
2231
match value {
32+
#[cfg(target_os = "android")]
33+
ClientSigner::PrivateKeys { signer } => Self::Keys(signer.as_ref().deref().clone()),
34+
#[cfg(not(target_os = "android"))]
2335
ClientSigner::Keys { signer } => Self::Keys(signer.as_ref().deref().clone()),
2436
ClientSigner::NIP46 { signer } => Self::NIP46(signer.as_ref().deref().clone()),
2537
}
@@ -29,6 +41,11 @@ impl From<ClientSigner> for signer::ClientSigner {
2941
impl From<signer::ClientSigner> for ClientSigner {
3042
fn from(value: signer::ClientSigner) -> Self {
3143
match value {
44+
#[cfg(target_os = "android")]
45+
signer::ClientSigner::Keys(keys) => Self::PrivateKeys {
46+
signer: Arc::new(keys.into()),
47+
},
48+
#[cfg(not(target_os = "android"))]
3249
signer::ClientSigner::Keys(keys) => Self::Keys {
3350
signer: Arc::new(keys.into()),
3451
},

0 commit comments

Comments
 (0)