pub struct MlsCentral { /* private fields */ }
Expand description
The entry point for the MLS CoreCrypto library. This struct provides all functionality to create and manage groups, make proposals and commits.
Implementations§
source§impl MlsCentral
impl MlsCentral
sourcepub async fn export_secret_key(
&self,
conversation_id: &ConversationId,
key_length: usize,
) -> CryptoResult<Vec<u8>>
pub async fn export_secret_key( &self, conversation_id: &ConversationId, key_length: usize, ) -> CryptoResult<Vec<u8>>
Derives a new key from the one in the group, allowing it to be use elsewehere.
§Arguments
conversation_id
- the group/conversation idkey_length
- the length of the key to be derived. If the value is higher than the bounds ofu16
or the context hash * 255, an error will be returned
§Errors
OpenMls secret generation error or conversation not found
sourcepub async fn get_client_ids(
&self,
conversation_id: &ConversationId,
) -> CryptoResult<Vec<ClientId>>
pub async fn get_client_ids( &self, conversation_id: &ConversationId, ) -> CryptoResult<Vec<ClientId>>
source§impl MlsCentral
impl MlsCentral
sourcepub async fn get_external_sender(
&self,
id: &ConversationId,
) -> CryptoResult<Vec<u8>>
pub async fn get_external_sender( &self, id: &ConversationId, ) -> CryptoResult<Vec<u8>>
Returns the raw public key of the single external sender present in this group. This should be used to initialize a subconversation
source§impl MlsCentral
impl MlsCentral
sourcepub async fn try_new(
configuration: MlsCentralConfiguration,
) -> CryptoResult<Self>
pub async fn try_new( configuration: MlsCentralConfiguration, ) -> CryptoResult<Self>
Tries to initialize the MLS Central object. Takes a store path (i.e. Disk location of the embedded database, should be consistent between messaging sessions) And a root identity key (i.e. enclaved encryption key for this device)
§Arguments
configuration
- the configuration for theMlsCentral
§Errors
Failures in the initialization of the KeyStore can cause errors, such as IO, the same kind
of errors can happen when the groups are being restored from the KeyStore or even during
the client initialization (to fetch the identity signature). Other than that, MlsError
can be caused by group deserialization or during the initialization of the credentials:
- for x509 Credentials if the cetificate chain length is lower than 2
- for Basic Credentials if the signature key cannot be generated either by not supported scheme or the key generation fails
sourcepub async fn try_new_in_memory(
configuration: MlsCentralConfiguration,
) -> CryptoResult<Self>
pub async fn try_new_in_memory( configuration: MlsCentralConfiguration, ) -> CryptoResult<Self>
Same as the MlsCentral::try_new but instead, it uses an in memory KeyStore. Although required, the store_path
parameter from the MlsCentralConfiguration
won’t be used here.
sourcepub async fn provide_transport(&self, transport: Arc<dyn MlsTransport>)
pub async fn provide_transport(&self, transport: Arc<dyn MlsTransport>)
Provide the implementation of functions to communicate with the delivery service (see MlsTransport).
sourcepub async fn client_public_key(
&self,
ciphersuite: MlsCiphersuite,
credential_type: MlsCredentialType,
) -> CryptoResult<Vec<u8>>
pub async fn client_public_key( &self, ciphersuite: MlsCiphersuite, credential_type: MlsCredentialType, ) -> CryptoResult<Vec<u8>>
Returns the client’s most recent public signature key as a buffer. Used to upload a public key to the server in order to verify client’s messages signature.
§Arguments
ciphersuite
- a callback to be called to perform authorizationcredential_type
- of the credential to look for
sourcepub async fn client_id(&self) -> CryptoResult<ClientId>
pub async fn client_id(&self) -> CryptoResult<ClientId>
Returns the client’s id as a buffer
sourcepub async fn conversation_exists(
&self,
id: &ConversationId,
) -> CryptoResult<bool>
pub async fn conversation_exists( &self, id: &ConversationId, ) -> CryptoResult<bool>
Checks if a given conversation id exists locally
sourcepub async fn conversation_epoch(&self, id: &ConversationId) -> CryptoResult<u64>
pub async fn conversation_epoch(&self, id: &ConversationId) -> CryptoResult<u64>
sourcepub async fn conversation_ciphersuite(
&self,
id: &ConversationId,
) -> CryptoResult<MlsCiphersuite>
pub async fn conversation_ciphersuite( &self, id: &ConversationId, ) -> CryptoResult<MlsCiphersuite>
sourcepub fn random_bytes(&self, len: usize) -> CryptoResult<Vec<u8>>
pub fn random_bytes(&self, len: usize) -> CryptoResult<Vec<u8>>
Generates a random byte array of the specified size
sourcepub async fn close(self) -> CryptoResult<()>
pub async fn close(self) -> CryptoResult<()>
sourcepub async fn reseed(&self, seed: Option<EntropySeed>) -> CryptoResult<()>
pub async fn reseed(&self, seed: Option<EntropySeed>) -> CryptoResult<()>
source§impl MlsCentral
impl MlsCentral
sourcepub async fn e2ei_verify_group_state(
&self,
group_info: VerifiableGroupInfo,
) -> CryptoResult<E2eiConversationState>
pub async fn e2ei_verify_group_state( &self, group_info: VerifiableGroupInfo, ) -> CryptoResult<E2eiConversationState>
Verifies a Group state before joining it
sourcepub async fn get_credential_in_use(
&self,
group_info: VerifiableGroupInfo,
credential_type: MlsCredentialType,
) -> CryptoResult<E2eiConversationState>
pub async fn get_credential_in_use( &self, group_info: VerifiableGroupInfo, credential_type: MlsCredentialType, ) -> CryptoResult<E2eiConversationState>
Gets the e2ei conversation state from a GroupInfo
. Useful to check if the group has e2ei
turned on or not before joining it.
source§impl MlsCentral
impl MlsCentral
sourcepub async fn e2ei_is_enabled(
&self,
signature_scheme: SignatureScheme,
) -> CryptoResult<bool>
pub async fn e2ei_is_enabled( &self, signature_scheme: SignatureScheme, ) -> CryptoResult<bool>
Returns true when end-to-end-identity is enabled for the given SignatureScheme
source§impl MlsCentral
impl MlsCentral
sourcepub async fn get_device_identities(
&self,
conversation_id: &ConversationId,
client_ids: &[ClientId],
) -> CryptoResult<Vec<WireIdentity>>
pub async fn get_device_identities( &self, conversation_id: &ConversationId, client_ids: &[ClientId], ) -> CryptoResult<Vec<WireIdentity>>
From a given conversation, get the identity of the members supplied. Identity is only present for members with a Certificate Credential (after turning on end-to-end identity). If no member has a x509 certificate, it will return an empty Vec
sourcepub async fn get_user_identities(
&self,
conversation_id: &ConversationId,
user_ids: &[String],
) -> CryptoResult<HashMap<String, Vec<WireIdentity>>>
pub async fn get_user_identities( &self, conversation_id: &ConversationId, user_ids: &[String], ) -> CryptoResult<HashMap<String, Vec<WireIdentity>>>
From a given conversation, get the identity of the users (device holders) supplied. Identity is only present for devices with a Certificate Credential (after turning on end-to-end identity). If no member has a x509 certificate, it will return an empty Vec.
Returns a Map with all the identities for a given users. Consumers are then recommended to reduce those identities to determine the actual status of a user.
source§impl MlsCentral
impl MlsCentral
sourcepub async fn e2ei_is_pki_env_setup(&self) -> bool
pub async fn e2ei_is_pki_env_setup(&self) -> bool
Returns whether the E2EI PKI environment is setup (i.e. Root CA, Intermediates, CRLs)
sourcepub async fn e2ei_dump_pki_env(&self) -> CryptoResult<Option<E2eiDumpedPkiEnv>>
pub async fn e2ei_dump_pki_env(&self) -> CryptoResult<Option<E2eiDumpedPkiEnv>>
Dumps the PKI environment as PEM
Trait Implementations§
source§impl Clone for MlsCentral
impl Clone for MlsCentral
source§fn clone(&self) -> MlsCentral
fn clone(&self) -> MlsCentral
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MlsCentral
impl Debug for MlsCentral
source§impl From<MlsCentral> for CoreCrypto
impl From<MlsCentral> for CoreCrypto
source§fn from(mls: MlsCentral) -> Self
fn from(mls: MlsCentral) -> Self
Auto Trait Implementations§
impl Freeze for MlsCentral
impl !RefUnwindSafe for MlsCentral
impl Send for MlsCentral
impl Sync for MlsCentral
impl Unpin for MlsCentral
impl !UnwindSafe for MlsCentral
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
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)
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
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
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>
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