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
impl MlsCentralConfiguration
sourcepub 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>
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 storedidentity_key
- identity key to be used to instantiate the MlsCryptoProviderclient_id
- identifier for the client to be used by MlsCentralciphersuites
- Ciphersuites supported by this deviceentropy
- 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());
sourcepub fn set_entropy(&mut self, entropy: EntropySeed)
pub fn set_entropy(&mut self, entropy: EntropySeed)
Sets the entropy seed
Trait Implementations§
source§impl Clone for MlsCentralConfiguration
impl Clone for MlsCentralConfiguration
source§fn clone(&self) -> MlsCentralConfiguration
fn clone(&self) -> MlsCentralConfiguration
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for MlsCentralConfiguration
impl RefUnwindSafe for MlsCentralConfiguration
impl Send for MlsCentralConfiguration
impl Sync for MlsCentralConfiguration
impl Unpin for MlsCentralConfiguration
impl UnwindSafe for MlsCentralConfiguration
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>
Read moresource§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>
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 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>
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