Skip to main content

VcKeyPackageBatchBuilder

Struct VcKeyPackageBatchBuilder 

Source
pub struct VcKeyPackageBatchBuilder { /* private fields */ }
Available on crate feature virtual-clients-draft and (32-bit or 64-bit) only.
Expand description

A builder for a batch of virtual-client KeyPackages a sibling can reproduce.

Allows to build heterogeneous batch of key packages, e.g. non-last-resort and last-restort, or packages with different ciphersuits. Return the batch on Self::finalize. Dropping the builder without calling finalize burns no generation.

Implementations§

Source§

impl VcKeyPackageBatchBuilder

Source

pub fn new( provider: &impl OpenMlsProvider, epoch_id: EpochId, ) -> Result<Self, KeyPackageNewError>

Load emulation epoch and allocate the next generation of the key package operation ratchet.

Nothing is persisted yet. Dropping the builder without calling finalize burns no generation.

Source

pub fn with_capacity( provider: &impl OpenMlsProvider, epoch_id: EpochId, capacity: usize, ) -> Result<Self, KeyPackageNewError>

Same as Self::new, but with a capacity hint for the number of key packages.

Source

pub fn add_key_package( &mut self, builder: KeyPackageBuilder, ciphersuite: Ciphersuite, crypto: &impl OpenMlsCrypto, signer: &impl Signer, credential_with_key: CredentialWithKey, ) -> Result<&KeyPackageInfo, KeyPackageNewError>

Build one key package at the next index.

The key package builder carries the per-step config: key package extensions (incl. last resort), leaf node extensions, capabilities, lifetime.

If building fails, the builder is left in a valid state:

  • No storage is touched
  • No generation is burned
  • The failed index isn’t consumed
Source

pub fn finalize( self, provider: &impl OpenMlsProvider, ) -> Result<VcKeyPackageBatch, KeyPackageNewError>

Finalize the batch.

Persists the operation tree and the key packages. The operation is not atomic. On failure, the generation should be considered as burned. Few orphaned key packages may be left in storage.

Trait Implementations§

Source§

impl Debug for VcKeyPackageBatchBuilder

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Classify for T

§

type Classified = T

§

fn classify(self) -> T

§

impl<T> Declassify for T

§

type Declassified = T

§

fn declassify(self) -> T

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

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

§

fn vzip(self) -> V