Skip to main content

Tholder

Struct Tholder 

Source
pub struct Tholder { /* private fields */ }
Expand description

Tholder is KERI Signing Threshold Satisfaction struct It evaluates satisfaction based on ordered list of indices of verified signatures where indices correspond to offsets in key list.

Implementations§

Source§

impl Tholder

Source

pub fn new( thold: Option<TholderThold>, limen: Option<Vec<u8>>, sith: Option<TholderSith>, ) -> Result<Self, MatterError>

Creates a new Tholder with the provided threshold

§Arguments
  • thold - Optional computed threshold representation
  • limen - Optional CESR serialized threshold
  • sith - Optional JSON/CBOR/MGPK serializable threshold
§Returns

A new Tholder instance or an error

Source

pub fn process_limen( &mut self, limen: &[u8], strip: Option<bool>, ) -> Result<(), MatterError>

Process limen input

§Arguments
  • limen - CESR encoded qb64 threshold (weighted or unweighted)
  • strip - Optional flag to strip trailing pad bytes
Source

pub fn process_sith(&mut self, sith: TholderSith) -> Result<(), MatterError>

Process attributes for fractionally weighted threshold sith

§Arguments
  • sith - Signing threshold (current or next) expressed as one of the TholderSith variants:
    • Integer: non-negative integer of threshold number (M-of-N threshold)
    • HexString: non-negative hex string of threshold number (M-of-N threshold)
    • SimpleWeights: a single clause of fractional weights
    • ComplexWeights: multiple clauses of fractional weights (AND conditions)
Source

pub fn satisfy(&self, indices: &[usize]) -> bool

Evaluates if the provided verified signature indices satisfy the threshold

§Arguments
  • indices - List of indices of verified signatures
§Returns

True if the indices satisfy the threshold, false otherwise

Source

pub fn weighted(&self) -> bool

Returns whether the threshold is weighted or not

Source

pub fn thold(&self) -> &TholderThold

Returns the parsed threshold

Source

pub fn size(&self) -> usize

Returns the minimum size of keys list

Source

pub fn limen(&self) -> Vec<u8> ⓘ

Returns the CESR serializable threshold

Source

pub fn sith(&self) -> TholderSith

Returns the JSON serializable threshold

Source

pub fn json(&self) -> String

Returns JSON serialization of sith expression

Source

pub fn num(&self) -> Option<usize>

Returns the numeric threshold value if not weighted

Source

pub fn weight(weight_str: &str) -> Result<Rational32, MatterError>

Add the missing ValueError to the MatterError enum

Trait Implementations§

Source§

impl Clone for Tholder

Source§

fn clone(&self) -> Tholder

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 Tholder

Source§

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

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

impl Default for Tholder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Tholder

Source§

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

Formats the value using the given formatter. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more