forked from zeropoolnetwork/libzeropool-rs
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging the develop branch into the main branch (rs v1.1.0, wasm v1.2.0)
This merge contains the following set of changes: - Multipool addresses support (#61)
- Loading branch information
Showing
11 changed files
with
515 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
name = "libzkbob-rs-wasm" | ||
description = "A higher level zkBob API for Wasm" | ||
version = "1.1.0" | ||
version = "1.2.0" | ||
authors = ["Dmitry Vdovin <[email protected]>"] | ||
repository = "https://github.com/zkBob/libzkbob-rs/" | ||
license = "MIT OR Apache-2.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,10 @@ | ||
use libzkbob_rs::{address::format_address, keys::reduce_sk as reduce_sk_native}; | ||
use libzkbob_rs::libzeropool::{ | ||
constants, | ||
fawkes_crypto::{ff_uint::Uint, rand::Rng}, | ||
native::{boundednum::BoundedNum, key::derive_key_p_d}, | ||
POOL_PARAMS, | ||
}; | ||
use libzkbob_rs::{ keys::reduce_sk as reduce_sk_native}; | ||
use libzkbob_rs::libzeropool::fawkes_crypto::ff_uint::Uint; | ||
use wasm_bindgen::prelude::*; | ||
|
||
use crate::{Fs, PoolParams}; | ||
use crate::Fs; | ||
|
||
#[wasm_bindgen(js_name = reduceSpendingKey)] | ||
pub fn reduce_sk(seed: &[u8]) -> Vec<u8> { | ||
reduce_sk_native::<Fs>(seed).to_uint().0.to_little_endian() | ||
} | ||
|
||
#[wasm_bindgen(js_name = genBurnerAddress)] | ||
pub fn gen_burner_address(pool_id: u64, seed: &[u8]) -> Result<String, JsValue> { | ||
if pool_id >= 1 << 24 { | ||
return Err(js_err!("PoolID should be less than {}", 1 << 24)); | ||
} | ||
let mut rng = libzkbob_rs::random::CustomRng; | ||
|
||
let sk = reduce_sk_native::<Fs>(seed); | ||
|
||
let keys = libzkbob_rs::keys::Keys::derive(sk, &*POOL_PARAMS); | ||
|
||
let d: BoundedNum<_, { constants::DIVERSIFIER_SIZE_BITS }> = rng.gen(); | ||
|
||
let pk_d = derive_key_p_d(d.to_num(), keys.eta, &*POOL_PARAMS); | ||
|
||
Ok(format_address::<PoolParams>(d, pk_d.x)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
name = "libzkbob-rs" | ||
description = "A higher level zkBob API" | ||
version = "1.0.1" | ||
version = "1.1.0" | ||
authors = ["Dmitry Vdovin <[email protected]>"] | ||
repository = "https://github.com/zkBob/libzkbob-rs/" | ||
license = "MIT OR Apache-2.0" | ||
|
Oops, something went wrong.