Skip to content

Commit

Permalink
additional exports
Browse files Browse the repository at this point in the history
  • Loading branch information
pdtfh committed Nov 21, 2024
1 parent 2ef0ba3 commit 78b15bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 0 additions & 2 deletions walletkit-core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ use thiserror::Error;
pub enum Error {
#[error("fetching_inclusion_proof_failed")]
FetchingInclusionProofFailed,
#[error("invalid_hex_string")]
U256ParsingError(#[from] ruint::ParseError),
}
2 changes: 2 additions & 0 deletions walletkit-core/src/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ impl From<Identity> 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);
Expand Down
6 changes: 5 additions & 1 deletion walletkit-core/src/proof.rs
Original file line number Diff line number Diff line change
@@ -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 }
}
Expand Down

0 comments on commit 78b15bc

Please sign in to comment.