Struct core_crypto::prelude::MlsCentralConfiguration

source ·
#[non_exhaustive]
pub struct MlsCentralConfiguration { pub store_path: String, pub identity_key: String, pub client_id: Option<ClientId>, pub external_entropy: Option<EntropySeed>, pub ciphersuites: Vec<MlsCiphersuite>, pub nb_init_key_packages: Option<usize>, }
Expand description

Configuration parameters for MlsCentral

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§store_path: String

Location where the SQLite/IndexedDB database will be stored

§identity_key: String

Identity key to be used to instantiate the MlsCryptoProvider

§client_id: Option<ClientId>

Identifier for the client to be used by MlsCentral

§external_entropy: Option<EntropySeed>

Entropy pool seed for the internal PRNG

§ciphersuites: Vec<MlsCiphersuite>

All supported ciphersuites

§nb_init_key_packages: Option<usize>

Number of openmls::prelude::KeyPackage to create when creating a MLS client. Default to INITIAL_KEYING_MATERIAL_COUNT

Implementations§

source§

impl MlsCentralConfiguration

source

pub fn try_new( store_path: String, identity_key: String, client_id: Option<ClientId>, ciphersuites: Vec<MlsCiphersuite>, entropy: Option<Vec<u8>>, nb_init_key_packages: Option<usize>, ) -> CryptoResult<Self>

Creates a new instance of the configuration.

§Arguments
  • store_path - location where the SQLite/IndexedDB database will be stored
  • identity_key - identity key to be used to instantiate the MlsCryptoProvider
  • client_id - identifier for the client to be used by MlsCentral
  • ciphersuites - Ciphersuites supported by this device
  • entropy - External source of entropy for platforms where default source insufficient
§Errors

Any empty string parameter will result in a CryptoError::MalformedIdentifier error.

§Examples

This should fail:

use core_crypto::{prelude::MlsCentralConfiguration, CryptoError};

let result = MlsCentralConfiguration::try_new(String::new(), String::new(), Some(b"".to_vec().into()), vec![], None, Some(100));
assert!(matches!(result.unwrap_err(), CryptoError::MalformedIdentifier(_)));

This should work:

use core_crypto::prelude::{MlsCentralConfiguration, CryptoError, MlsCiphersuite};

let result = MlsCentralConfiguration::try_new(
    "/tmp/crypto".to_string(),
    "MY_IDENTITY_KEY".to_string(),
    Some(b"MY_CLIENT_ID".to_vec().into()),
    vec![MlsCiphersuite::default()],
    None,
    Some(100),
);
assert!(result.is_ok());
source

pub fn set_entropy(&mut self, entropy: EntropySeed)

Sets the entropy seed

Trait Implementations§

source§

impl Clone for MlsCentralConfiguration

source§

fn clone(&self) -> MlsCentralConfiguration

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for MlsCentralConfiguration

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, dst: *mut T)

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. 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> 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
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.
§

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

§

fn vzip(self) -> V