Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frost-client: add support for group description #397

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions frost-client/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ pub(crate) enum Command {
/// dealer process via the FROST server (TODO: this is not supported yet)
#[arg(short, long)]
config: Vec<String>,
/// A description of the group being created. Will be written to the
/// participant's config files and will help them identify groups.
#[arg(short, long)]
description: String,
/// The comma-separated name of each participant.
#[arg(short = 'N', long, value_delimiter = ',')]
names: Vec<String>,
Expand Down
12 changes: 8 additions & 4 deletions frost-client/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,26 @@ pub struct CommunicationKey {
}

/// A FROST group the user belongs to.
// TODO: add a textual name for the group?
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Group {
/// A human-readable description of the group to make it easier to select
/// groups
pub description: String,
/// The ciphersuite being used for the group
pub ciphersuite: String,
/// The encoded public key package for the group.
#[serde(
serialize_with = "serdect::slice::serialize_hex_lower_or_bin",
deserialize_with = "serdect::slice::deserialize_hex_or_bin_vec"
)]
pub public_key_package: Vec<u8>,
/// The user's encodede key package for the group.
/// The user's encoded key package for the group.
#[serde(
serialize_with = "serdect::slice::serialize_hex_lower_or_bin",
deserialize_with = "serdect::slice::deserialize_hex_or_bin_vec"
)]
pub key_package: Vec<u8>,
/// The server the participants are registered in, if any.
/// The default server the participants are using, if any.
pub server_url: Option<String>,
/// The group participants, keyed by hex-encoded identifier
pub participant: BTreeMap<String, Participant>,
Expand All @@ -109,7 +112,8 @@ impl Group {
let helper = ciphersuite_helper(&self.ciphersuite)?;
let info = helper.group_info(&self.key_package, &self.public_key_package)?;
let mut s = format!(
"Group with public key {}\nServer URL: {}\nThreshold: {}\nParticipants: {}\n",
"Group \"{}\"\nPublic key {}\nServer URL: {}\nThreshold: {}\nParticipants: {}\n",
self.description,
info.hex_verifying_key,
self.server_url.clone().unwrap_or_default(),
info.threshold,
Expand Down
2 changes: 2 additions & 0 deletions frost-client/src/trusted_dealer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub(crate) fn trusted_dealer_for_ciphersuite<C: Ciphersuite + MaybeIntoEvenY + '
) -> Result<(), Box<dyn Error>> {
let Command::TrustedDealer {
config,
description,
ciphersuite: _,
threshold,
num_signers,
Expand Down Expand Up @@ -107,6 +108,7 @@ pub(crate) fn trusted_dealer_for_ciphersuite<C: Ciphersuite + MaybeIntoEvenY + '
let key_package: KeyPackage<C> = share.clone().try_into()?;
let group = Group {
ciphersuite: C::ID.to_string(),
description: description.clone(),
key_package: postcard::to_allocvec(&key_package)?,
public_key_package: postcard::to_allocvec(&public_key_package)?,
participant: participants.clone(),
Expand Down
Loading