Trait core_crypto::CoreCryptoCallbacks
source · pub trait CoreCryptoCallbacks:
Debug
+ Send
+ Sync {
// Required methods
fn authorize<'life0, 'async_trait>(
&'life0 self,
conversation_id: ConversationId,
client_id: ClientId,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn user_authorize<'life0, 'async_trait>(
&'life0 self,
conversation_id: ConversationId,
external_client_id: ClientId,
existing_clients: Vec<ClientId>,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn client_is_existing_group_user<'life0, 'async_trait>(
&'life0 self,
conversation_id: ConversationId,
client_id: ClientId,
existing_clients: Vec<ClientId>,
parent_conversation_clients: Option<Vec<ClientId>>,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
This trait is used to provide callback mechanisms for the MlsCentral struct, for example for operations like adding or removing memebers that can be authorized through a caller provided authorization method.
Required Methods§
Function responsible for authorizing an operation.
Returns true
if the operation is authorized.
§Arguments
conversation_id
- id of the group/conversationclient_id
- id of the client to authorize
Function responsible for authorizing an operation for a given user.
Use external_client_id
& existing_clients
to get all the ‘client_id’ belonging to the same user
as external_client_id
. Then, given those client ids, verify that at least one has the right role
(is authorized) exactly like it’s done in Self::authorize
Returns true
if the operation is authorized.
§Arguments
conversation_id
- id of the group/conversationexternal_client_id
- id a client external to the MLS groupexisting_clients
- all the clients in the MLS group
sourcefn client_is_existing_group_user<'life0, 'async_trait>(
&'life0 self,
conversation_id: ConversationId,
client_id: ClientId,
existing_clients: Vec<ClientId>,
parent_conversation_clients: Option<Vec<ClientId>>,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn client_is_existing_group_user<'life0, 'async_trait>(
&'life0 self,
conversation_id: ConversationId,
client_id: ClientId,
existing_clients: Vec<ClientId>,
parent_conversation_clients: Option<Vec<ClientId>>,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Validates if the given client_id
belongs to one of the provided existing_clients
This basically allows to defer the client ID parsing logic to the caller - because CoreCrypto is oblivious to such things
§Arguments
conversation_id
- ID of the conversationclient_id
- client ID of the client referenced within the sent proposalexisting_clients
- all the clients in the MLS group