Skip to content

Commit 5387696

Browse files
committed
WASM: add bindings for Note.commitment_point()
1 parent 125d10a commit 5387696

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ironfish-rust-wasm/src/note.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
assets::AssetIdentifier,
77
errors::IronfishError,
88
keys::{IncomingViewKey, PublicAddress, ViewKey},
9-
primitives::{ExtendedPoint, Nullifier},
9+
primitives::{ExtendedPoint, Nullifier, Scalar},
1010
wasm_bindgen_wrapper,
1111
};
1212
use ironfish::errors::IronfishErrorKind;
@@ -83,6 +83,11 @@ impl Note {
8383
self.0.commitment().to_vec()
8484
}
8585

86+
#[wasm_bindgen(getter, js_name = commitmentPoint)]
87+
pub fn commitment_point(&self) -> Scalar {
88+
self.0.commitment_point().into()
89+
}
90+
8691
#[wasm_bindgen]
8792
pub fn encrypt(&self, shared_secret: &[u8]) -> Result<Vec<u8>, IronfishError> {
8893
let shared_secret: &[u8; 32] = shared_secret

ironfish-rust/src/note.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ impl Note {
333333
///
334334
/// The owner can publish this value to commit to the fact that the note
335335
/// exists, without revealing any of the values on the note until later.
336-
pub(crate) fn commitment_point(&self) -> Scalar {
336+
pub fn commitment_point(&self) -> Scalar {
337337
// The commitment is in the prime order subgroup, so mapping the
338338
// commitment to the u-coordinate is an injective encoding.
339339
ironfish_jubjub::ExtendedPoint::from(self.commitment_full_point())

0 commit comments

Comments
 (0)