Upgrade frost-ed25519 to v0.6.0 (#49)
* Upgrade to frost-ed25519 v0.6.0 (#39) * Fix conflict resolution errors (#39)
This commit is contained in:
parent
4481c19dfc
commit
d0cb462907
|
@ -253,20 +253,33 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "curve25519-dalek"
|
||||
version = "4.0.0-rc.2"
|
||||
version = "4.0.0-rc.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03d928d978dbec61a1167414f5ec534f24bea0d7a0d24dd9b6233d3d8223e585"
|
||||
checksum = "436ace70fc06e06f7f689d2624dc4e2f0ea666efb5aa704215f7249ae6e047a7"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"curve25519-dalek-derive",
|
||||
"fiat-crypto",
|
||||
"packed_simd_2",
|
||||
"platforms",
|
||||
"rand_core",
|
||||
"rustc_version",
|
||||
"serde",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "curve25519-dalek-derive"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "debugless-unwrap"
|
||||
version = "0.0.4"
|
||||
|
@ -279,8 +292,8 @@ version = "0.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a2c35ab6e03642397cdda1dd58abbc05d418aef8e36297f336d5aba060fe8df"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.64",
|
||||
"quote 1.0.29",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
|
@ -374,19 +387,17 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|||
|
||||
[[package]]
|
||||
name = "frost-core"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0611ff62c410c38100fba5debc0f7caaf54fe6219e0c631d4fd698587757aa23"
|
||||
checksum = "16b73d2895e352c7942537e47c9ec5899b89704228b837d4375c5071cf721152"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"criterion",
|
||||
"debugless-unwrap",
|
||||
"derive-getters",
|
||||
"digest",
|
||||
"hex",
|
||||
"itertools 0.10.5",
|
||||
"itertools 0.11.0",
|
||||
"proptest",
|
||||
"proptest-derive",
|
||||
"rand_core",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
@ -398,9 +409,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "frost-ed25519"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53e6ab361daf95ca692647e63377ced9b97017e4f4d475485d008dbc15519eab"
|
||||
checksum = "c69d652160d8031e2cf2b57d9e9320cf5b5ba2be18081511411d6355df87f3d1"
|
||||
dependencies = [
|
||||
"curve25519-dalek",
|
||||
"frost-core",
|
||||
|
@ -532,12 +543,6 @@ version = "0.2.147"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.7"
|
||||
|
@ -584,7 +589,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm 0.2.7",
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -609,16 +614,6 @@ version = "11.1.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
|
||||
|
||||
[[package]]
|
||||
name = "packed_simd_2"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libm 0.1.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "participant"
|
||||
version = "0.1.0"
|
||||
|
@ -669,15 +664,6 @@ version = "0.2.17"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.4.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.64"
|
||||
|
@ -707,39 +693,19 @@ dependencies = [
|
|||
"unarray",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proptest-derive"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90b46295382dc76166cb7cf2bb4a97952464e4b7ed5a43e6cd34e1fec3349ddc"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
"quote 0.6.13",
|
||||
"syn 0.15.44",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.64",
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -847,6 +813,15 @@ version = "0.7.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ab07dc67230e4a4718e70fd5c20055a4334b121f1f9db8fe63ef39ce9b8c846"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
|
||||
dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.37.23"
|
||||
|
@ -907,6 +882,12 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.171"
|
||||
|
@ -922,8 +903,8 @@ version = "1.0.171"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.64",
|
||||
"quote 1.0.29",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
]
|
||||
|
||||
|
@ -965,25 +946,14 @@ version = "2.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.15.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
"quote 0.6.13",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.64",
|
||||
"quote 1.0.29",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
|
@ -993,8 +963,8 @@ version = "2.0.25"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.64",
|
||||
"quote 1.0.29",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
|
@ -1027,8 +997,8 @@ version = "1.0.43"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.64",
|
||||
"quote 1.0.29",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
]
|
||||
|
||||
|
@ -1072,12 +1042,6 @@ version = "1.0.10"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
|
@ -1090,8 +1054,8 @@ version = "0.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8881d5cc0ae34e3db2f1de5af81e5117a420d2f937506c2dc20d6f4cfb069051"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.64",
|
||||
"quote 1.0.29",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
|
@ -1139,8 +1103,8 @@ dependencies = [
|
|||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2 1.0.64",
|
||||
"quote 1.0.29",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
@ -1151,7 +1115,7 @@ version = "0.2.87"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
|
||||
dependencies = [
|
||||
"quote 1.0.29",
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
|
@ -1161,8 +1125,8 @@ version = "0.2.87"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.64",
|
||||
"quote 1.0.29",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
|
@ -1296,7 +1260,7 @@ version = "1.4.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.64",
|
||||
"quote 1.0.29",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
]
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,7 +7,7 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
eyre = "0.6.8"
|
||||
frost-ed25519 = { version = "0.5.0", features = ["serde"] }
|
||||
frost-ed25519 = { version = "0.6.0", features = ["serde"] }
|
||||
hex = { version = "0.4", features = ["serde"] }
|
||||
thiserror = "1.0"
|
||||
rand = "0.8"
|
||||
|
|
|
@ -44,18 +44,17 @@ pub fn cli(
|
|||
received_round1_packages.insert(identifier, round1_package);
|
||||
writeln!(logger)?;
|
||||
}
|
||||
let received_round1_packages = received_round1_packages.into_values().collect::<Vec<_>>();
|
||||
|
||||
let (round2_secret_package, round2_packages) =
|
||||
frost::keys::dkg::part2(secret_package, &received_round1_packages)?;
|
||||
|
||||
writeln!(logger, "=== ROUND 2: SEND PACKAGES ===\n")?;
|
||||
|
||||
for package in round2_packages {
|
||||
for (identifier, package) in round2_packages {
|
||||
writeln!(
|
||||
logger,
|
||||
"Round 2 Package to send to participant {} (your identifier: {}):\n\n{}\n",
|
||||
serde_json::to_string(package.receiver_identifier())?,
|
||||
serde_json::to_string(&identifier)?,
|
||||
serde_json::to_string(&config.identifier)?,
|
||||
serde_json::to_string(&package)?
|
||||
)?;
|
||||
|
@ -74,7 +73,6 @@ pub fn cli(
|
|||
received_round2_packages.insert(identifier, round2_package);
|
||||
writeln!(logger)?;
|
||||
}
|
||||
let received_round2_packages = received_round2_packages.into_values().collect::<Vec<_>>();
|
||||
|
||||
writeln!(logger, "=== DKG FINISHED ===")?;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,7 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
frost-ed25519 = "0.5.0"
|
||||
frost-ed25519 = "0.6.0"
|
||||
hex = "0.4"
|
||||
rand = "0.8"
|
||||
exitcode = "1.1.2"
|
||||
|
|
|
@ -45,15 +45,12 @@ pub fn cli(input: &mut impl BufRead, logger: &mut dyn Logger) -> Result<(), Part
|
|||
logger.log("Key Package succesfully created.".to_string());
|
||||
|
||||
let mut rng = thread_rng();
|
||||
let (nonces, commitments) = round1::commit(
|
||||
round_1_config_ok.identifier,
|
||||
&round_1_config_ok.signing_share,
|
||||
&mut rng,
|
||||
);
|
||||
let (nonces, commitments) = round1::commit(&round_1_config_ok.signing_share, &mut rng);
|
||||
|
||||
print_values(&nonces, commitments, logger);
|
||||
|
||||
let round_2_config = round_2_request_inputs(commitments, input, logger); // TODO: handle errors
|
||||
let round_2_config =
|
||||
round_2_request_inputs(round_1_config_ok.identifier, commitments, input, logger); // TODO: handle errors
|
||||
|
||||
if let Err(e) = round_2_config {
|
||||
return Err(ParticipantError {
|
||||
|
|
|
@ -48,7 +48,7 @@ pub fn request_inputs(
|
|||
|
||||
// A specific VerifyingShare error does not currently exist in Frost so `MalformedVerifyingKey`
|
||||
// has been used. This should either be added to Frost or the error handling here can be reconsidered
|
||||
let public_key = VerifyingShare::from_bytes(
|
||||
let public_key = VerifyingShare::deserialize(
|
||||
<[u8; 32]>::from_hex(public_key_input.trim()).map_err(|_| Error::MalformedVerifyingKey)?,
|
||||
)?; //TODO: test error
|
||||
|
||||
|
@ -57,7 +57,7 @@ pub fn request_inputs(
|
|||
|
||||
input.read_line(&mut group_public_key_input).unwrap();
|
||||
|
||||
let group_public_key = VerifyingKey::from_bytes(
|
||||
let group_public_key = VerifyingKey::deserialize(
|
||||
<[u8; 32]>::from_hex(group_public_key_input.trim())
|
||||
.map_err(|_| Error::MalformedVerifyingKey)?,
|
||||
)
|
||||
|
@ -71,7 +71,7 @@ pub fn request_inputs(
|
|||
|
||||
// A specific SigningShare error does not currently exist in Frost so `MalformedSigningKey`
|
||||
// has been used. This should either be added to Frost or the error handling here can be reconsidered
|
||||
let signing_share = SigningShare::from_bytes(
|
||||
let signing_share = SigningShare::deserialize(
|
||||
<[u8; 32]>::from_hex(signing_share_input.trim()).map_err(|_| Error::MalformedSigningKey)?,
|
||||
)?; //TODO: test error
|
||||
|
||||
|
@ -134,22 +134,22 @@ pub fn print_values(
|
|||
logger.log("=== Round 1 ===".to_string());
|
||||
logger.log(format!(
|
||||
"Hiding nonce: {}",
|
||||
hex::encode(nonces.hiding().to_bytes())
|
||||
hex::encode(nonces.hiding().serialize())
|
||||
));
|
||||
|
||||
logger.log(format!(
|
||||
"Binding nonce: {}",
|
||||
hex::encode(nonces.binding().to_bytes())
|
||||
hex::encode(nonces.binding().serialize())
|
||||
));
|
||||
|
||||
logger.log(format!(
|
||||
"Hiding commitment: {}",
|
||||
hex::encode(commitments.hiding().to_bytes())
|
||||
hex::encode(commitments.hiding().serialize())
|
||||
));
|
||||
|
||||
logger.log(format!(
|
||||
"Binding commitment: {}",
|
||||
hex::encode(commitments.binding().to_bytes())
|
||||
hex::encode(commitments.binding().serialize())
|
||||
));
|
||||
logger.log("=== Round 1 Completed ===".to_string());
|
||||
logger.log("Please send your Hiding and Binding Commitments to the coordinator".to_string());
|
||||
|
|
|
@ -7,17 +7,18 @@ use frost::{
|
|||
};
|
||||
use frost_ed25519 as frost;
|
||||
use hex::FromHex;
|
||||
use std::io::BufRead;
|
||||
use std::{collections::BTreeMap, io::BufRead};
|
||||
|
||||
// #[derive(Debug)]
|
||||
pub struct Round2Config {
|
||||
pub message: Vec<u8>,
|
||||
pub signer_commitments: Vec<SigningCommitments>,
|
||||
pub signer_commitments: BTreeMap<Identifier, SigningCommitments>,
|
||||
}
|
||||
|
||||
// TODO: refactor to generate config
|
||||
// TODO: handle errors
|
||||
pub fn round_2_request_inputs(
|
||||
id: Identifier,
|
||||
signing_commitments: SigningCommitments,
|
||||
input: &mut impl BufRead,
|
||||
logger: &mut dyn Logger,
|
||||
|
@ -40,7 +41,8 @@ pub fn round_2_request_inputs(
|
|||
|
||||
let message = hex::decode(message_input.trim()).unwrap();
|
||||
|
||||
let mut commitments = vec![signing_commitments];
|
||||
let mut commitments = BTreeMap::new();
|
||||
commitments.insert(id, signing_commitments);
|
||||
|
||||
for _ in 2..=signers {
|
||||
logger.log("Identifier:".to_string());
|
||||
|
@ -56,7 +58,7 @@ pub fn round_2_request_inputs(
|
|||
let mut hiding_commitment_input = String::new();
|
||||
|
||||
input.read_line(&mut hiding_commitment_input).unwrap();
|
||||
let hiding_commitment = NonceCommitment::from_bytes(
|
||||
let hiding_commitment = NonceCommitment::deserialize(
|
||||
<[u8; 32]>::from_hex(hiding_commitment_input.trim()).unwrap(),
|
||||
)?;
|
||||
|
||||
|
@ -64,14 +66,13 @@ pub fn round_2_request_inputs(
|
|||
let mut binding_commitment_input = String::new();
|
||||
|
||||
input.read_line(&mut binding_commitment_input).unwrap();
|
||||
let binding_commitment = NonceCommitment::from_bytes(
|
||||
let binding_commitment = NonceCommitment::deserialize(
|
||||
<[u8; 32]>::from_hex(binding_commitment_input.trim()).unwrap(),
|
||||
)?;
|
||||
|
||||
let signer_commitments =
|
||||
SigningCommitments::new(identifier, hiding_commitment, binding_commitment); // TODO: Add test for correct error to be returned on failing deserialisation
|
||||
let signer_commitments = SigningCommitments::new(hiding_commitment, binding_commitment); // TODO: Add test for correct error to be returned on failing deserialisation
|
||||
|
||||
commitments.push(signer_commitments);
|
||||
commitments.insert(identifier, signer_commitments);
|
||||
}
|
||||
|
||||
Ok(Round2Config {
|
||||
|
@ -90,46 +91,11 @@ pub fn generate_signature(
|
|||
Ok(signature)
|
||||
}
|
||||
|
||||
fn encode_signature_response(signature_share: SignatureShare) -> String {
|
||||
let id = hex::encode(signature_share.identifier().serialize());
|
||||
let sig = hex::encode(signature_share.signature().to_bytes());
|
||||
id + &sig
|
||||
}
|
||||
|
||||
pub fn print_values_round_2(signature: SignatureShare, logger: &mut dyn Logger) {
|
||||
logger.log("Please send the following to the Coordinator".to_string());
|
||||
logger.log(format!(
|
||||
"Signature share: {}",
|
||||
encode_signature_response(signature)
|
||||
hex::encode(signature.share().to_bytes())
|
||||
));
|
||||
logger.log("=== End of Round 2 ===".to_string());
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use frost::{
|
||||
round2::{SignatureResponse, SignatureShare},
|
||||
Identifier,
|
||||
};
|
||||
use frost_ed25519 as frost;
|
||||
use hex::FromHex;
|
||||
|
||||
use crate::round2::encode_signature_response;
|
||||
|
||||
// TODO: Add details of encoding
|
||||
#[test]
|
||||
fn check_encode_signature_response() {
|
||||
const SIGNATURE_RESPONSE: &str =
|
||||
"44055c54d0604cbd006f0d1713a22474d7735c5e8816b1878f62ca94bf105900";
|
||||
let signature_response =
|
||||
SignatureResponse::from_bytes(<[u8; 32]>::from_hex(SIGNATURE_RESPONSE).unwrap())
|
||||
.unwrap();
|
||||
let signature_share =
|
||||
SignatureShare::new(Identifier::try_from(1).unwrap(), signature_response);
|
||||
|
||||
let expected = "010000000000000000000000000000000000000000000000000000000000000044055c54d0604cbd006f0d1713a22474d7735c5e8816b1878f62ca94bf105900";
|
||||
let signature = encode_signature_response(signature_share);
|
||||
|
||||
assert!(expected == signature)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::cli::cli;
|
||||
use frost::{keys::SigningShare, round1, Identifier};
|
||||
use frost::{keys::SigningShare, round1};
|
||||
use frost_ed25519 as frost;
|
||||
use hex::FromHex;
|
||||
use participant::Logger;
|
||||
|
@ -59,16 +59,13 @@ fn check_cli() {
|
|||
let mut rng = thread_rng();
|
||||
|
||||
// We aren't testing randomness so this needs to be generated in the tests. TODO: mock the round1::commit function. To be improved in a later issue.
|
||||
let (nonces, commitments) = round1::commit(
|
||||
Identifier::try_from(1).unwrap(),
|
||||
&SigningShare::from_hex(signing_share).unwrap(),
|
||||
&mut rng,
|
||||
);
|
||||
let (nonces, commitments) =
|
||||
round1::commit(&SigningShare::from_hex(signing_share).unwrap(), &mut rng);
|
||||
|
||||
let _hiding_nonce = hex::encode(nonces.hiding().to_bytes());
|
||||
let _binding_nonce = hex::encode(nonces.binding().to_bytes());
|
||||
let _hiding_commitment = hex::encode(commitments.hiding().to_bytes());
|
||||
let _binding_commitment = hex::encode(commitments.binding().to_bytes());
|
||||
let _hiding_nonce = hex::encode(nonces.hiding().serialize());
|
||||
let _binding_nonce = hex::encode(nonces.binding().serialize());
|
||||
let _hiding_commitment = hex::encode(commitments.hiding().serialize());
|
||||
let _binding_commitment = hex::encode(commitments.binding().serialize());
|
||||
|
||||
// let signature_share = hex::encode(sig_share.to_bytes());
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ impl Logger for TestLogger {
|
|||
fn check_valid_round_1_inputs() {
|
||||
let config = Round1Config {
|
||||
identifier: Identifier::try_from(1).unwrap(),
|
||||
public_key: VerifyingShare::from_bytes(<[u8; 32]>::from_hex(PUBLIC_KEY).unwrap()).unwrap(),
|
||||
public_key: VerifyingShare::deserialize(<[u8; 32]>::from_hex(PUBLIC_KEY).unwrap()).unwrap(),
|
||||
group_public_key: VerifyingKey::from_hex(GROUP_PUBLIC_KEY).unwrap(),
|
||||
signing_share: SigningShare::from_bytes(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap())
|
||||
signing_share: SigningShare::deserialize(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap())
|
||||
.unwrap(),
|
||||
vss_commitment: hex::decode(VSS_COMMITMENT).unwrap(),
|
||||
};
|
||||
|
@ -149,9 +149,9 @@ fn check_invalid_length_vss_commitment() {
|
|||
fn check_key_package_generation() {
|
||||
let config = Round1Config {
|
||||
identifier: Identifier::try_from(1).unwrap(),
|
||||
public_key: VerifyingShare::from_bytes(<[u8; 32]>::from_hex(PUBLIC_KEY).unwrap()).unwrap(),
|
||||
public_key: VerifyingShare::deserialize(<[u8; 32]>::from_hex(PUBLIC_KEY).unwrap()).unwrap(),
|
||||
group_public_key: VerifyingKey::from_hex(GROUP_PUBLIC_KEY).unwrap(),
|
||||
signing_share: SigningShare::from_bytes(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap())
|
||||
signing_share: SigningShare::deserialize(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap())
|
||||
.unwrap(),
|
||||
vss_commitment: hex::decode(VSS_COMMITMENT).unwrap(),
|
||||
};
|
||||
|
@ -173,9 +173,9 @@ fn check_key_package_generation_fails_with_invalid_secret_share() {
|
|||
"afc0ba51fd450297725f9efe714400d51a1180a273177b5dd8ad3b8cba41560d";
|
||||
let config = Round1Config {
|
||||
identifier: Identifier::try_from(1).unwrap(),
|
||||
public_key: VerifyingShare::from_bytes(<[u8; 32]>::from_hex(PUBLIC_KEY).unwrap()).unwrap(),
|
||||
public_key: VerifyingShare::deserialize(<[u8; 32]>::from_hex(PUBLIC_KEY).unwrap()).unwrap(),
|
||||
group_public_key: VerifyingKey::from_hex(GROUP_PUBLIC_KEY).unwrap(),
|
||||
signing_share: SigningShare::from_bytes(
|
||||
signing_share: SigningShare::deserialize(
|
||||
<[u8; 32]>::from_hex(incorrect_signing_share).unwrap(),
|
||||
)
|
||||
.unwrap(),
|
||||
|
@ -189,27 +189,26 @@ fn check_key_package_generation_fails_with_invalid_secret_share() {
|
|||
fn check_print_values() {
|
||||
let mut test_logger = TestLogger(Vec::new());
|
||||
let signing_share =
|
||||
SigningShare::from_bytes(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap()).unwrap();
|
||||
SigningShare::deserialize(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap()).unwrap();
|
||||
let mut rng = thread_rng();
|
||||
let (nonces, commitments) =
|
||||
round1::commit(Identifier::try_from(1).unwrap(), &signing_share, &mut rng);
|
||||
let (nonces, commitments) = round1::commit(&signing_share, &mut rng);
|
||||
|
||||
print_values(&nonces, commitments, &mut test_logger);
|
||||
|
||||
let log = [
|
||||
"=== Round 1 ===".to_string(),
|
||||
format!("Hiding nonce: {}", hex::encode(nonces.hiding().to_bytes())),
|
||||
format!("Hiding nonce: {}", hex::encode(nonces.hiding().serialize())),
|
||||
format!(
|
||||
"Binding nonce: {}",
|
||||
hex::encode(nonces.binding().to_bytes())
|
||||
hex::encode(nonces.binding().serialize())
|
||||
),
|
||||
format!(
|
||||
"Hiding commitment: {}",
|
||||
hex::encode(commitments.hiding().to_bytes())
|
||||
hex::encode(commitments.hiding().serialize())
|
||||
),
|
||||
format!(
|
||||
"Binding commitment: {}",
|
||||
hex::encode(commitments.binding().to_bytes())
|
||||
hex::encode(commitments.binding().serialize())
|
||||
),
|
||||
"=== Round 1 Completed ===".to_string(),
|
||||
"Please send your Hiding and Binding Commitments to the coordinator".to_string(),
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
#[cfg(test)]
|
||||
use frost::Identifier;
|
||||
use frost::{
|
||||
keys::{KeyPackage, SigningShare, VerifyingShare},
|
||||
round1::{self, NonceCommitment, SigningCommitments},
|
||||
round2::{SignatureResponse, SignatureShare},
|
||||
round2::SignatureShare,
|
||||
VerifyingKey,
|
||||
};
|
||||
use frost_ed25519 as frost;
|
||||
|
@ -45,30 +47,28 @@ const BINDING_COMMITMENT_3: &str =
|
|||
fn check_valid_round_2_inputs() {
|
||||
// TODO: refactor
|
||||
let my_signer_commitments = SigningCommitments::new(
|
||||
Identifier::try_from(1).unwrap(),
|
||||
NonceCommitment::from_bytes(<[u8; 32]>::from_hex(MY_HIDING_COMMITMENT).unwrap()).unwrap(),
|
||||
NonceCommitment::from_bytes(<[u8; 32]>::from_hex(MY_BINDING_COMMITMENT).unwrap()).unwrap(),
|
||||
NonceCommitment::deserialize(<[u8; 32]>::from_hex(MY_HIDING_COMMITMENT).unwrap()).unwrap(),
|
||||
NonceCommitment::deserialize(<[u8; 32]>::from_hex(MY_BINDING_COMMITMENT).unwrap()).unwrap(),
|
||||
);
|
||||
|
||||
let signer_commitments_2 = SigningCommitments::new(
|
||||
Identifier::try_from(2).unwrap(),
|
||||
NonceCommitment::from_bytes(<[u8; 32]>::from_hex(HIDING_COMMITMENT_2).unwrap()).unwrap(),
|
||||
NonceCommitment::from_bytes(<[u8; 32]>::from_hex(BINDING_COMMITMENT_2).unwrap()).unwrap(),
|
||||
NonceCommitment::deserialize(<[u8; 32]>::from_hex(HIDING_COMMITMENT_2).unwrap()).unwrap(),
|
||||
NonceCommitment::deserialize(<[u8; 32]>::from_hex(BINDING_COMMITMENT_2).unwrap()).unwrap(),
|
||||
);
|
||||
let signer_commitments_3 = SigningCommitments::new(
|
||||
Identifier::try_from(3).unwrap(),
|
||||
NonceCommitment::from_bytes(<[u8; 32]>::from_hex(HIDING_COMMITMENT_3).unwrap()).unwrap(),
|
||||
NonceCommitment::from_bytes(<[u8; 32]>::from_hex(BINDING_COMMITMENT_3).unwrap()).unwrap(),
|
||||
NonceCommitment::deserialize(<[u8; 32]>::from_hex(HIDING_COMMITMENT_3).unwrap()).unwrap(),
|
||||
NonceCommitment::deserialize(<[u8; 32]>::from_hex(BINDING_COMMITMENT_3).unwrap()).unwrap(),
|
||||
);
|
||||
|
||||
let mut signer_commitments = BTreeMap::new();
|
||||
signer_commitments.insert(Identifier::try_from(1).unwrap(), my_signer_commitments);
|
||||
signer_commitments.insert(Identifier::try_from(2).unwrap(), signer_commitments_2);
|
||||
signer_commitments.insert(Identifier::try_from(3).unwrap(), signer_commitments_3);
|
||||
|
||||
let config = Round2Config {
|
||||
message: hex::decode("15d21ccd7ee42959562fc8aa63224c8851fb3ec85a3faf66040d380fb9738673")
|
||||
.unwrap(),
|
||||
signer_commitments: vec![
|
||||
my_signer_commitments,
|
||||
signer_commitments_2,
|
||||
signer_commitments_3,
|
||||
],
|
||||
signer_commitments,
|
||||
};
|
||||
|
||||
let mut test_logger = TestLogger(Vec::new());
|
||||
|
@ -86,8 +86,13 @@ fn check_valid_round_2_inputs() {
|
|||
);
|
||||
let mut valid_input = input.as_bytes();
|
||||
|
||||
let expected =
|
||||
round_2_request_inputs(my_signer_commitments, &mut valid_input, &mut test_logger).unwrap();
|
||||
let expected = round_2_request_inputs(
|
||||
Identifier::try_from(1).unwrap(),
|
||||
my_signer_commitments,
|
||||
&mut valid_input,
|
||||
&mut test_logger,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(expected.message, config.message);
|
||||
// TODO: This is easily resolved in the latest release of Frost which includes the Debug trait
|
||||
|
@ -100,9 +105,9 @@ fn check_valid_round_2_inputs() {
|
|||
fn check_sign() {
|
||||
let config = Round1Config {
|
||||
identifier: Identifier::try_from(1).unwrap(),
|
||||
public_key: VerifyingShare::from_bytes(<[u8; 32]>::from_hex(PUBLIC_KEY).unwrap()).unwrap(),
|
||||
public_key: VerifyingShare::deserialize(<[u8; 32]>::from_hex(PUBLIC_KEY).unwrap()).unwrap(),
|
||||
group_public_key: VerifyingKey::from_hex(GROUP_PUBLIC_KEY).unwrap(),
|
||||
signing_share: SigningShare::from_bytes(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap())
|
||||
signing_share: SigningShare::deserialize(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap())
|
||||
.unwrap(),
|
||||
vss_commitment: hex::decode(VSS_COMMITMENT).unwrap(),
|
||||
};
|
||||
|
@ -117,28 +122,28 @@ fn check_sign() {
|
|||
let mut rng = thread_rng();
|
||||
|
||||
// TODO: Nonce doesn't seem to be exported. Look into this to improve these tests
|
||||
let (nonces, my_commitments) = round1::commit(
|
||||
Identifier::try_from(1).unwrap(),
|
||||
&SigningShare::from_hex(SIGNING_SHARE).unwrap(),
|
||||
&mut rng,
|
||||
);
|
||||
let (nonces, my_commitments) =
|
||||
round1::commit(&SigningShare::from_hex(SIGNING_SHARE).unwrap(), &mut rng);
|
||||
|
||||
let signer_commitments_2 = SigningCommitments::new(
|
||||
Identifier::try_from(2).unwrap(),
|
||||
NonceCommitment::from_bytes(<[u8; 32]>::from_hex(HIDING_COMMITMENT_2).unwrap()).unwrap(),
|
||||
NonceCommitment::from_bytes(<[u8; 32]>::from_hex(BINDING_COMMITMENT_2).unwrap()).unwrap(),
|
||||
NonceCommitment::deserialize(<[u8; 32]>::from_hex(HIDING_COMMITMENT_2).unwrap()).unwrap(),
|
||||
NonceCommitment::deserialize(<[u8; 32]>::from_hex(BINDING_COMMITMENT_2).unwrap()).unwrap(),
|
||||
);
|
||||
|
||||
let signer_commitments_3 = SigningCommitments::new(
|
||||
Identifier::try_from(3).unwrap(),
|
||||
NonceCommitment::from_bytes(<[u8; 32]>::from_hex(HIDING_COMMITMENT_3).unwrap()).unwrap(),
|
||||
NonceCommitment::from_bytes(<[u8; 32]>::from_hex(BINDING_COMMITMENT_3).unwrap()).unwrap(),
|
||||
NonceCommitment::deserialize(<[u8; 32]>::from_hex(HIDING_COMMITMENT_3).unwrap()).unwrap(),
|
||||
NonceCommitment::deserialize(<[u8; 32]>::from_hex(BINDING_COMMITMENT_3).unwrap()).unwrap(),
|
||||
);
|
||||
|
||||
let mut signer_commitments = BTreeMap::new();
|
||||
signer_commitments.insert(Identifier::try_from(1).unwrap(), my_commitments);
|
||||
signer_commitments.insert(Identifier::try_from(2).unwrap(), signer_commitments_2);
|
||||
signer_commitments.insert(Identifier::try_from(3).unwrap(), signer_commitments_3);
|
||||
|
||||
let config = Round2Config {
|
||||
message: hex::decode("15d21ccd7ee42959562fc8aa63224c8851fb3ec85a3faf66040d380fb9738673")
|
||||
.unwrap(),
|
||||
signer_commitments: vec![my_commitments, signer_commitments_2, signer_commitments_3],
|
||||
signer_commitments,
|
||||
};
|
||||
|
||||
let signature = generate_signature(config, &key_package, &nonces);
|
||||
|
@ -150,21 +155,16 @@ fn check_sign() {
|
|||
fn check_print_values_round_2() {
|
||||
let mut test_logger = TestLogger(Vec::new());
|
||||
|
||||
const IDENTIFIER: &str = "0100000000000000000000000000000000000000000000000000000000000000";
|
||||
const SIGNATURE_RESPONSE: &str =
|
||||
const SIGNATURE_SHARE: &str =
|
||||
"44055c54d0604cbd006f0d1713a22474d7735c5e8816b1878f62ca94bf105900";
|
||||
let signature_response =
|
||||
SignatureResponse::from_bytes(<[u8; 32]>::from_hex(SIGNATURE_RESPONSE).unwrap()).unwrap();
|
||||
let signature = SignatureShare::new(Identifier::try_from(1).unwrap(), signature_response);
|
||||
SignatureShare::deserialize(<[u8; 32]>::from_hex(SIGNATURE_SHARE).unwrap()).unwrap();
|
||||
|
||||
print_values_round_2(signature, &mut test_logger);
|
||||
print_values_round_2(signature_response, &mut test_logger);
|
||||
|
||||
let log = [
|
||||
"Please send the following to the Coordinator".to_string(),
|
||||
format!(
|
||||
"Signature share: {}",
|
||||
IDENTIFIER.to_string() + SIGNATURE_RESPONSE
|
||||
),
|
||||
format!("Signature share: {}", SIGNATURE_SHARE),
|
||||
"=== End of Round 2 ===".to_string(),
|
||||
];
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::collections::HashMap;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
|
||||
use frost::SigningPackage;
|
||||
use frost::keys::IdentifierList;
|
||||
use frost::{aggregate, SigningPackage};
|
||||
use frost_ed25519 as frost;
|
||||
use participant::round1::Round1Config;
|
||||
use participant::round2::{generate_signature, Round2Config};
|
||||
|
@ -18,19 +19,20 @@ fn encode_commitment_helper(commitment: Vec<[u8; 32]>) -> String {
|
|||
#[test]
|
||||
fn check_participant() {
|
||||
let mut rng = thread_rng();
|
||||
let (shares, pubkeys) = frost::keys::generate_with_dealer(3, 2, &mut rng).unwrap();
|
||||
let (shares, pubkeys) =
|
||||
frost::keys::generate_with_dealer(3, 2, IdentifierList::Default, &mut rng).unwrap();
|
||||
|
||||
let mut key_packages: HashMap<_, _> = HashMap::new();
|
||||
|
||||
for (k, v) in shares.clone() {
|
||||
let key_package = frost::keys::KeyPackage::try_from(v).unwrap();
|
||||
key_packages.insert(k, key_package);
|
||||
for (identifier, secret_share) in &shares {
|
||||
let key_package = frost::keys::KeyPackage::try_from(secret_share.clone()).unwrap();
|
||||
key_packages.insert(identifier, key_package);
|
||||
}
|
||||
|
||||
// Round 1
|
||||
|
||||
let mut nonces = HashMap::new();
|
||||
let mut commitments = HashMap::new();
|
||||
let mut commitments = BTreeMap::new();
|
||||
|
||||
for i in shares.keys() {
|
||||
let config = Round1Config {
|
||||
|
@ -43,11 +45,8 @@ fn check_participant() {
|
|||
))
|
||||
.unwrap(),
|
||||
};
|
||||
let (nonce, commitment) = frost::round1::commit(
|
||||
config.identifier,
|
||||
key_packages[&config.identifier].secret_share(),
|
||||
&mut rng,
|
||||
);
|
||||
let (nonce, commitment) =
|
||||
frost::round1::commit(key_packages[&config.identifier].secret_share(), &mut rng);
|
||||
nonces.insert(config.identifier, nonce);
|
||||
commitments.insert(config.identifier, commitment);
|
||||
}
|
||||
|
@ -58,12 +57,12 @@ fn check_participant() {
|
|||
|
||||
// Round 2
|
||||
|
||||
let mut signature_shares = Vec::new();
|
||||
let mut signature_shares = HashMap::new();
|
||||
|
||||
for participant_identifier in nonces.keys() {
|
||||
let config = Round2Config {
|
||||
message: message.clone(),
|
||||
signer_commitments: commitments.values().cloned().collect(),
|
||||
signer_commitments: commitments.clone(),
|
||||
};
|
||||
let signature = generate_signature(
|
||||
config,
|
||||
|
@ -71,15 +70,14 @@ fn check_participant() {
|
|||
&nonces[participant_identifier],
|
||||
)
|
||||
.unwrap();
|
||||
signature_shares.push(signature);
|
||||
signature_shares.insert(*participant_identifier, signature);
|
||||
}
|
||||
|
||||
// Coordinator aggregates signatures
|
||||
|
||||
let signing_package = SigningPackage::new(commitments.values().cloned().collect(), &message);
|
||||
let signing_package = SigningPackage::new(commitments, &message);
|
||||
|
||||
let group_signature =
|
||||
frost::aggregate(&signing_package, &signature_shares[..], &pubkeys).unwrap();
|
||||
let group_signature = aggregate(&signing_package, &signature_shares, &pubkeys).unwrap();
|
||||
let verify_signature = pubkeys.group_public().verify(&message, &group_signature);
|
||||
|
||||
assert!(verify_signature.is_ok());
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,7 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
frost-ed25519 = "0.5.0"
|
||||
frost-ed25519 = "0.6.0"
|
||||
thiserror = "1.0"
|
||||
rand = "0.8"
|
||||
hex = "0.4"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use frost::keys::IdentifierList;
|
||||
use frost::Error;
|
||||
use frost_ed25519 as frost;
|
||||
use rand::thread_rng;
|
||||
|
@ -18,6 +19,7 @@ pub struct TrustedDealerError {
|
|||
pub cli_error: CliError,
|
||||
}
|
||||
|
||||
// Currently this defaults to the Default value for Identifiers
|
||||
pub fn cli() -> Result<(), TrustedDealerError> {
|
||||
let mut reader = Box::new(io::stdin().lock());
|
||||
let config = request_inputs(&mut reader);
|
||||
|
@ -33,9 +35,9 @@ pub fn cli() -> Result<(), TrustedDealerError> {
|
|||
let mut rng = thread_rng();
|
||||
|
||||
let keygen = if config.secret.is_empty() {
|
||||
trusted_dealer_keygen(&config, &mut rng)
|
||||
trusted_dealer_keygen(&config, IdentifierList::Default, &mut rng)
|
||||
} else {
|
||||
split_secret(&config, &mut rng)
|
||||
split_secret(&config, IdentifierList::Default, &mut rng)
|
||||
};
|
||||
|
||||
if let Err(e) = keygen {
|
||||
|
|
|
@ -32,7 +32,7 @@ pub fn print_values(
|
|||
) {
|
||||
logger.log(format!(
|
||||
"Group public key: {}",
|
||||
hex::encode(pubkeys.group_public().to_bytes())
|
||||
hex::encode(pubkeys.group_public().serialize())
|
||||
));
|
||||
|
||||
println!("---");
|
||||
|
@ -41,11 +41,11 @@ pub fn print_values(
|
|||
logger.log(format!("Participant: {}", get_identifier_value(*k)));
|
||||
logger.log(format!(
|
||||
"Secret share: {}",
|
||||
hex::encode(v.value().to_bytes())
|
||||
hex::encode(v.value().serialize())
|
||||
));
|
||||
logger.log(format!(
|
||||
"Public key: {}",
|
||||
hex::encode(pubkeys.signer_pubkeys()[k].to_bytes())
|
||||
hex::encode(pubkeys.signer_pubkeys()[k].serialize())
|
||||
));
|
||||
logger.log(format!(
|
||||
"Your verifiable secret sharing commitment: {}",
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use crate::inputs::Config;
|
||||
use crate::tests::integration_test::signature_gen::generate_key_packages;
|
||||
use crate::tests::integration_test::signature_gen::{key_package, round_1, round_2};
|
||||
use crate::trusted_dealer_keygen::split_secret;
|
||||
use frost::aggregate;
|
||||
use frost::keys::IdentifierList;
|
||||
use frost_ed25519 as frost;
|
||||
use rand::thread_rng;
|
||||
|
||||
|
@ -15,17 +17,14 @@ fn check_keygen_with_dealer() {
|
|||
max_signers: 3,
|
||||
secret: Vec::new(),
|
||||
};
|
||||
let (shares, pubkeys) = trusted_dealer_keygen(&config, &mut rng).unwrap();
|
||||
let key_packages = generate_key_packages(shares);
|
||||
let (nonces, commitments) =
|
||||
signature_gen::generate_nonces_and_commitments(config.min_signers, &key_packages, &mut rng);
|
||||
let message = "message to sign".as_bytes();
|
||||
let comms = commitments.into_values().collect();
|
||||
let signing_package = frost::SigningPackage::new(comms, message);
|
||||
let signature_shares =
|
||||
signature_gen::generate_signature_shares(nonces, &key_packages, &signing_package);
|
||||
let group_signature =
|
||||
frost::aggregate(&signing_package, &signature_shares[..], &pubkeys).unwrap();
|
||||
let (shares, pubkeys) =
|
||||
trusted_dealer_keygen(&config, IdentifierList::Default, &mut rng).unwrap();
|
||||
|
||||
let key_packages = key_package(&shares);
|
||||
let (nonces, commitments) = round_1(config.min_signers, &mut rng, &key_packages);
|
||||
let message = "i am a message".as_bytes();
|
||||
let (signing_package, signature_shares) = round_2(nonces, &key_packages, commitments, message);
|
||||
let group_signature = aggregate(&signing_package, &signature_shares, &pubkeys).unwrap();
|
||||
let verify_signature = pubkeys.group_public().verify(message, &group_signature);
|
||||
|
||||
assert!(verify_signature.is_ok());
|
||||
|
@ -39,17 +38,14 @@ fn check_keygen_with_dealer_with_large_num_of_signers() {
|
|||
max_signers: 20,
|
||||
secret: Vec::new(),
|
||||
};
|
||||
let (shares, pubkeys) = trusted_dealer_keygen(&config, &mut rng).unwrap();
|
||||
let key_packages = generate_key_packages(shares);
|
||||
let (nonces, commitments) =
|
||||
signature_gen::generate_nonces_and_commitments(config.min_signers, &key_packages, &mut rng);
|
||||
let message = "message to sign".as_bytes();
|
||||
let comms = commitments.into_values().collect();
|
||||
let signing_package = frost::SigningPackage::new(comms, message);
|
||||
let signature_shares =
|
||||
signature_gen::generate_signature_shares(nonces, &key_packages, &signing_package);
|
||||
let group_signature =
|
||||
frost::aggregate(&signing_package, &signature_shares[..], &pubkeys).unwrap();
|
||||
let (shares, pubkeys) =
|
||||
trusted_dealer_keygen(&config, IdentifierList::Default, &mut rng).unwrap();
|
||||
|
||||
let key_packages = key_package(&shares);
|
||||
let (nonces, commitments) = round_1(config.min_signers, &mut rng, &key_packages);
|
||||
let message = "i am a message".as_bytes();
|
||||
let (signing_package, signature_shares) = round_2(nonces, &key_packages, commitments, message);
|
||||
let group_signature = aggregate(&signing_package, &signature_shares, &pubkeys).unwrap();
|
||||
let verify_signature = pubkeys.group_public().verify(message, &group_signature);
|
||||
|
||||
assert!(verify_signature.is_ok());
|
||||
|
@ -67,20 +63,14 @@ fn check_keygen_with_dealer_with_secret() {
|
|||
max_signers: 3,
|
||||
secret,
|
||||
};
|
||||
let (shares, pubkeys) = split_secret(&secret_config, &mut rng).unwrap();
|
||||
let key_packages = generate_key_packages(shares);
|
||||
let (nonces, commitments) = signature_gen::generate_nonces_and_commitments(
|
||||
secret_config.min_signers,
|
||||
&key_packages,
|
||||
&mut rng,
|
||||
);
|
||||
let message = "message to sign".as_bytes();
|
||||
let comms = commitments.into_values().collect();
|
||||
let signing_package = frost::SigningPackage::new(comms, message);
|
||||
let signature_shares =
|
||||
signature_gen::generate_signature_shares(nonces, &key_packages, &signing_package);
|
||||
let group_signature =
|
||||
frost::aggregate(&signing_package, &signature_shares[..], &pubkeys).unwrap();
|
||||
|
||||
let (shares, pubkeys) =
|
||||
split_secret(&secret_config, IdentifierList::Default, &mut rng).unwrap();
|
||||
let key_packages = key_package(&shares);
|
||||
let (nonces, commitments) = round_1(secret_config.min_signers, &mut rng, &key_packages);
|
||||
let message = "i am a message".as_bytes();
|
||||
let (signing_package, signature_shares) = round_2(nonces, &key_packages, commitments, message);
|
||||
let group_signature = aggregate(&signing_package, &signature_shares, &pubkeys).unwrap();
|
||||
let verify_signature = pubkeys.group_public().verify(message, &group_signature);
|
||||
|
||||
assert!(verify_signature.is_ok());
|
||||
|
@ -98,20 +88,13 @@ fn check_keygen_with_dealer_with_secret_with_large_num_of_signers() {
|
|||
max_signers: 20,
|
||||
secret,
|
||||
};
|
||||
let (shares, pubkeys) = split_secret(&secret_config, &mut rng).unwrap();
|
||||
let key_packages = generate_key_packages(shares);
|
||||
let (nonces, commitments) = signature_gen::generate_nonces_and_commitments(
|
||||
secret_config.min_signers,
|
||||
&key_packages,
|
||||
&mut rng,
|
||||
);
|
||||
let message = "message to sign".as_bytes();
|
||||
let comms = commitments.into_values().collect();
|
||||
let signing_package = frost::SigningPackage::new(comms, message);
|
||||
let signature_shares =
|
||||
signature_gen::generate_signature_shares(nonces, &key_packages, &signing_package);
|
||||
let group_signature =
|
||||
frost::aggregate(&signing_package, &signature_shares[..], &pubkeys).unwrap();
|
||||
let (shares, pubkeys) =
|
||||
split_secret(&secret_config, IdentifierList::Default, &mut rng).unwrap();
|
||||
let key_packages = key_package(&shares);
|
||||
let (nonces, commitments) = round_1(secret_config.min_signers, &mut rng, &key_packages);
|
||||
let message = "i am a message".as_bytes();
|
||||
let (signing_package, signature_shares) = round_2(nonces, &key_packages, commitments, message);
|
||||
let group_signature = aggregate(&signing_package, &signature_shares, &pubkeys).unwrap();
|
||||
let verify_signature = pubkeys.group_public().verify(message, &group_signature);
|
||||
|
||||
assert!(verify_signature.is_ok());
|
||||
|
|
|
@ -4,60 +4,56 @@ use frost::round2::SignatureShare;
|
|||
use frost::{Identifier, SigningPackage};
|
||||
use frost_ed25519 as frost;
|
||||
use rand::rngs::ThreadRng;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
|
||||
pub fn generate_key_packages(
|
||||
shares: HashMap<Identifier, SecretShare>,
|
||||
) -> HashMap<Identifier, KeyPackage> {
|
||||
pub fn key_package(shares: &HashMap<Identifier, SecretShare>) -> HashMap<Identifier, KeyPackage> {
|
||||
let mut key_packages: HashMap<_, _> = HashMap::new();
|
||||
|
||||
for (k, v) in shares {
|
||||
let key_package = frost::keys::KeyPackage::try_from(v).unwrap();
|
||||
key_packages.insert(k, key_package);
|
||||
for (identifier, secret_share) in shares {
|
||||
let key_package = frost::keys::KeyPackage::try_from(secret_share.clone()).unwrap();
|
||||
key_packages.insert(*identifier, key_package);
|
||||
}
|
||||
|
||||
key_packages
|
||||
}
|
||||
|
||||
pub fn generate_nonces_and_commitments(
|
||||
pub fn round_1(
|
||||
min_signers: u16,
|
||||
mut rng: &mut ThreadRng,
|
||||
key_packages: &HashMap<Identifier, KeyPackage>,
|
||||
rng: &mut ThreadRng,
|
||||
) -> (
|
||||
HashMap<Identifier, SigningNonces>,
|
||||
HashMap<Identifier, SigningCommitments>,
|
||||
BTreeMap<Identifier, SigningCommitments>,
|
||||
) {
|
||||
let mut nonces = HashMap::new();
|
||||
let mut commitments = HashMap::new();
|
||||
// Participant Round 1
|
||||
|
||||
let mut nonces_map = HashMap::new();
|
||||
let mut commitments_map = BTreeMap::new();
|
||||
|
||||
for participant_index in 1..(min_signers + 1) {
|
||||
let participant_identifier = participant_index.try_into().expect("should be nonzero");
|
||||
let (nonce, commitment) = frost::round1::commit(
|
||||
participant_identifier,
|
||||
key_packages[&participant_identifier].secret_share(),
|
||||
rng,
|
||||
);
|
||||
nonces.insert(participant_identifier, nonce);
|
||||
commitments.insert(participant_identifier, commitment);
|
||||
let key_package = &key_packages[&participant_identifier];
|
||||
let (nonces, commitments) = frost::round1::commit(key_package.secret_share(), &mut rng);
|
||||
nonces_map.insert(participant_identifier, nonces);
|
||||
commitments_map.insert(participant_identifier, commitments);
|
||||
}
|
||||
|
||||
(nonces, commitments)
|
||||
(nonces_map, commitments_map)
|
||||
}
|
||||
|
||||
pub fn generate_signature_shares(
|
||||
nonces: HashMap<Identifier, SigningNonces>,
|
||||
pub fn round_2(
|
||||
nonces_map: HashMap<Identifier, SigningNonces>,
|
||||
key_packages: &HashMap<Identifier, KeyPackage>,
|
||||
signing_package: &SigningPackage,
|
||||
) -> Vec<SignatureShare> {
|
||||
let mut signature_shares = Vec::new();
|
||||
|
||||
for participant_identifier in nonces.keys() {
|
||||
commitments_map: BTreeMap<Identifier, SigningCommitments>,
|
||||
message: &[u8],
|
||||
) -> (SigningPackage, HashMap<Identifier, SignatureShare>) {
|
||||
let signing_package = frost::SigningPackage::new(commitments_map, message);
|
||||
let mut signature_shares = HashMap::new();
|
||||
for participant_identifier in nonces_map.keys() {
|
||||
let key_package = &key_packages[participant_identifier];
|
||||
let nonces_to_use = &nonces[participant_identifier];
|
||||
let signature_share =
|
||||
frost::round2::sign(signing_package, nonces_to_use, key_package).unwrap(); //TODO: handle errors
|
||||
|
||||
signature_shares.push(signature_share);
|
||||
let nonces = &nonces_map[participant_identifier];
|
||||
let signature_share = frost::round2::sign(&signing_package, nonces, key_package).unwrap();
|
||||
signature_shares.insert(*participant_identifier, signature_share);
|
||||
}
|
||||
|
||||
signature_shares
|
||||
(signing_package, signature_shares)
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use frost::keys::IdentifierList;
|
||||
use frost::Identifier;
|
||||
use frost_ed25519 as frost;
|
||||
use rand::thread_rng;
|
||||
|
@ -32,7 +33,8 @@ fn check_output_without_secret() {
|
|||
max_signers: 3,
|
||||
secret: Vec::new(),
|
||||
};
|
||||
let (shares, pubkeys) = trusted_dealer_keygen(&config, &mut rng).unwrap();
|
||||
let (shares, pubkeys) =
|
||||
trusted_dealer_keygen(&config, IdentifierList::Default, &mut rng).unwrap();
|
||||
|
||||
print_values(&shares, &pubkeys, &mut test_logger);
|
||||
|
||||
|
@ -48,7 +50,7 @@ fn check_output_without_secret() {
|
|||
test_logger.0[0],
|
||||
format!(
|
||||
"Group public key: {}",
|
||||
hex::encode(pubkeys.group_public().to_bytes())
|
||||
hex::encode(pubkeys.group_public().serialize())
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -57,14 +59,14 @@ fn check_output_without_secret() {
|
|||
test_logger.0[2],
|
||||
format!(
|
||||
"Secret share: {}",
|
||||
hex::encode(shares[&signer_1].value().to_bytes())
|
||||
hex::encode(shares[&signer_1].value().serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
test_logger.0[3],
|
||||
format!(
|
||||
"Public key: {}",
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_1].to_bytes())
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_1].serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
|
@ -80,14 +82,14 @@ fn check_output_without_secret() {
|
|||
test_logger.0[6],
|
||||
format!(
|
||||
"Secret share: {}",
|
||||
hex::encode(shares[&signer_2].value().to_bytes())
|
||||
hex::encode(shares[&signer_2].value().serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
test_logger.0[7],
|
||||
format!(
|
||||
"Public key: {}",
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_2].to_bytes())
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_2].serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
|
@ -103,14 +105,14 @@ fn check_output_without_secret() {
|
|||
test_logger.0[10],
|
||||
format!(
|
||||
"Secret share: {}",
|
||||
hex::encode(shares[&signer_3].value().to_bytes())
|
||||
hex::encode(shares[&signer_3].value().serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
test_logger.0[11],
|
||||
format!(
|
||||
"Public key: {}",
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_3].to_bytes())
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_3].serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
|
@ -135,7 +137,7 @@ fn check_output_with_secret() {
|
|||
max_signers: 3,
|
||||
secret,
|
||||
};
|
||||
let (shares, pubkeys) = split_secret(&config, &mut rng).unwrap();
|
||||
let (shares, pubkeys) = split_secret(&config, IdentifierList::Default, &mut rng).unwrap();
|
||||
|
||||
print_values(&shares, &pubkeys, &mut test_logger);
|
||||
|
||||
|
@ -151,7 +153,7 @@ fn check_output_with_secret() {
|
|||
test_logger.0[0],
|
||||
format!(
|
||||
"Group public key: {}",
|
||||
hex::encode(pubkeys.group_public().to_bytes())
|
||||
hex::encode(pubkeys.group_public().serialize())
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -160,14 +162,14 @@ fn check_output_with_secret() {
|
|||
test_logger.0[2],
|
||||
format!(
|
||||
"Secret share: {}",
|
||||
hex::encode(shares[&signer_1].value().to_bytes())
|
||||
hex::encode(shares[&signer_1].value().serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
test_logger.0[3],
|
||||
format!(
|
||||
"Public key: {}",
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_1].to_bytes())
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_1].serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
|
@ -183,14 +185,14 @@ fn check_output_with_secret() {
|
|||
test_logger.0[6],
|
||||
format!(
|
||||
"Secret share: {}",
|
||||
hex::encode(shares[&signer_2].value().to_bytes())
|
||||
hex::encode(shares[&signer_2].value().serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
test_logger.0[7],
|
||||
format!(
|
||||
"Public key: {}",
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_2].to_bytes())
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_2].serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
|
@ -206,14 +208,14 @@ fn check_output_with_secret() {
|
|||
test_logger.0[10],
|
||||
format!(
|
||||
"Secret share: {}",
|
||||
hex::encode(shares[&signer_3].value().to_bytes())
|
||||
hex::encode(shares[&signer_3].value().serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
test_logger.0[11],
|
||||
format!(
|
||||
"Public key: {}",
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_3].to_bytes())
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_3].serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
|
@ -234,7 +236,8 @@ fn check_output_with_large_num_of_signers() {
|
|||
max_signers: 20,
|
||||
secret: Vec::new(),
|
||||
};
|
||||
let (shares, pubkeys) = trusted_dealer_keygen(&config, &mut rng).unwrap();
|
||||
let (shares, pubkeys) =
|
||||
trusted_dealer_keygen(&config, IdentifierList::Default, &mut rng).unwrap();
|
||||
|
||||
print_values(&shares, &pubkeys, &mut test_logger);
|
||||
|
||||
|
@ -245,7 +248,7 @@ fn check_output_with_large_num_of_signers() {
|
|||
test_logger.0[0],
|
||||
format!(
|
||||
"Group public key: {}",
|
||||
hex::encode(pubkeys.group_public().to_bytes())
|
||||
hex::encode(pubkeys.group_public().serialize())
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -254,14 +257,14 @@ fn check_output_with_large_num_of_signers() {
|
|||
test_logger.0[38],
|
||||
format!(
|
||||
"Secret share: {}",
|
||||
hex::encode(shares[&signer_10].value().to_bytes())
|
||||
hex::encode(shares[&signer_10].value().serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
test_logger.0[39],
|
||||
format!(
|
||||
"Public key: {}",
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_10].to_bytes())
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_10].serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
|
@ -286,7 +289,7 @@ fn check_output_with_secret_with_large_num_of_signers() {
|
|||
max_signers: 20,
|
||||
secret,
|
||||
};
|
||||
let (shares, pubkeys) = split_secret(&config, &mut rng).unwrap();
|
||||
let (shares, pubkeys) = split_secret(&config, IdentifierList::Default, &mut rng).unwrap();
|
||||
|
||||
print_values(&shares, &pubkeys, &mut test_logger);
|
||||
|
||||
|
@ -297,7 +300,7 @@ fn check_output_with_secret_with_large_num_of_signers() {
|
|||
test_logger.0[0],
|
||||
format!(
|
||||
"Group public key: {}",
|
||||
hex::encode(pubkeys.group_public().to_bytes())
|
||||
hex::encode(pubkeys.group_public().serialize())
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -306,14 +309,14 @@ fn check_output_with_secret_with_large_num_of_signers() {
|
|||
test_logger.0[38],
|
||||
format!(
|
||||
"Secret share: {}",
|
||||
hex::encode(shares[&signer_10].value().to_bytes())
|
||||
hex::encode(shares[&signer_10].value().serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
test_logger.0[39],
|
||||
format!(
|
||||
"Public key: {}",
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_10].to_bytes())
|
||||
hex::encode(pubkeys.signer_pubkeys()[&signer_10].serialize())
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use frost::keys::{PublicKeyPackage, SecretShare};
|
||||
use frost::keys::{IdentifierList, PublicKeyPackage, SecretShare};
|
||||
use frost::{Error, Identifier, SigningKey};
|
||||
use frost_ed25519 as frost;
|
||||
use rand::rngs::ThreadRng;
|
||||
|
@ -8,10 +8,15 @@ use crate::inputs::Config;
|
|||
|
||||
pub fn trusted_dealer_keygen(
|
||||
config: &Config,
|
||||
identifiers: IdentifierList,
|
||||
rng: &mut ThreadRng,
|
||||
) -> Result<(HashMap<Identifier, SecretShare>, PublicKeyPackage), Error> {
|
||||
let (shares, pubkeys) =
|
||||
frost::keys::generate_with_dealer(config.max_signers, config.min_signers, rng)?;
|
||||
let (shares, pubkeys) = frost::keys::generate_with_dealer(
|
||||
config.max_signers,
|
||||
config.min_signers,
|
||||
identifiers,
|
||||
rng,
|
||||
)?;
|
||||
|
||||
for (_k, v) in shares.clone() {
|
||||
frost::keys::KeyPackage::try_from(v)?;
|
||||
|
@ -22,17 +27,23 @@ pub fn trusted_dealer_keygen(
|
|||
|
||||
pub fn split_secret(
|
||||
config: &Config,
|
||||
identifiers: IdentifierList,
|
||||
rng: &mut ThreadRng,
|
||||
) -> Result<(HashMap<Identifier, SecretShare>, PublicKeyPackage), Error> {
|
||||
let secret_key = SigningKey::from_bytes(
|
||||
let secret_key = SigningKey::deserialize(
|
||||
config
|
||||
.secret
|
||||
.clone()
|
||||
.try_into()
|
||||
.map_err(|_| Error::MalformedSigningKey)?,
|
||||
)?;
|
||||
let (shares, pubkeys) =
|
||||
frost::keys::split(&secret_key, config.max_signers, config.min_signers, rng)?;
|
||||
let (shares, pubkeys) = frost::keys::split(
|
||||
&secret_key,
|
||||
config.max_signers,
|
||||
config.min_signers,
|
||||
identifiers,
|
||||
rng,
|
||||
)?;
|
||||
|
||||
for (_k, v) in shares.clone() {
|
||||
frost::keys::KeyPackage::try_from(v)?;
|
||||
|
@ -44,6 +55,7 @@ pub fn split_secret(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use frost_ed25519::keys::IdentifierList;
|
||||
use rand::thread_rng;
|
||||
|
||||
use crate::{inputs::Config, trusted_dealer_keygen::split_secret};
|
||||
|
@ -57,7 +69,7 @@ mod tests {
|
|||
secret: b"helloIamaninvalidsecret111111111".to_vec(),
|
||||
};
|
||||
|
||||
let out = split_secret(&secret_config, &mut rng);
|
||||
let out = split_secret(&secret_config, IdentifierList::Default, &mut rng);
|
||||
|
||||
assert!(out.is_err());
|
||||
}
|
||||
|
@ -75,7 +87,7 @@ mod tests {
|
|||
secret,
|
||||
};
|
||||
|
||||
let out = split_secret(&secret_config, &mut rng);
|
||||
let out = split_secret(&secret_config, IdentifierList::Default, &mut rng);
|
||||
|
||||
assert!(out.is_err());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue