Skip to content

Commit 68579d0

Browse files
committed
fixed spacings, ordering of imports, and docstring
1 parent 25ffe63 commit 68579d0

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

wasm/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "@provablehq/wasm",
33
"version": "0.9.2",
44
"type": "module",
5-
65
"description": "SnarkVM WASM binaries with javascript bindings",
76
"collaborators": [
87
"The Provable Team"

wasm/src/programs/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ mod macros;
1919
pub mod data;
2020
pub use data::*;
2121

22-
pub use crate::utilities::encrypt::*;
22+
pub mod utilities;
23+
pub use utilities::encrypt::*;
2324

2425
pub mod execution;
2526
pub use execution::*;

wasm/src/types/native.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ pub type ViewKeyNative = ViewKey<CurrentNetwork>;
6565
pub type FieldNative = Field<CurrentNetwork>;
6666
pub type GroupNative = Group<CurrentNetwork>;
6767
pub type ScalarNative = Scalar<CurrentNetwork>;
68-
pub type U64Native = U64<CurrentNetwork>;
6968
pub type U16Native = U16<CurrentNetwork>;
69+
pub type U64Native = U64<CurrentNetwork>;
7070

7171
// Algorithmic types
7272
pub type BHP256Native = BHP256<CurrentNetwork>;

wasm/src/utilities/encrypt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,14 @@ impl EncryptionToolkit {
143143
Ok(RecordPlaintext::from(decrypted_record))
144144
}
145145

146+
/// Generates a transition view key from the view key and the transition public key.
146147
#[wasm_bindgen(js_name = "generateTvk")]
147148
pub fn generate_tvk(view_key: &ViewKey, tpk: &Group) -> Field {
148149
tpk.scalar_multiply(&view_key.to_scalar()).to_x_coordinate()
149150
}
150151

151-
/// Creates a record view key from the view key. This method is intended to be used
152-
/// by the record owner to enable decryption of a select record by a third party.
152+
/// Creates a record view key from the view key. This can be later be used to decrypt a
153+
// record without revealing an account's view key.
153154
#[wasm_bindgen(js_name = "generateRecordViewkey")]
154155
pub fn generate_record_view_key(view_key: &ViewKey, record_ciphertext: &RecordCiphertext) -> Result<Field, String> {
155156
let record_nonce = record_ciphertext.nonce();
@@ -186,7 +187,7 @@ mod tests {
186187
use super::*;
187188

188189
use std::str::FromStr;
189-
use wasm_bindgen_test::{console_log, wasm_bindgen_test};
190+
use wasm_bindgen_test::wasm_bindgen_test;
190191

191192
const NON_OWNER_VIEW_KEY: &str = "AViewKey1e2WyreaH5H4RBcioLL2GnxvHk5Ud46EtwycnhTdXLmXp";
192193
const OWNER_CIPHERTEXT: &str = "record1qyqsqpe2szk2wwwq56akkwx586hkndl3r8vzdwve32lm7elvphh37rsyqyxx66trwfhkxun9v35hguerqqpqzqrtjzeu6vah9x2me2exkgege824sd8x2379scspmrmtvczs0d93qttl7y92ga0k0rsexu409hu3vlehe3yxjhmey3frh2z5pxm5cmxsv4un97q";
@@ -224,7 +225,6 @@ mod tests {
224225
let tvk = EncryptionToolkit::generate_tvk(&view_key, &tpk);
225226

226227
// Verify the transition view key matches the expected value
227-
// console_log!("Transition View Key: {}", tvk.to_string());
228228
assert_eq!(tvk.to_string(), TRANSITION_VIEW_KEY);
229229
}
230230

0 commit comments

Comments
 (0)