Skip to content

Commit

Permalink
WASM: expose authorizing keys from SaplingKey
Browse files Browse the repository at this point in the history
  • Loading branch information
andiflabs committed Feb 13, 2025
1 parent d6c2988 commit 7f2a680
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ironfish-rust-wasm/src/keys/sapling_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{
keys::{
IncomingViewKey, Language, OutgoingViewKey, ProofGenerationKey, PublicAddress, ViewKey,
},
primitives::Fr,
wasm_bindgen_wrapper,
};
use wasm_bindgen::prelude::*;
Expand Down Expand Up @@ -73,6 +74,16 @@ impl SaplingKey {
self.0.spending_key().to_vec()
}

#[wasm_bindgen(getter, js_name = spendAuthorizingKey)]
pub fn spend_authorizing_key(&self) -> Fr {
self.0.spend_authorizing_key().to_owned().into()
}

#[wasm_bindgen(getter, js_name = proofAuthorizingKey)]
pub fn proof_authorizing_key(&self) -> Fr {
self.0.proof_authorizing_key().to_owned().into()
}

#[wasm_bindgen(getter, js_name = incomingViewKey)]
pub fn incoming_view_key(&self) -> IncomingViewKey {
self.0.incoming_view_key().to_owned().into()
Expand Down
8 changes: 8 additions & 0 deletions ironfish-rust/src/keys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ impl SaplingKey {
Self::new(byte_arr)
}

pub fn spend_authorizing_key(&self) -> &ironfish_jubjub::Fr {
&self.spend_authorizing_key
}

pub fn proof_authorizing_key(&self) -> &ironfish_jubjub::Fr {
&self.proof_authorizing_key
}

/// Retrieve the publicly visible outgoing viewing key
pub fn outgoing_view_key(&self) -> &OutgoingViewKey {
&self.outgoing_viewing_key
Expand Down

0 comments on commit 7f2a680

Please sign in to comment.