From 78b15bc272c5d2fe07935f027c848d862720394e Mon Sep 17 00:00:00 2001 From: pdtfh <149602456+pdtfh@users.noreply.github.com> Date: Thu, 21 Nov 2024 13:03:32 +0100 Subject: [PATCH] additional exports --- walletkit-core/src/error.rs | 2 -- walletkit-core/src/identity.rs | 2 ++ walletkit-core/src/proof.rs | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/walletkit-core/src/error.rs b/walletkit-core/src/error.rs index 90e4dcaf..72a68398 100644 --- a/walletkit-core/src/error.rs +++ b/walletkit-core/src/error.rs @@ -5,6 +5,4 @@ use thiserror::Error; pub enum Error { #[error("fetching_inclusion_proof_failed")] FetchingInclusionProofFailed, - #[error("invalid_hex_string")] - U256ParsingError(#[from] ruint::ParseError), } diff --git a/walletkit-core/src/identity.rs b/walletkit-core/src/identity.rs index 429418c3..3a58f1bc 100644 --- a/walletkit-core/src/identity.rs +++ b/walletkit-core/src/identity.rs @@ -11,8 +11,10 @@ impl From for semaphore::identity::Identity { } } +#[uniffi::export] impl Identity { #[must_use] + #[uniffi::constructor] pub fn new(secret: &[u8]) -> Self { let mut secret_key = secret.to_vec(); let identity = semaphore::identity::Identity::from_secret(&mut secret_key, None); diff --git a/walletkit-core/src/proof.rs b/walletkit-core/src/proof.rs index 1185f6b8..a123fe06 100644 --- a/walletkit-core/src/proof.rs +++ b/walletkit-core/src/proof.rs @@ -1,14 +1,18 @@ use ruint::aliases::U256; use semaphore::hash_to_field; +#[derive(Clone, PartialEq, Eq, Debug, uniffi::Object)] pub struct Context { pub external_nullifier: U256, } +#[uniffi::export] impl Context { #[must_use] - pub fn new(app_id: &[u8], _action: &[u8]) -> Self { + #[uniffi::constructor] + pub fn new(app_id: &[u8], action: &[u8]) -> Self { let external_nullifier = hash_to_field(app_id); + dbg!(&action); // TODO: handle action properly Self { external_nullifier } }