Skip to content

Commit

Permalink
Update Tari crypto and chk-sig (#32)
Browse files Browse the repository at this point in the history
Upgrade tari crypto to match the core repo. Recompile the wasm.
  • Loading branch information
leet4tari authored Nov 9, 2023
2 parents ce26009 + 720c567 commit 0d7af59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions chk-sig/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ version = "0.16.12" # Keep in line with Tari crypto
edition = "2018"

[dependencies]
tari_utilities = "0.4.10"
tari_crypto = "0.16.12"
tari_utilities = "0.5.1"
tari_crypto = "0.19.0"

serde = "1.0"
serde-wasm-bindgen = { version = "0.5.0" }
Expand All @@ -23,7 +23,7 @@ cbindgen = "0.24.3"

[dev-dependencies]
wasm-bindgen-test = "0.3.36"
rand = { version = "0.7.3", default-features = false, features = ["wasm-bindgen"] }
rand = { version = "0.8.5", default-features = false }
getrandom = { version = "0.2.3", default-features = false, features = ["js"] }

[lib]
Expand Down
6 changes: 3 additions & 3 deletions chk-sig/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn check_signature(pub_nonce: &str, signature: &str, pub_key: &str, msg: &st
};

let sig: RistrettoSchnorrWithDomain<WalletMessageSigningDomain> = RistrettoSchnorrWithDomain::new(R, s);
result.result = sig.verify_message(&P, msg.as_bytes());
result.result = sig.verify(&P, msg.as_bytes());
serde_wasm_bindgen::to_value(&result).unwrap()
}

Expand Down Expand Up @@ -112,7 +112,7 @@ mod test {
RistrettoSecretKey,
) {
let (sk, pk) = RistrettoPublicKey::random_keypair(&mut OsRng);
let sig = RistrettoSchnorrWithDomain::sign_message(&sk, msg.as_bytes()).unwrap();
let sig = RistrettoSchnorrWithDomain::sign(&sk, msg.as_bytes(), &mut OsRng).unwrap();
(sig, pk, sk)
}

Expand Down Expand Up @@ -177,7 +177,7 @@ mod test {

let (sk, pk) = RistrettoPublicKey::random_keypair(&mut OsRng);
let sig: SchnorrSignature<RistrettoPublicKey, RistrettoSecretKey, TestDomain> =
RistrettoSchnorrWithDomain::sign_message(&sk, SAMPLE_CHALLENGE.as_bytes()).unwrap();
RistrettoSchnorrWithDomain::sign(&sk, SAMPLE_CHALLENGE.as_bytes(), &mut OsRng).unwrap();

it_fails(
&sig.get_public_nonce().to_hex(),
Expand Down
Binary file modified chk-sig/tari_chk_sig_js/tari_chk_sig_bg.wasm
Binary file not shown.

0 comments on commit 0d7af59

Please sign in to comment.