pub struct SsaBuilder<S: PixSpec> {
pub full_commitment: PixGroup<S>,
num_polys: usize,
target_useful_shares: u64,
builder: PixScalar<S>,
received_indices: HashSet<PolynomialIndex>,
early_notified: bool,
}Expand description
Reconstruct a single SSA from a set of SSA parts recovered from polynomials.
Fields§
§full_commitment: PixGroup<S>§num_polys: usizeCarried from the negotiated PixParams rather than recomputed. See
SsaCommitmentBuilder::target_useful_shares.
builder: PixScalar<S>§received_indices: HashSet<PolynomialIndex>§early_notified: boolImplementations§
Source§impl<S: PixSpec> SsaBuilder<S>
impl<S: PixSpec> SsaBuilder<S>
pub fn new( full_commitment: PixGroup<S>, exit_secret_scalar: PixScalar<S>, num_polys: usize, target_useful_shares: u64, ) -> Self
Useful shares that constitute full recovery, as negotiated.
Sourcepub fn check_early_threshold(&mut self, threshold: f64) -> bool
pub fn check_early_threshold(&mut self, threshold: f64) -> bool
Returns true once, when the number of received polynomial parts reaches
ceil(threshold * num_polys) for the first time. Subsequent calls return
false (idempotent guard — fires at most once per SSA lifecycle).
threshold is assumed finite, which
validate_early_recovery_threshold is what makes
true — SsaReconstructorConfig is the only source of it, and its constructor validates. The
cast below is why that matters rather than being a formality: NaN survives the multiply and
the ceil, then saturates to 0, so an unvalidated threshold fires this on the first part
instead of the configured fraction of them.
pub fn add_recovered_ssa_part( &mut self, index: PolynomialIndex, sub_secret: PixScalar<S>, ) -> Result<Option<PixScalar<S>>, S::Pseudonym>
Auto Trait Implementations§
impl<S> Freeze for SsaBuilder<S>
impl<S> RefUnwindSafe for SsaBuilder<S>where
<<S as PixSpec>::Curve as CurveArithmetic>::ProjectivePoint: RefUnwindSafe,
<<S as PixSpec>::Curve as CurveArithmetic>::Scalar: RefUnwindSafe,
impl<S> Send for SsaBuilder<S>
impl<S> Sync for SsaBuilder<S>
impl<S> Unpin for SsaBuilder<S>
impl<S> UnsafeUnpin for SsaBuilder<S>where
<<S as PixSpec>::Curve as CurveArithmetic>::ProjectivePoint: UnsafeUnpin,
<<S as PixSpec>::Curve as CurveArithmetic>::Scalar: UnsafeUnpin,
impl<S> UnwindSafe for SsaBuilder<S>where
<<S as PixSpec>::Curve as CurveArithmetic>::ProjectivePoint: UnwindSafe,
<<S as PixSpec>::Curve as CurveArithmetic>::Scalar: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more