pub struct NormalizedShare {
pub scheme: String,
pub quorum_id: String,
pub party_idx: u32,
pub threshold: u32,
pub party_count: u32,
pub scalar_hex: String,
pub public_key_hex: String,
}Expand description
Scheme-agnostic share representation. Any P-256-based threshold scheme share can be normalized to this format.
Fields§
§scheme: StringSource scheme (e.g., “CMP20”, “FROST-P256”, “GG18”).
quorum_id: StringQuorum identifier.
party_idx: u321-based party index.
threshold: u32Threshold T.
party_count: u32Total party count N.
scalar_hex: StringShare scalar (32 bytes, big-endian).
public_key_hex: StringJoint public key (SEC1 uncompressed, hex).
Implementations§
Sourcepub fn new(
scheme: &str,
quorum_id: &str,
party_idx: u32,
threshold: u32,
party_count: u32,
scalar_bytes: &[u8],
public_key_bytes: &[u8],
) -> Result<Self, AdapterError>
pub fn new( scheme: &str, quorum_id: &str, party_idx: u32, threshold: u32, party_count: u32, scalar_bytes: &[u8], public_key_bytes: &[u8], ) -> Result<Self, AdapterError>
Create a new normalized share.
Sourcepub fn scalar_bytes(&self) -> Result<Vec<u8>, AdapterError>
pub fn scalar_bytes(&self) -> Result<Vec<u8>, AdapterError>
Get the share scalar as bytes.
Sourcepub fn public_key_bytes(&self) -> Result<Vec<u8>, AdapterError>
pub fn public_key_bytes(&self) -> Result<Vec<u8>, AdapterError>
Get the public key as bytes.
Sourcepub fn is_compatible_with(&self, other: &NormalizedShare) -> bool
pub fn is_compatible_with(&self, other: &NormalizedShare) -> bool
Check if two shares are from the same quorum and have the same joint public key (i.e., they’re compatible for aggregation).
Sourcepub fn reclassify(self, new_scheme: &str) -> Self
pub fn reclassify(self, new_scheme: &str) -> Self
Rename the scheme. Used when migrating a share from one scheme to another (e.g., “CMP20” → “FROST-P256” after re-sharing).
Trait Implementations§
Source§fn clone(&self) -> NormalizedShare
fn clone(&self) -> NormalizedShare
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§fn eq(&self, other: &NormalizedShare) -> bool
fn eq(&self, other: &NormalizedShare) -> bool
Tests for
self and other values to be equal, and is used by ==.Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more