pub struct KeyPackageBuilder { /* private fields */ }Expand description
Builder that helps creating (and configuring) a KeyPackage.
Implementations§
Source§impl KeyPackageBuilder
impl KeyPackageBuilder
Sourcepub fn key_package_lifetime(self, lifetime: Lifetime) -> Self
pub fn key_package_lifetime(self, lifetime: Lifetime) -> Self
Set the key package lifetime.
Sourcepub fn key_package_extensions(self, extensions: Extensions<KeyPackage>) -> Self
pub fn key_package_extensions(self, extensions: Extensions<KeyPackage>) -> Self
Set the key package extensions.
Sourcepub fn mark_as_last_resort(self) -> Self
pub fn mark_as_last_resort(self) -> Self
Mark the key package as a last-resort key package via a LastResortExtension.
Sourcepub fn leaf_node_capabilities(self, capabilities: Capabilities) -> Self
pub fn leaf_node_capabilities(self, capabilities: Capabilities) -> Self
Set the leaf node capabilities.
Sourcepub fn leaf_node_extensions(self, extensions: Extensions<LeafNode>) -> Self
pub fn leaf_node_extensions(self, extensions: Extensions<LeafNode>) -> Self
Set the leaf node extensions.
Returns an error if one or more of the extensions is invalid in leaf nodes.
Sourcepub fn build(
self,
ciphersuite: Ciphersuite,
provider: &impl OpenMlsProvider,
signer: &impl Signer,
credential_with_key: CredentialWithKey,
) -> Result<KeyPackageBundle, KeyPackageNewError>
pub fn build( self, ciphersuite: Ciphersuite, provider: &impl OpenMlsProvider, signer: &impl Signer, credential_with_key: CredentialWithKey, ) -> Result<KeyPackageBundle, KeyPackageNewError>
Finalize and build the key package.
Sourcepub fn build_vc_batch(
self,
ciphersuite: Ciphersuite,
provider: &impl OpenMlsProvider,
signer: &impl Signer,
credential_with_key: CredentialWithKey,
epoch_id: EpochId,
count: usize,
) -> Result<VcKeyPackageBatch, KeyPackageNewError>
Available on crate feature virtual-clients-draft only.
pub fn build_vc_batch( self, ciphersuite: Ciphersuite, provider: &impl OpenMlsProvider, signer: &impl Signer, credential_with_key: CredentialWithKey, epoch_id: EpochId, count: usize, ) -> Result<VcKeyPackageBatch, KeyPackageNewError>
virtual-clients-draft only.Build a batch of virtual-client KeyPackages a sibling can reproduce.
Allocates a single generation of the key_package operation ratchet for
the emulation epoch identified by epoch_id. For each
key_package_index in 0..count it derives a per-KeyPackage seed
secret from that one operation secret and derives the KeyPackage’s init
key and leaf encryption key from the seed. Each leaf carries an
encrypted DerivationInfo under
VC_COMPONENT_ID
so a sibling can recover the emulation leaf index, generation, and
index.
The operation secret and the seeds are derived under the emulation
epoch’s ciphersuite (the operation tree’s ciphersuite). The init and
leaf-encryption keys are derived from each seed under the KeyPackage’s
own ciphersuite.
Each leaf must declare AppDataDictionary support and list
VC_COMPONENT_ID
in its AppComponents entry, otherwise this returns
VirtualClientsError::AppDataDictionaryNotSupported
or
VirtualClientsError::VcComponentNotListed.
Returns a VcKeyPackageBatch holding the batch’s generation and one
(KeyPackageBundle, KeyPackageInfo) per KeyPackage. Each bundle is also
written to storage so the creating client can process its own Welcomes,
and each
KeyPackageInfo
carries the index the client hands to its sibling.
Returns KeyPackageNewError::EmptyBatch when count is 0, before
loading any state or consuming a generation.
Trait Implementations§
Source§impl Clone for KeyPackageBuilder
impl Clone for KeyPackageBuilder
Source§fn clone(&self) -> KeyPackageBuilder
fn clone(&self) -> KeyPackageBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KeyPackageBuilder
impl Debug for KeyPackageBuilder
Source§impl Default for KeyPackageBuilder
impl Default for KeyPackageBuilder
Source§fn default() -> KeyPackageBuilder
fn default() -> KeyPackageBuilder
Source§impl<'de> Deserialize<'de> for KeyPackageBuilder
impl<'de> Deserialize<'de> for KeyPackageBuilder
Source§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>,
Auto Trait Implementations§
impl Freeze for KeyPackageBuilder
impl RefUnwindSafe for KeyPackageBuilder
impl Send for KeyPackageBuilder
impl Sync for KeyPackageBuilder
impl Unpin for KeyPackageBuilder
impl UnsafeUnpin for KeyPackageBuilder
impl UnwindSafe for KeyPackageBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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