Skip to main content

NormalizedShare

Struct NormalizedShare 

Source
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: String

Source scheme (e.g., “CMP20”, “FROST-P256”, “GG18”).

§quorum_id: String

Quorum identifier.

§party_idx: u32

1-based party index.

§threshold: u32

Threshold T.

§party_count: u32

Total party count N.

§scalar_hex: String

Share scalar (32 bytes, big-endian).

§public_key_hex: String

Joint public key (SEC1 uncompressed, hex).

Implementations§

Source§

impl NormalizedShare

Source

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.

Source

pub fn scalar_bytes(&self) -> Result<Vec<u8>, AdapterError>

Get the share scalar as bytes.

Source

pub fn public_key_bytes(&self) -> Result<Vec<u8>, AdapterError>

Get the public key as bytes.

Source

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).

Source

pub fn to_json(&self) -> Result<String, Error>

Serialize to JSON.

Source

pub fn from_json(json: &str) -> Result<Self, Error>

Deserialize from JSON.

Source

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§

impl Clone for NormalizedShare

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for NormalizedShare

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for NormalizedShare

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for NormalizedShare

Source§

impl PartialEq for NormalizedShare

Source§

fn eq(&self, other: &NormalizedShare) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for NormalizedShare

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for NormalizedShare

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.