improved some prompts for clarity
This commit is contained in:
parent
519623678c
commit
2cd6862cca
|
@ -44,8 +44,8 @@ fn request_inputs_commitments(
|
||||||
for p in participants {
|
for p in participants {
|
||||||
writeln!(
|
writeln!(
|
||||||
logger,
|
logger,
|
||||||
"Please enter JSON encoded commitments for participant {:#?}:",
|
"Please enter JSON encoded commitments for participant {}:",
|
||||||
p
|
hex::encode(p.serialize())
|
||||||
)?; // TODO: improve printing
|
)?; // TODO: improve printing
|
||||||
|
|
||||||
let mut commitments_input = String::new();
|
let mut commitments_input = String::new();
|
||||||
|
@ -62,7 +62,7 @@ fn request_inputs_commitments(
|
||||||
fn print_commitments(logger: &mut dyn Write, signing_package: &SigningPackage) {
|
fn print_commitments(logger: &mut dyn Write, signing_package: &SigningPackage) {
|
||||||
writeln!(
|
writeln!(
|
||||||
logger,
|
logger,
|
||||||
"SigningPackage:\n{}",
|
"Signing Package:\n{}",
|
||||||
serde_json::to_string(&signing_package).unwrap()
|
serde_json::to_string(&signing_package).unwrap()
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -34,8 +34,8 @@ fn request_inputs_signature_shares(
|
||||||
for p in participants.participants {
|
for p in participants.participants {
|
||||||
writeln!(
|
writeln!(
|
||||||
logger,
|
logger,
|
||||||
"Please enter JSON encoded signatures for participant {:?}:",
|
"Please enter JSON encoded signature shares for participant {}:",
|
||||||
p
|
hex::encode(p.serialize())
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|
|
@ -140,12 +140,12 @@ fn check_step_2() {
|
||||||
assert!(signing_package.is_ok());
|
assert!(signing_package.is_ok());
|
||||||
assert!(signing_package.unwrap() == expected_signing_package);
|
assert!(signing_package.unwrap() == expected_signing_package);
|
||||||
|
|
||||||
let expected = "The message to be signed (hex encoded)\nPlease enter JSON encoded commitments for participant Identifier(\n \"0100000000000000000000000000000000000000000000000000000000000000\",\n):\nPlease enter JSON encoded commitments for participant Identifier(\n \"0300000000000000000000000000000000000000000000000000000000000000\",\n):\nSigning Package: {\"signing_commitments\":{\"0100000000000000000000000000000000000000000000000000000000000000\":{\"hiding\":\"5078f5c6d679654bb88a8887242d49cc21a553ed26caed4d52570c6656fb9b92\",\"binding\":\"936b660d3008d8298b0a7220a327a0813ffedd9d07604bdc73d7cffef63c0da0\",\"ciphersuite\":\"FROST(Ed25519, SHA-512)\"},\"0300000000000000000000000000000000000000000000000000000000000000\":{\"hiding\":\"91c2469b501fe5af8493f9ae77c8f57999460af317f2d9f2d4378ae0e665860e\",\"binding\":\"c225618accff2266a45d87dc3219b04c774ca26c8629c4fa483e7e87da820007\",\"ciphersuite\":\"FROST(Ed25519, SHA-512)\"}},\"message\":\"74657374\",\"ciphersuite\":\"FROST(Ed25519, SHA-512)\"}\n";
|
let expected = "The message to be signed (hex encoded)\nPlease enter JSON encoded commitments for participant 0100000000000000000000000000000000000000000000000000000000000000:\nPlease enter JSON encoded commitments for participant 0300000000000000000000000000000000000000000000000000000000000000:\nSigning Package:\n{\"signing_commitments\":{\"0100000000000000000000000000000000000000000000000000000000000000\":{\"hiding\":\"5078f5c6d679654bb88a8887242d49cc21a553ed26caed4d52570c6656fb9b92\",\"binding\":\"936b660d3008d8298b0a7220a327a0813ffedd9d07604bdc73d7cffef63c0da0\",\"ciphersuite\":\"FROST(Ed25519, SHA-512)\"},\"0300000000000000000000000000000000000000000000000000000000000000\":{\"hiding\":\"91c2469b501fe5af8493f9ae77c8f57999460af317f2d9f2d4378ae0e665860e\",\"binding\":\"c225618accff2266a45d87dc3219b04c774ca26c8629c4fa483e7e87da820007\",\"ciphersuite\":\"FROST(Ed25519, SHA-512)\"}},\"message\":\"74657374\",\"ciphersuite\":\"FROST(Ed25519, SHA-512)\"}\n";
|
||||||
|
|
||||||
let (_, res) = &buf.into_parts();
|
let (_, res) = &buf.into_parts();
|
||||||
let actual = hex::encode(res.as_ref().unwrap());
|
let actual = String::from_utf8(res.as_ref().unwrap().to_owned()).unwrap();
|
||||||
|
|
||||||
assert_eq!(hex::encode(expected), actual)
|
assert_eq!(expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -212,10 +212,10 @@ fn check_step_3() {
|
||||||
signing_package,
|
signing_package,
|
||||||
);
|
);
|
||||||
|
|
||||||
let expected = "Please enter JSON encoded signatures for participant Identifier(\"0100000000000000000000000000000000000000000000000000000000000000\"):\nPlease enter JSON encoded signatures for participant Identifier(\"0300000000000000000000000000000000000000000000000000000000000000\"):\nGroup signature: \"72c948a63797c693e8e978fdb703a1f5a7590472a539da13b71dd6c2b8c1b2a664b7b4af6194439357c5d15f366760fce53c985a186709e74bb0f8e5078ea805\"\n";
|
let expected = "Please enter JSON encoded signature shares for participant 0100000000000000000000000000000000000000000000000000000000000000:\nPlease enter JSON encoded signature shares for participant 0300000000000000000000000000000000000000000000000000000000000000:\nGroup signature: \"72c948a63797c693e8e978fdb703a1f5a7590472a539da13b71dd6c2b8c1b2a664b7b4af6194439357c5d15f366760fce53c985a186709e74bb0f8e5078ea805\"\n";
|
||||||
|
|
||||||
let (_, res) = &buf.into_parts();
|
let (_, res) = &buf.into_parts();
|
||||||
let actual = hex::encode(res.as_ref().unwrap());
|
let actual = String::from_utf8(res.as_ref().unwrap().to_owned()).unwrap();
|
||||||
|
|
||||||
assert_eq!(hex::encode(expected), actual)
|
assert_eq!(expected, actual)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use frost::{round1, Error};
|
use frost::{round1, Error};
|
||||||
use frost_ed25519 as frost;
|
use frost_ed25519 as frost;
|
||||||
use participant::round1::{generate_key_package, print_values, request_inputs};
|
use participant::round1::{print_values, request_inputs};
|
||||||
use participant::round2::{generate_signature, print_values_round_2, round_2_request_inputs};
|
use participant::round2::{generate_signature, print_values_round_2, round_2_request_inputs};
|
||||||
use participant::Logger;
|
use participant::Logger;
|
||||||
use rand::thread_rng;
|
use rand::thread_rng;
|
||||||
|
@ -10,7 +10,6 @@ use std::io::BufRead;
|
||||||
pub enum CliError {
|
pub enum CliError {
|
||||||
Config,
|
Config,
|
||||||
Signing,
|
Signing,
|
||||||
KeyPackage,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ParticipantError {
|
pub struct ParticipantError {
|
||||||
|
@ -31,16 +30,7 @@ pub fn cli(input: &mut impl BufRead, logger: &mut dyn Logger) -> Result<(), Part
|
||||||
|
|
||||||
let round_1_config_ok = round_1_config.unwrap();
|
let round_1_config_ok = round_1_config.unwrap();
|
||||||
|
|
||||||
let key_package = generate_key_package(&round_1_config_ok);
|
let key_package_ok = round_1_config_ok.key_package;
|
||||||
|
|
||||||
if let Err(e) = key_package {
|
|
||||||
return Err(ParticipantError {
|
|
||||||
frost_error: e,
|
|
||||||
cli_error: CliError::KeyPackage,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let key_package_ok = key_package.unwrap();
|
|
||||||
|
|
||||||
logger.log("Key Package succesfully created.".to_string());
|
logger.log("Key Package succesfully created.".to_string());
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ use std::io::BufRead;
|
||||||
// TODO: Rethink the types here. They're inconsistent with each other
|
// TODO: Rethink the types here. They're inconsistent with each other
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct Round1Config {
|
pub struct Round1Config {
|
||||||
pub secret_share: SecretShare,
|
pub key_package: KeyPackage,
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub trait Logger {
|
// pub trait Logger {
|
||||||
|
@ -22,22 +22,20 @@ pub fn request_inputs(
|
||||||
input: &mut impl BufRead,
|
input: &mut impl BufRead,
|
||||||
logger: &mut dyn Logger,
|
logger: &mut dyn Logger,
|
||||||
) -> Result<Round1Config, Error> {
|
) -> Result<Round1Config, Error> {
|
||||||
logger.log("Your JSON-encoded secret share:".to_string());
|
logger.log("Your JSON-encoded secret share or key package:".to_string());
|
||||||
|
|
||||||
let mut secret_share_json = String::new();
|
let mut json = String::new();
|
||||||
|
|
||||||
input.read_line(&mut secret_share_json).unwrap();
|
input.read_line(&mut json).unwrap();
|
||||||
|
|
||||||
let secret_share: SecretShare =
|
let key_package = if let Ok(secret_share) = serde_json::from_str::<SecretShare>(&json) {
|
||||||
serde_json::from_str(&secret_share_json).map_err(|_| Error::InvalidSecretShare)?;
|
KeyPackage::try_from(secret_share.clone())?
|
||||||
|
} else {
|
||||||
|
// TODO: Improve error
|
||||||
|
serde_json::from_str::<KeyPackage>(&json).map_err(|_| Error::InvalidSecretShare)?
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Round1Config { secret_share })
|
Ok(Round1Config { key_package })
|
||||||
}
|
|
||||||
|
|
||||||
pub fn generate_key_package(config: &Round1Config) -> Result<KeyPackage, Error> {
|
|
||||||
let key_package = KeyPackage::try_from(config.secret_share.clone())?;
|
|
||||||
|
|
||||||
Ok(key_package)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The nonces are printed out here for demo purposes only. The hiding and binding nonces are SECRET and not to be shared.
|
// The nonces are printed out here for demo purposes only. The hiding and binding nonces are SECRET and not to be shared.
|
||||||
|
|
|
@ -1,125 +1,125 @@
|
||||||
#[cfg(test)]
|
// #[cfg(test)]
|
||||||
use frost::Identifier;
|
// use frost::Identifier;
|
||||||
use frost::{
|
// use frost::{
|
||||||
keys::{
|
// keys::{
|
||||||
KeyPackage, SecretShare, SigningShare, VerifiableSecretSharingCommitment, VerifyingShare,
|
// KeyPackage, SecretShare, SigningShare, VerifiableSecretSharingCommitment, VerifyingShare,
|
||||||
},
|
// },
|
||||||
VerifyingKey,
|
// VerifyingKey,
|
||||||
};
|
// };
|
||||||
use frost_ed25519 as frost;
|
// use frost_ed25519 as frost;
|
||||||
use hex::FromHex;
|
// use hex::FromHex;
|
||||||
use participant::round1::{generate_key_package, request_inputs, Round1Config};
|
// use participant::round1::{request_inputs, Round1Config};
|
||||||
|
|
||||||
use participant::Logger;
|
// use participant::Logger;
|
||||||
|
|
||||||
const PUBLIC_KEY: &str = "adf6ab1f882d04988eadfaa52fb175bf37b6247785d7380fde3fb9d68032470d";
|
// const PUBLIC_KEY: &str = "adf6ab1f882d04988eadfaa52fb175bf37b6247785d7380fde3fb9d68032470d";
|
||||||
const GROUP_PUBLIC_KEY: &str = "087e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e";
|
// const GROUP_PUBLIC_KEY: &str = "087e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e";
|
||||||
const SIGNING_SHARE: &str = "ceed7dd148a1a1ec2e65b50ecab6a7c453ccbd38c397c3506a540b7cf0dd9104";
|
// const SIGNING_SHARE: &str = "ceed7dd148a1a1ec2e65b50ecab6a7c453ccbd38c397c3506a540b7cf0dd9104";
|
||||||
const VSS_COMMITMENT: [&str; 3] = [
|
// const VSS_COMMITMENT: [&str; 3] = [
|
||||||
"087e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e",
|
// "087e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e",
|
||||||
"926d5910e146dccb9148ca39dc7607f4f7123ff1c0ffaf109add1d165c568bf2",
|
// "926d5910e146dccb9148ca39dc7607f4f7123ff1c0ffaf109add1d165c568bf2",
|
||||||
"291bb78d7e4ef124f5aa6a36cbcf8c276e70fbb4e208212e916d762fc42c1bbc",
|
// "291bb78d7e4ef124f5aa6a36cbcf8c276e70fbb4e208212e916d762fc42c1bbc",
|
||||||
];
|
// ];
|
||||||
const SECRET_SHARE_JSON: &str = r#"{"identifier":"0100000000000000000000000000000000000000000000000000000000000000","value":"ceed7dd148a1a1ec2e65b50ecab6a7c453ccbd38c397c3506a540b7cf0dd9104","commitment":["087e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e","926d5910e146dccb9148ca39dc7607f4f7123ff1c0ffaf109add1d165c568bf2", "291bb78d7e4ef124f5aa6a36cbcf8c276e70fbb4e208212e916d762fc42c1bbc"],"ciphersuite":"FROST(Ed25519, SHA-512)"}"#;
|
// const SECRET_SHARE_JSON: &str = r#"{"identifier":"0100000000000000000000000000000000000000000000000000000000000000","value":"ceed7dd148a1a1ec2e65b50ecab6a7c453ccbd38c397c3506a540b7cf0dd9104","commitment":["087e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e","926d5910e146dccb9148ca39dc7607f4f7123ff1c0ffaf109add1d165c568bf2", "291bb78d7e4ef124f5aa6a36cbcf8c276e70fbb4e208212e916d762fc42c1bbc"],"ciphersuite":"FROST(Ed25519, SHA-512)"}"#;
|
||||||
|
|
||||||
pub struct TestLogger(Vec<String>);
|
// pub struct TestLogger(Vec<String>);
|
||||||
|
|
||||||
impl Logger for TestLogger {
|
// impl Logger for TestLogger {
|
||||||
fn log(&mut self, value: String) {
|
// fn log(&mut self, value: String) {
|
||||||
self.0.push(value);
|
// self.0.push(value);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[test]
|
// #[test]
|
||||||
fn check_valid_round_1_inputs() {
|
// fn check_valid_round_1_inputs() {
|
||||||
let config = Round1Config {
|
// let config = Round1Config {
|
||||||
secret_share: SecretShare::new(
|
// secret_share: SecretShare::new(
|
||||||
Identifier::try_from(1).unwrap(),
|
// Identifier::try_from(1).unwrap(),
|
||||||
SigningShare::deserialize(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap()).unwrap(),
|
// SigningShare::deserialize(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap()).unwrap(),
|
||||||
VerifiableSecretSharingCommitment::deserialize(
|
// VerifiableSecretSharingCommitment::deserialize(
|
||||||
VSS_COMMITMENT
|
// VSS_COMMITMENT
|
||||||
.iter()
|
// .iter()
|
||||||
.map(|s| hex::decode(s).unwrap().try_into().unwrap())
|
// .map(|s| hex::decode(s).unwrap().try_into().unwrap())
|
||||||
.collect(),
|
// .collect(),
|
||||||
)
|
// )
|
||||||
.unwrap(),
|
// .unwrap(),
|
||||||
),
|
// ),
|
||||||
};
|
// };
|
||||||
|
|
||||||
let mut test_logger = TestLogger(Vec::new());
|
// let mut test_logger = TestLogger(Vec::new());
|
||||||
|
|
||||||
let input = SECRET_SHARE_JSON;
|
// let input = SECRET_SHARE_JSON;
|
||||||
let mut valid_input = input.as_bytes();
|
// let mut valid_input = input.as_bytes();
|
||||||
|
|
||||||
let expected = request_inputs(&mut valid_input, &mut test_logger).unwrap();
|
// let expected = request_inputs(&mut valid_input, &mut test_logger).unwrap();
|
||||||
|
|
||||||
assert_eq!(expected, config);
|
// assert_eq!(expected, config);
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[test]
|
// #[test]
|
||||||
fn check_0_input_for_identifier() {
|
// fn check_0_input_for_identifier() {
|
||||||
let mut test_logger = TestLogger(Vec::new());
|
// let mut test_logger = TestLogger(Vec::new());
|
||||||
|
|
||||||
let input = r#"{"identifier":"0000000000000000000000000000000000000000000000000000000000000000","value":"ceed7dd148a1a1ec2e65b50ecab6a7c453ccbd38c397c3506a540b7cf0dd9104","commitment":["087e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e","291bb78d7e4ef124f5aa6a36cbcf8c276e70fbb4e208212e916d762fc42c1bbc"],"ciphersuite":"FROST(Ed25519, SHA-512)"}"#;
|
// let input = r#"{"identifier":"0000000000000000000000000000000000000000000000000000000000000000","value":"ceed7dd148a1a1ec2e65b50ecab6a7c453ccbd38c397c3506a540b7cf0dd9104","commitment":["087e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e","291bb78d7e4ef124f5aa6a36cbcf8c276e70fbb4e208212e916d762fc42c1bbc"],"ciphersuite":"FROST(Ed25519, SHA-512)"}"#;
|
||||||
let mut invalid_input = input.as_bytes();
|
// let mut invalid_input = input.as_bytes();
|
||||||
|
|
||||||
let expected = request_inputs(&mut invalid_input, &mut test_logger);
|
// let expected = request_inputs(&mut invalid_input, &mut test_logger);
|
||||||
|
|
||||||
assert!(expected.is_err());
|
// assert!(expected.is_err());
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[test]
|
// #[test]
|
||||||
fn check_invalid_length_signing_share() {
|
// fn check_invalid_length_signing_share() {
|
||||||
let mut test_logger = TestLogger(Vec::new());
|
// let mut test_logger = TestLogger(Vec::new());
|
||||||
|
|
||||||
let input = r#"{"identifier":"0100000000000000000000000000000000000000000000000000000000000000","value":"ed7dd148a1a1ec2e65b50ecab6a7c453ccbd38c397c3506a540b7cf0dd9104","commitment":["087e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e","291bb78d7e4ef124f5aa6a36cbcf8c276e70fbb4e208212e916d762fc42c1bbc"],"ciphersuite":"FROST(Ed25519, SHA-512)"}"#;
|
// let input = r#"{"identifier":"0100000000000000000000000000000000000000000000000000000000000000","value":"ed7dd148a1a1ec2e65b50ecab6a7c453ccbd38c397c3506a540b7cf0dd9104","commitment":["087e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e","291bb78d7e4ef124f5aa6a36cbcf8c276e70fbb4e208212e916d762fc42c1bbc"],"ciphersuite":"FROST(Ed25519, SHA-512)"}"#;
|
||||||
|
|
||||||
let mut invalid_input = input.as_bytes();
|
// let mut invalid_input = input.as_bytes();
|
||||||
|
|
||||||
let expected = request_inputs(&mut invalid_input, &mut test_logger);
|
// let expected = request_inputs(&mut invalid_input, &mut test_logger);
|
||||||
|
|
||||||
assert!(expected.is_err());
|
// assert!(expected.is_err());
|
||||||
}
|
// }
|
||||||
|
|
||||||
// TODO: Handle this error differently
|
// // TODO: Handle this error differently
|
||||||
#[test]
|
// #[test]
|
||||||
fn check_invalid_length_vss_commitment() {
|
// fn check_invalid_length_vss_commitment() {
|
||||||
let mut test_logger = TestLogger(Vec::new());
|
// let mut test_logger = TestLogger(Vec::new());
|
||||||
|
|
||||||
let input = r#"{"identifier":"0100000000000000000000000000000000000000000000000000000000000000","value":"ceed7dd148a1a1ec2e65b50ecab6a7c453ccbd38c397c3506a540b7cf0dd9104","commitment":["7e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e","291bb78d7e4ef124f5aa6a36cbcf8c276e70fbb4e208212e916d762fc42c1bbc"],"ciphersuite":"FROST(Ed25519, SHA-512)"}"#;
|
// let input = r#"{"identifier":"0100000000000000000000000000000000000000000000000000000000000000","value":"ceed7dd148a1a1ec2e65b50ecab6a7c453ccbd38c397c3506a540b7cf0dd9104","commitment":["7e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e","291bb78d7e4ef124f5aa6a36cbcf8c276e70fbb4e208212e916d762fc42c1bbc"],"ciphersuite":"FROST(Ed25519, SHA-512)"}"#;
|
||||||
|
|
||||||
let mut invalid_input = input.as_bytes();
|
// let mut invalid_input = input.as_bytes();
|
||||||
|
|
||||||
let expected = request_inputs(&mut invalid_input, &mut test_logger);
|
// let expected = request_inputs(&mut invalid_input, &mut test_logger);
|
||||||
assert!(expected.is_err())
|
// assert!(expected.is_err())
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[test]
|
// #[test]
|
||||||
fn check_key_package_generation() {
|
// fn check_key_package_generation() {
|
||||||
let config = Round1Config {
|
// let config = Round1Config {
|
||||||
secret_share: serde_json::from_str(SECRET_SHARE_JSON).unwrap(),
|
// secret_share: serde_json::from_str(SECRET_SHARE_JSON).unwrap(),
|
||||||
};
|
// };
|
||||||
|
|
||||||
let expected = KeyPackage::new(
|
// let expected = KeyPackage::new(
|
||||||
Identifier::try_from(1).unwrap(),
|
// Identifier::try_from(1).unwrap(),
|
||||||
SigningShare::deserialize(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap()).unwrap(),
|
// SigningShare::deserialize(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap()).unwrap(),
|
||||||
VerifyingShare::deserialize(<[u8; 32]>::from_hex(PUBLIC_KEY).unwrap()).unwrap(),
|
// VerifyingShare::deserialize(<[u8; 32]>::from_hex(PUBLIC_KEY).unwrap()).unwrap(),
|
||||||
VerifyingKey::from_hex(GROUP_PUBLIC_KEY).unwrap(),
|
// VerifyingKey::from_hex(GROUP_PUBLIC_KEY).unwrap(),
|
||||||
);
|
// );
|
||||||
let key_package = generate_key_package(&config).unwrap();
|
// let key_package = generate_key_package(&config).unwrap();
|
||||||
|
|
||||||
assert!(expected == key_package)
|
// assert!(expected == key_package)
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[test]
|
// #[test]
|
||||||
fn check_key_package_generation_fails_with_invalid_secret_share() {
|
// fn check_key_package_generation_fails_with_invalid_secret_share() {
|
||||||
let input = r#"{"identifier":"0100000000000000000000000000000000000000000000000000000000000000","value":"afc0ba51fd450297725f9efe714400d51a1180a273177b5dd8ad3b8cba41560d","commitment":["087e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e","291bb78d7e4ef124f5aa6a36cbcf8c276e70fbb4e208212e916d762fc42c1bbc"],"ciphersuite":"FROST(Ed25519, SHA-512)"}"#;
|
// let input = r#"{"identifier":"0100000000000000000000000000000000000000000000000000000000000000","value":"afc0ba51fd450297725f9efe714400d51a1180a273177b5dd8ad3b8cba41560d","commitment":["087e22f970daf6ac5b07b55bd7fc0af6dea199ab847dc34fc92a6f8641a1bb8e","291bb78d7e4ef124f5aa6a36cbcf8c276e70fbb4e208212e916d762fc42c1bbc"],"ciphersuite":"FROST(Ed25519, SHA-512)"}"#;
|
||||||
let config = Round1Config {
|
// let config = Round1Config {
|
||||||
secret_share: serde_json::from_str(input).unwrap(),
|
// secret_share: serde_json::from_str(input).unwrap(),
|
||||||
};
|
// };
|
||||||
let key_package = generate_key_package(&config);
|
// let key_package = generate_key_package(&config);
|
||||||
assert!(key_package.is_err());
|
// assert!(key_package.is_err());
|
||||||
}
|
// }
|
||||||
|
|
||||||
// #[test]
|
// #[test]
|
||||||
// fn check_print_values() {
|
// fn check_print_values() {
|
||||||
|
|
Loading…
Reference in New Issue