Skip to content

Commit

Permalink
chore: update readme (#2)
Browse files Browse the repository at this point in the history
Fixes the readme
  • Loading branch information
SWvheerden committed Aug 8, 2023
2 parents 19eff1f + b8de67b commit 566e1ab
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 39 deletions.
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
# Tari Crypto
# Tari Crypto WASM Wrapper

![](https://github.com/tari-project/tari-crypto/workflows/Security%20audit/badge.svg)
![](https://github.com/tari-project/tari-crypto/workflows/Clippy/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/tari-project/tari-crypto/badge.svg?branch=main)](https://coveralls.io/github/tari-project/tari-crypto?branch=main)

This crate is part of the [Tari Cryptocurrency](https://tari.com) project.

Major features of this library include:

- Pedersen commitments
- Schnorr Signatures
- Generic Public and Secret Keys
- [Musig!](https://blockstream.com/2018/01/23/musig-key-aggregation-schnorr-signatures/) **NOT PRODUCTION READY**

The `tari_crypto` crate makes heavy use of the excellent [Dalek](https://github.com/dalek-cryptography/curve25519-dalek)
libraries. The default implementation for Tari ECC is the [Ristretto255 curve](https://ristretto.group).
This is a WASM library wrapper for (Tari Crypto)[https://github.com/tari-project/tari-crypto]

# Compiling to WebAssembly

Expand Down
7 changes: 3 additions & 4 deletions src/commitments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
//! Functions for creating and opening commitments

use serde::{Deserialize, Serialize};
use tari_utilities::hex::Hex;
use wasm_bindgen::prelude::*;

use tari_crypto::{
commitment::HomomorphicCommitmentFactory,
ristretto::{
Expand All @@ -15,6 +12,8 @@ use tari_crypto::{
RistrettoSecretKey,
},
};
use tari_utilities::hex::Hex;
use wasm_bindgen::prelude::*;

/// Returned from [commit()]
#[derive(Default, Serialize, Deserialize)]
Expand Down Expand Up @@ -84,10 +83,10 @@ pub fn opens(key: &str, value: u64, commitment: &str) -> bool {
#[cfg(test)]
mod test {
use rand::rngs::OsRng;
use tari_crypto::keys::SecretKey;
use wasm_bindgen_test::*;

use super::*;
use tari_crypto::keys::SecretKey;

mod commit {
use super::*;
Expand Down
11 changes: 5 additions & 6 deletions src/key_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ use blake2::{Blake2b, Digest};
use digest::consts::U32;
use rand_core::OsRng;
use serde::{Deserialize, Serialize};
use tari_utilities::hex::{from_hex, Hex};
use wasm_bindgen::prelude::*;

use tari_crypto::{
keys::{PublicKey, SecretKey},
ristretto::{
Expand All @@ -26,6 +23,8 @@ use tari_crypto::{
RistrettoSecretKey,
},
};
use tari_utilities::hex::{from_hex, Hex};
use wasm_bindgen::prelude::*;

/// Result of calling [check_signature] and [check_comsig_signature] and [check_comandpubsig_signature]
#[derive(Debug, Serialize, Deserialize, Default)]
Expand Down Expand Up @@ -717,14 +716,14 @@ pub fn multiply_secret_keys(private_key_a: &str, private_key_b: &str) -> JsValue
#[cfg(test)]
mod test {
use blake2::digest::Output;
use wasm_bindgen_test::*;

use super::*;
use tari_crypto::{
commitment::HomomorphicCommitmentFactory,
signatures::{CommitmentAndPublicKeySignature, CommitmentSignature, SchnorrSignature},
tari_utilities::{hex, ByteArray},
};
use wasm_bindgen_test::*;

use super::*;

const SAMPLE_CHALLENGE: &str =
"Cormac was completely aware that he was being manipulated, but how he could not see.";
Expand Down
11 changes: 6 additions & 5 deletions src/keyring.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Copyright 2020. The Tari Project
// SPDX-License-Identifier: BSD-3-Clause

use rand_core::OsRng;
use tari_utilities::hex::Hex;
use wasm_bindgen::prelude::*;
use std::collections::HashMap;

use rand_core::OsRng;
use tari_crypto::{
commitment::HomomorphicCommitmentFactory,
keys::PublicKey,
Expand All @@ -13,8 +12,10 @@ use tari_crypto::{
RistrettoPublicKey,
RistrettoSecretKey,
},

};
use tari_utilities::hex::Hex;
use wasm_bindgen::prelude::*;

use crate::{
commitments::CommitmentResult,
key_utils::{sign_message_with_key, SignResult},
Expand Down Expand Up @@ -147,10 +148,10 @@ impl KeyRing {

#[cfg(test)]
mod test {
use tari_crypto::{keys::SecretKey, ristretto::RistrettoSchnorr};
use wasm_bindgen_test::*;

use super::*;
use tari_crypto::{keys::SecretKey, ristretto::RistrettoSchnorr};

const SAMPLE_CHALLENGE: &str = "გამარჯობა";

Expand Down
5 changes: 1 addition & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// Copyright 2022 The Tari Project
// SPDX-License-Identifier: BSD-3-Clause


//! Tari-Crypto-Wasm
#[macro_use]
extern crate std;


mod keyring;

pub mod commitments;
pub mod key_utils;
pub mod range_proofs;
pub use keyring::KeyRing;

7 changes: 3 additions & 4 deletions src/range_proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
use std::string::{String, ToString};

use serde::{Deserialize, Serialize};
use tari_utilities::hex::Hex;
use wasm_bindgen::prelude::*;

use tari_crypto::{
extended_range_proof::ExtendedRangeProofService,
range_proof::RangeProofService,
Expand All @@ -19,6 +16,8 @@ use tari_crypto::{
},
tari_utilities::hex::from_hex,
};
use tari_utilities::hex::Hex;
use wasm_bindgen::prelude::*;

/// Generated from [RangeProofFactory::create_proof]
#[derive(Default, Serialize, Deserialize)]
Expand Down Expand Up @@ -186,10 +185,10 @@ impl Default for ExtendedRangeProofFactory {
#[cfg(test)]
mod test {
use rand::rngs::OsRng;
use tari_crypto::{commitment::HomomorphicCommitmentFactory, keys::PublicKey, ristretto::RistrettoPublicKey};
use wasm_bindgen_test::*;

use super::*;
use tari_crypto::{commitment::HomomorphicCommitmentFactory, keys::PublicKey, ristretto::RistrettoPublicKey};

#[wasm_bindgen_test]
fn bulletproof_plus_fails_with_invalid_hex_input() {
Expand Down

0 comments on commit 566e1ab

Please sign in to comment.