pub struct CoreCryptoContext { /* private fields */ }
Implementations§
Source§impl CoreCryptoContext
impl CoreCryptoContext
Sourcepub async fn e2ei_new_enrollment(
&self,
client_id: String,
display_name: String,
handle: String,
team: Option<String>,
expiry_sec: u32,
ciphersuite: Ciphersuite,
) -> Result<E2eiEnrollment, CoreCryptoError>
pub async fn e2ei_new_enrollment( &self, client_id: String, display_name: String, handle: String, team: Option<String>, expiry_sec: u32, ciphersuite: Ciphersuite, ) -> Result<E2eiEnrollment, CoreCryptoError>
Sourcepub async fn e2ei_new_activation_enrollment(
&self,
display_name: String,
handle: String,
team: Option<String>,
expiry_sec: u32,
ciphersuite: Ciphersuite,
) -> Result<E2eiEnrollment, CoreCryptoError>
pub async fn e2ei_new_activation_enrollment( &self, display_name: String, handle: String, team: Option<String>, expiry_sec: u32, ciphersuite: Ciphersuite, ) -> Result<E2eiEnrollment, CoreCryptoError>
Sourcepub async fn e2ei_new_rotate_enrollment(
&self,
display_name: Option<String>,
handle: Option<String>,
team: Option<String>,
expiry_sec: u32,
ciphersuite: Ciphersuite,
) -> Result<E2eiEnrollment, CoreCryptoError>
pub async fn e2ei_new_rotate_enrollment( &self, display_name: Option<String>, handle: Option<String>, team: Option<String>, expiry_sec: u32, ciphersuite: Ciphersuite, ) -> Result<E2eiEnrollment, CoreCryptoError>
Sourcepub async fn e2ei_register_acme_ca(
&self,
trust_anchor_pem: String,
) -> Result<(), CoreCryptoError>
pub async fn e2ei_register_acme_ca( &self, trust_anchor_pem: String, ) -> Result<(), CoreCryptoError>
Sourcepub async fn e2ei_register_intermediate_ca(
&self,
cert_pem: String,
) -> Result<NewCrlDistributionPoints, CoreCryptoError>
pub async fn e2ei_register_intermediate_ca( &self, cert_pem: String, ) -> Result<NewCrlDistributionPoints, CoreCryptoError>
Sourcepub async fn e2ei_register_crl(
&self,
crl_dp: String,
crl_der: Vec<u8>,
) -> Result<CrlRegistration, CoreCryptoError>
pub async fn e2ei_register_crl( &self, crl_dp: String, crl_der: Vec<u8>, ) -> Result<CrlRegistration, CoreCryptoError>
Sourcepub async fn e2ei_mls_init_only(
&self,
enrollment: Arc<E2eiEnrollment>,
certificate_chain: String,
nb_key_package: Option<u32>,
) -> Result<NewCrlDistributionPoints, CoreCryptoError>
pub async fn e2ei_mls_init_only( &self, enrollment: Arc<E2eiEnrollment>, certificate_chain: String, nb_key_package: Option<u32>, ) -> Result<NewCrlDistributionPoints, CoreCryptoError>
Sourcepub async fn e2ei_rotate(
&self,
conversation_id: Vec<u8>,
) -> Result<(), CoreCryptoError>
pub async fn e2ei_rotate( &self, conversation_id: Vec<u8>, ) -> Result<(), CoreCryptoError>
Sourcepub async fn save_x509_credential(
&self,
enrollment: Arc<E2eiEnrollment>,
certificate_chain: String,
) -> Result<NewCrlDistributionPoints, CoreCryptoError>
pub async fn save_x509_credential( &self, enrollment: Arc<E2eiEnrollment>, certificate_chain: String, ) -> Result<NewCrlDistributionPoints, CoreCryptoError>
Sourcepub async fn delete_stale_key_packages(
&self,
ciphersuite: Ciphersuite,
) -> Result<(), CoreCryptoError>
pub async fn delete_stale_key_packages( &self, ciphersuite: Ciphersuite, ) -> Result<(), CoreCryptoError>
Sourcepub async fn e2ei_enrollment_stash(
&self,
enrollment: Arc<E2eiEnrollment>,
) -> Result<Vec<u8>, CoreCryptoError>
pub async fn e2ei_enrollment_stash( &self, enrollment: Arc<E2eiEnrollment>, ) -> Result<Vec<u8>, CoreCryptoError>
Sourcepub async fn e2ei_enrollment_stash_pop(
&self,
handle: Vec<u8>,
) -> Result<E2eiEnrollment, CoreCryptoError>
pub async fn e2ei_enrollment_stash_pop( &self, handle: Vec<u8>, ) -> Result<E2eiEnrollment, CoreCryptoError>
Sourcepub async fn e2ei_conversation_state(
&self,
conversation_id: Vec<u8>,
) -> Result<E2eiConversationState, CoreCryptoError>
pub async fn e2ei_conversation_state( &self, conversation_id: Vec<u8>, ) -> Result<E2eiConversationState, CoreCryptoError>
See [core_crypto::mls::conversation::conversation_guard::ConversationGuard::e2ei_conversation_state]
pub async fn e2ei_dump_pki_env( &self, ) -> Result<Option<E2eiDumpedPkiEnv>, CoreCryptoError>
Sourcepub async fn e2ei_is_pki_env_setup(&self) -> Result<bool, CoreCryptoError>
pub async fn e2ei_is_pki_env_setup(&self) -> Result<bool, CoreCryptoError>
Sourcepub async fn e2ei_is_enabled(
&self,
ciphersuite: Ciphersuite,
) -> Result<bool, CoreCryptoError>
pub async fn e2ei_is_enabled( &self, ciphersuite: Ciphersuite, ) -> Result<bool, CoreCryptoError>
Sourcepub async fn get_device_identities(
&self,
conversation_id: Vec<u8>,
device_ids: Vec<ClientId>,
) -> Result<Vec<WireIdentity>, CoreCryptoError>
pub async fn get_device_identities( &self, conversation_id: Vec<u8>, device_ids: Vec<ClientId>, ) -> Result<Vec<WireIdentity>, CoreCryptoError>
See [core_crypto::mls::MlsCentral::get_device_identities]
Sourcepub async fn get_user_identities(
&self,
conversation_id: Vec<u8>,
user_ids: Vec<String>,
) -> Result<HashMap<String, Vec<WireIdentity>>, CoreCryptoError>
pub async fn get_user_identities( &self, conversation_id: Vec<u8>, user_ids: Vec<String>, ) -> Result<HashMap<String, Vec<WireIdentity>>, CoreCryptoError>
See [core_crypto::mls::MlsCentral::get_user_identities]
Sourcepub async fn get_credential_in_use(
&self,
group_info: Vec<u8>,
credential_type: MlsCredentialType,
) -> Result<E2eiConversationState, CoreCryptoError>
pub async fn get_credential_in_use( &self, group_info: Vec<u8>, credential_type: MlsCredentialType, ) -> Result<E2eiConversationState, CoreCryptoError>
Source§impl CoreCryptoContext
impl CoreCryptoContext
Sourcepub async fn proteus_init(&self) -> Result<(), CoreCryptoError>
pub async fn proteus_init(&self) -> Result<(), CoreCryptoError>
Sourcepub async fn proteus_session_from_prekey(
&self,
session_id: String,
prekey: Vec<u8>,
) -> Result<(), CoreCryptoError>
pub async fn proteus_session_from_prekey( &self, session_id: String, prekey: Vec<u8>, ) -> Result<(), CoreCryptoError>
Sourcepub async fn proteus_session_from_message(
&self,
session_id: String,
envelope: Vec<u8>,
) -> Result<Vec<u8>, CoreCryptoError>
pub async fn proteus_session_from_message( &self, session_id: String, envelope: Vec<u8>, ) -> Result<Vec<u8>, CoreCryptoError>
Sourcepub async fn proteus_session_save(
&self,
session_id: String,
) -> Result<(), CoreCryptoError>
pub async fn proteus_session_save( &self, session_id: String, ) -> Result<(), CoreCryptoError>
See core_crypto::context::CentralContext::proteus_session_save Note: This isn’t usually needed as persisting sessions happens automatically when decrypting/encrypting messages and initializing Sessions
Sourcepub async fn proteus_session_delete(
&self,
session_id: String,
) -> Result<(), CoreCryptoError>
pub async fn proteus_session_delete( &self, session_id: String, ) -> Result<(), CoreCryptoError>
Sourcepub async fn proteus_session_exists(
&self,
session_id: String,
) -> Result<bool, CoreCryptoError>
pub async fn proteus_session_exists( &self, session_id: String, ) -> Result<bool, CoreCryptoError>
Sourcepub async fn proteus_decrypt(
&self,
session_id: String,
ciphertext: Vec<u8>,
) -> Result<Vec<u8>, CoreCryptoError>
pub async fn proteus_decrypt( &self, session_id: String, ciphertext: Vec<u8>, ) -> Result<Vec<u8>, CoreCryptoError>
Sourcepub async fn proteus_encrypt(
&self,
session_id: String,
plaintext: Vec<u8>,
) -> Result<Vec<u8>, CoreCryptoError>
pub async fn proteus_encrypt( &self, session_id: String, plaintext: Vec<u8>, ) -> Result<Vec<u8>, CoreCryptoError>
Sourcepub async fn proteus_encrypt_batched(
&self,
sessions: Vec<String>,
plaintext: Vec<u8>,
) -> Result<HashMap<String, Vec<u8>>, CoreCryptoError>
pub async fn proteus_encrypt_batched( &self, sessions: Vec<String>, plaintext: Vec<u8>, ) -> Result<HashMap<String, Vec<u8>>, CoreCryptoError>
Sourcepub async fn proteus_new_prekey(
&self,
prekey_id: u16,
) -> Result<Vec<u8>, CoreCryptoError>
pub async fn proteus_new_prekey( &self, prekey_id: u16, ) -> Result<Vec<u8>, CoreCryptoError>
Sourcepub async fn proteus_new_prekey_auto(
&self,
) -> Result<ProteusAutoPrekeyBundle, CoreCryptoError>
pub async fn proteus_new_prekey_auto( &self, ) -> Result<ProteusAutoPrekeyBundle, CoreCryptoError>
Sourcepub async fn proteus_last_resort_prekey(
&self,
) -> Result<Vec<u8>, CoreCryptoError>
pub async fn proteus_last_resort_prekey( &self, ) -> Result<Vec<u8>, CoreCryptoError>
Sourcepub fn proteus_last_resort_prekey_id(&self) -> Result<u16, CoreCryptoError>
pub fn proteus_last_resort_prekey_id(&self) -> Result<u16, CoreCryptoError>
Sourcepub async fn proteus_fingerprint(&self) -> Result<String, CoreCryptoError>
pub async fn proteus_fingerprint(&self) -> Result<String, CoreCryptoError>
Sourcepub async fn proteus_fingerprint_local(
&self,
session_id: String,
) -> Result<String, CoreCryptoError>
pub async fn proteus_fingerprint_local( &self, session_id: String, ) -> Result<String, CoreCryptoError>
Sourcepub async fn proteus_fingerprint_remote(
&self,
session_id: String,
) -> Result<String, CoreCryptoError>
pub async fn proteus_fingerprint_remote( &self, session_id: String, ) -> Result<String, CoreCryptoError>
Sourcepub fn proteus_fingerprint_prekeybundle(
&self,
prekey: Vec<u8>,
) -> Result<String, CoreCryptoError>
pub fn proteus_fingerprint_prekeybundle( &self, prekey: Vec<u8>, ) -> Result<String, CoreCryptoError>
See core_crypto::proteus::ProteusCentral::fingerprint_prekeybundle NOTE: uniffi doesn’t support associated functions, so we have to have the self here
Sourcepub async fn proteus_cryptobox_migrate(
&self,
path: String,
) -> Result<(), CoreCryptoError>
pub async fn proteus_cryptobox_migrate( &self, path: String, ) -> Result<(), CoreCryptoError>
Source§impl CoreCryptoContext
impl CoreCryptoContext
Sourcepub async fn mls_init(
&self,
client_id: ClientId,
ciphersuites: Ciphersuites,
nb_key_package: Option<u32>,
) -> Result<(), CoreCryptoError>
pub async fn mls_init( &self, client_id: ClientId, ciphersuites: Ciphersuites, nb_key_package: Option<u32>, ) -> Result<(), CoreCryptoError>
Sourcepub async fn mls_generate_keypairs(
&self,
ciphersuites: Ciphersuites,
) -> Result<Vec<ClientId>, CoreCryptoError>
pub async fn mls_generate_keypairs( &self, ciphersuites: Ciphersuites, ) -> Result<Vec<ClientId>, CoreCryptoError>
Sourcepub async fn mls_init_with_client_id(
&self,
client_id: ClientId,
tmp_client_ids: Vec<ClientId>,
ciphersuites: Ciphersuites,
) -> Result<(), CoreCryptoError>
pub async fn mls_init_with_client_id( &self, client_id: ClientId, tmp_client_ids: Vec<ClientId>, ciphersuites: Ciphersuites, ) -> Result<(), CoreCryptoError>
Sourcepub async fn client_public_key(
&self,
ciphersuite: Ciphersuite,
credential_type: MlsCredentialType,
) -> Result<Vec<u8>, CoreCryptoError>
pub async fn client_public_key( &self, ciphersuite: Ciphersuite, credential_type: MlsCredentialType, ) -> Result<Vec<u8>, CoreCryptoError>
Sourcepub async fn conversation_epoch(
&self,
conversation_id: Vec<u8>,
) -> Result<u64, CoreCryptoError>
pub async fn conversation_epoch( &self, conversation_id: Vec<u8>, ) -> Result<u64, CoreCryptoError>
See [core_crypto::mls::conversation::ConversationGuard::epoch]
Sourcepub async fn conversation_ciphersuite(
&self,
conversation_id: &ConversationId,
) -> Result<Ciphersuite, CoreCryptoError>
pub async fn conversation_ciphersuite( &self, conversation_id: &ConversationId, ) -> Result<Ciphersuite, CoreCryptoError>
See [core_crypto::mls::conversation::ConversationGuard::ciphersuite]
Sourcepub async fn conversation_exists(
&self,
conversation_id: Vec<u8>,
) -> Result<bool, CoreCryptoError>
pub async fn conversation_exists( &self, conversation_id: Vec<u8>, ) -> Result<bool, CoreCryptoError>
Sourcepub async fn get_client_ids(
&self,
conversation_id: Vec<u8>,
) -> Result<Vec<ClientId>, CoreCryptoError>
pub async fn get_client_ids( &self, conversation_id: Vec<u8>, ) -> Result<Vec<ClientId>, CoreCryptoError>
See [core_crypto::mls::conversation::ImmutableConversation::get_client_ids]
Sourcepub async fn export_secret_key(
&self,
conversation_id: Vec<u8>,
key_length: u32,
) -> Result<Vec<u8>, CoreCryptoError>
pub async fn export_secret_key( &self, conversation_id: Vec<u8>, key_length: u32, ) -> Result<Vec<u8>, CoreCryptoError>
See [core_crypto::mls::conversation::ImmutableConversation::export_secret_key]
Sourcepub async fn get_external_sender(
&self,
conversation_id: Vec<u8>,
) -> Result<Vec<u8>, CoreCryptoError>
pub async fn get_external_sender( &self, conversation_id: Vec<u8>, ) -> Result<Vec<u8>, CoreCryptoError>
See [core_crypto::mls::conversation::ImmutableConversation::get_external_sender]
Sourcepub async fn client_keypackages(
&self,
ciphersuite: Ciphersuite,
credential_type: MlsCredentialType,
amount_requested: u32,
) -> Result<Vec<Vec<u8>>, CoreCryptoError>
pub async fn client_keypackages( &self, ciphersuite: Ciphersuite, credential_type: MlsCredentialType, amount_requested: u32, ) -> Result<Vec<Vec<u8>>, CoreCryptoError>
Sourcepub async fn client_valid_keypackages_count(
&self,
ciphersuite: Ciphersuite,
credential_type: MlsCredentialType,
) -> Result<u64, CoreCryptoError>
pub async fn client_valid_keypackages_count( &self, ciphersuite: Ciphersuite, credential_type: MlsCredentialType, ) -> Result<u64, CoreCryptoError>
Sourcepub async fn delete_keypackages(
&self,
refs: Vec<Vec<u8>>,
) -> Result<(), CoreCryptoError>
pub async fn delete_keypackages( &self, refs: Vec<Vec<u8>>, ) -> Result<(), CoreCryptoError>
Sourcepub async fn create_conversation(
&self,
conversation_id: Vec<u8>,
creator_credential_type: MlsCredentialType,
config: ConversationConfiguration,
) -> Result<(), CoreCryptoError>
pub async fn create_conversation( &self, conversation_id: Vec<u8>, creator_credential_type: MlsCredentialType, config: ConversationConfiguration, ) -> Result<(), CoreCryptoError>
Sourcepub async fn process_welcome_message(
&self,
welcome_message: Vec<u8>,
custom_configuration: CustomConfiguration,
) -> Result<WelcomeBundle, CoreCryptoError>
pub async fn process_welcome_message( &self, welcome_message: Vec<u8>, custom_configuration: CustomConfiguration, ) -> Result<WelcomeBundle, CoreCryptoError>
Sourcepub async fn add_clients_to_conversation(
&self,
conversation_id: Vec<u8>,
key_packages: Vec<Vec<u8>>,
) -> Result<NewCrlDistributionPoints, CoreCryptoError>
pub async fn add_clients_to_conversation( &self, conversation_id: Vec<u8>, key_packages: Vec<Vec<u8>>, ) -> Result<NewCrlDistributionPoints, CoreCryptoError>
See [core_crypto::mls::conversation::conversation_guard::ConversationGuard::add_members]
Sourcepub async fn remove_clients_from_conversation(
&self,
conversation_id: Vec<u8>,
clients: Vec<ClientId>,
) -> Result<(), CoreCryptoError>
pub async fn remove_clients_from_conversation( &self, conversation_id: Vec<u8>, clients: Vec<ClientId>, ) -> Result<(), CoreCryptoError>
See [core_crypto::context::CentralContext::remove_members_from_conversation]
Sourcepub async fn mark_conversation_as_child_of(
&self,
child_id: Vec<u8>,
parent_id: Vec<u8>,
) -> Result<(), CoreCryptoError>
pub async fn mark_conversation_as_child_of( &self, child_id: Vec<u8>, parent_id: Vec<u8>, ) -> Result<(), CoreCryptoError>
Sourcepub async fn update_keying_material(
&self,
conversation_id: Vec<u8>,
) -> Result<(), CoreCryptoError>
pub async fn update_keying_material( &self, conversation_id: Vec<u8>, ) -> Result<(), CoreCryptoError>
See [core_crypto::context::CentralContext::update_keying_material]
Sourcepub async fn commit_pending_proposals(
&self,
conversation_id: Vec<u8>,
) -> Result<(), CoreCryptoError>
pub async fn commit_pending_proposals( &self, conversation_id: Vec<u8>, ) -> Result<(), CoreCryptoError>
See [core_crypto::mls::conversation::conversation_guard::ConversationGuard::commit_pending_proposals]
Sourcepub async fn wipe_conversation(
&self,
conversation_id: Vec<u8>,
) -> Result<(), CoreCryptoError>
pub async fn wipe_conversation( &self, conversation_id: Vec<u8>, ) -> Result<(), CoreCryptoError>
Sourcepub async fn decrypt_message(
&self,
conversation_id: Vec<u8>,
payload: Vec<u8>,
) -> Result<DecryptedMessage, CoreCryptoError>
pub async fn decrypt_message( &self, conversation_id: Vec<u8>, payload: Vec<u8>, ) -> Result<DecryptedMessage, CoreCryptoError>
See [core_crypto::mls::conversation::conversation_guard::ConversationGuard::decrypt_message]
Sourcepub async fn encrypt_message(
&self,
conversation_id: Vec<u8>,
message: Vec<u8>,
) -> Result<Vec<u8>, CoreCryptoError>
pub async fn encrypt_message( &self, conversation_id: Vec<u8>, message: Vec<u8>, ) -> Result<Vec<u8>, CoreCryptoError>
See [core_crypto::mls::conversation::conversation_guard::ConversationGuard::encrypt_message]
Sourcepub async fn join_by_external_commit(
&self,
group_info: Vec<u8>,
custom_configuration: CustomConfiguration,
credential_type: MlsCredentialType,
) -> Result<WelcomeBundle, CoreCryptoError>
pub async fn join_by_external_commit( &self, group_info: Vec<u8>, custom_configuration: CustomConfiguration, credential_type: MlsCredentialType, ) -> Result<WelcomeBundle, CoreCryptoError>
Methods from Deref<Target = CentralContext>§
Sourcepub async fn get_or_create_client_keypackages(
&self,
ciphersuite: MlsCiphersuite,
credential_type: MlsCredentialType,
amount_requested: usize,
) -> Result<Vec<KeyPackage>, Error>
pub async fn get_or_create_client_keypackages( &self, ciphersuite: MlsCiphersuite, credential_type: MlsCredentialType, amount_requested: usize, ) -> Result<Vec<KeyPackage>, Error>
Returns amount_requested
OpenMLS [openmls::key_packages::KeyPackage]s.
Will always return the requested amount as it will generate the necessary (lacking) amount on-the-fly
Note: Keypackage pruning is performed as a first step
§Arguments
amount_requested
- number of KeyPackages to request and fill theKeyPackageBundle
§Return type
A vector of KeyPackageBundle
§Errors
Errors can happen when accessing the KeyStore
Sourcepub async fn client_valid_key_packages_count(
&self,
ciphersuite: MlsCiphersuite,
credential_type: MlsCredentialType,
) -> Result<usize, Error>
pub async fn client_valid_key_packages_count( &self, ciphersuite: MlsCiphersuite, credential_type: MlsCredentialType, ) -> Result<usize, Error>
Returns the count of valid, non-expired, unclaimed keypackages in store for the given MlsCiphersuite and MlsCredentialType
Sourcepub async fn delete_keypackages(
&self,
refs: &[HashReference],
) -> Result<(), Error>
pub async fn delete_keypackages( &self, refs: &[HashReference], ) -> Result<(), Error>
Prunes local KeyPackages after making sure they also have been deleted on the backend side You should only use this after CentralContext::save_x509_credential
Sourcepub async fn set_raw_external_senders(
&self,
cfg: &mut MlsConversationConfiguration,
external_senders: Vec<Vec<u8>>,
) -> Result<(), Error>
pub async fn set_raw_external_senders( &self, cfg: &mut MlsConversationConfiguration, external_senders: Vec<Vec<u8>>, ) -> Result<(), Error>
Parses supplied key from Delivery Service in order to build back an [ExternalSender]
Sourcepub async fn process_raw_welcome_message(
&self,
welcome: Vec<u8>,
custom_cfg: MlsCustomConfiguration,
) -> Result<WelcomeBundle, Error>
pub async fn process_raw_welcome_message( &self, welcome: Vec<u8>, custom_cfg: MlsCustomConfiguration, ) -> Result<WelcomeBundle, Error>
Create a conversation from a TLS serialized MLS Welcome message. The MlsConversationConfiguration
used in this function will be the default implementation.
§Arguments
welcome
- a TLS serialized welcome messageconfiguration
- configuration of the MLS conversation fetched from the Delivery Service
§Return type
This function will return the conversation/group id
§Errors
Sourcepub async fn process_welcome_message(
&self,
welcome: MlsMessageIn,
custom_cfg: MlsCustomConfiguration,
) -> Result<WelcomeBundle, Error>
pub async fn process_welcome_message( &self, welcome: MlsMessageIn, custom_cfg: MlsCustomConfiguration, ) -> Result<WelcomeBundle, Error>
Create a conversation from a received MLS Welcome message
§Arguments
welcome
- aWelcome
message received as a result of a commit adding new members to a groupconfiguration
- configuration of the group/conversation
§Return type
This function will return the conversation/group id
§Errors
Errors can be originating from the KeyStore of from OpenMls:
- if no [openmls::key_packages::KeyPackage] can be read from the KeyStore
- if the message can’t be decrypted
Sourcepub async fn conversation(
&self,
id: &Vec<u8>,
) -> Result<ConversationGuard, Error>
pub async fn conversation( &self, id: &Vec<u8>, ) -> Result<ConversationGuard, Error>
Acquire a conversation guard.
This helper struct permits mutations on a conversation.
Sourcepub async fn join_by_external_commit(
&self,
group_info: VerifiableGroupInfo,
custom_cfg: MlsCustomConfiguration,
credential_type: MlsCredentialType,
) -> Result<WelcomeBundle, Error>
pub async fn join_by_external_commit( &self, group_info: VerifiableGroupInfo, custom_cfg: MlsCustomConfiguration, credential_type: MlsCredentialType, ) -> Result<WelcomeBundle, Error>
Issues an external commit and stores the group in a temporary table. This method is intended for example when a new client wants to join the user’s existing groups. On success this function will return the group id and a message to be fanned out to other clients.
If the Delivery Service accepts the external commit, you have to [PendingConversation::merge] in order to get back a functional MLS group. On the opposite, if it rejects it, you can either retry by just calling again CentralContext::join_by_external_commit.
§Arguments
group_info
- a GroupInfo wrapped in a MLS message. it can be obtained by deserializing a TLS serializedGroupInfo
objectcustom_cfg
- configuration of the MLS conversation fetched from the Delivery Servicecredential_type
- kind of [openmls::prelude::Credential] to use for joining this group. If MlsCredentialType::Basic is chosen and no Credential has been created yet for it, a new one will be generated. When MlsCredentialType::X509 is chosen, it fails when no [openmls::prelude::Credential] has been created for the given Ciphersuite.
§Returns WelcomeBundle
§Errors
Errors resulting from OpenMls, the KeyStore calls and serialization
Sourcepub async fn new_external_add_proposal(
&self,
conversation_id: Vec<u8>,
epoch: GroupEpoch,
ciphersuite: MlsCiphersuite,
credential_type: MlsCredentialType,
) -> Result<MlsMessageOut, Error>
pub async fn new_external_add_proposal( &self, conversation_id: Vec<u8>, epoch: GroupEpoch, ciphersuite: MlsCiphersuite, credential_type: MlsCredentialType, ) -> Result<MlsMessageOut, Error>
Crafts a new external Add proposal. Enables a client outside a group to request addition to this group. For Wire only, the client must belong to an user already in the group
§Arguments
conversation_id
- the group/conversation idepoch
- the current epoch of the group. See [openmls::group::GroupEpoch]ciphersuite
- of the new [openmls::prelude::KeyPackage] to createcredential_type
- of the new [openmls::prelude::KeyPackage] to create
§Return type
Returns a message with the proposal to be add a new client
§Errors
Errors resulting from the creation of the proposal within OpenMls.
Fails when credential_type
is MlsCredentialType::X509 and no Credential has been created
for it beforehand with CentralContext::e2ei_mls_init_only or variants.
Sourcepub async fn new_add_proposal(
&self,
id: &Vec<u8>,
key_package: KeyPackage,
) -> Result<MlsProposalBundle, Error>
pub async fn new_add_proposal( &self, id: &Vec<u8>, key_package: KeyPackage, ) -> Result<MlsProposalBundle, Error>
Creates a new Add proposal
Sourcepub async fn new_remove_proposal(
&self,
id: &Vec<u8>,
client_id: ClientId,
) -> Result<MlsProposalBundle, Error>
pub async fn new_remove_proposal( &self, id: &Vec<u8>, client_id: ClientId, ) -> Result<MlsProposalBundle, Error>
Creates a new Add proposal
Sourcepub async fn new_update_proposal(
&self,
id: &Vec<u8>,
) -> Result<MlsProposalBundle, Error>
pub async fn new_update_proposal( &self, id: &Vec<u8>, ) -> Result<MlsProposalBundle, Error>
Creates a new Add proposal
Sourcepub async fn mls_init(
&self,
identifier: ClientIdentifier,
ciphersuites: Vec<MlsCiphersuite>,
nb_init_key_packages: Option<usize>,
) -> Result<(), Error>
pub async fn mls_init( &self, identifier: ClientIdentifier, ciphersuites: Vec<MlsCiphersuite>, nb_init_key_packages: Option<usize>, ) -> Result<(), Error>
Initializes the MLS client if super::CoreCrypto has previously been initialized with
CoreCrypto::deferred_init
instead of CoreCrypto::new
.
This should stay as long as proteus is supported. Then it should be removed.
Sourcepub async fn mls_generate_keypairs(
&self,
ciphersuites: Vec<MlsCiphersuite>,
) -> Result<Vec<ClientId>, Error>
pub async fn mls_generate_keypairs( &self, ciphersuites: Vec<MlsCiphersuite>, ) -> Result<Vec<ClientId>, Error>
Generates MLS KeyPairs/CredentialBundle with a temporary, random client ID. This method is designed to be used in conjunction with CentralContext::mls_init_with_client_id and represents the first step in this process.
This returns the TLS-serialized identity keys (i.e. the signature keypair’s public key)
Sourcepub async fn mls_init_with_client_id(
&self,
client_id: ClientId,
tmp_client_ids: Vec<ClientId>,
ciphersuites: Vec<MlsCiphersuite>,
) -> Result<(), Error>
pub async fn mls_init_with_client_id( &self, client_id: ClientId, tmp_client_ids: Vec<ClientId>, ciphersuites: Vec<MlsCiphersuite>, ) -> Result<(), Error>
Updates the current temporary Client ID with the newly provided one. This is the second step in the externally-generated clients process
Important: This is designed to be called after CentralContext::mls_generate_keypairs
Sourcepub async fn client_public_key(
&self,
ciphersuite: MlsCiphersuite,
credential_type: MlsCredentialType,
) -> Result<Vec<u8>, Error>
pub async fn client_public_key( &self, ciphersuite: MlsCiphersuite, credential_type: MlsCredentialType, ) -> Result<Vec<u8>, Error>
Sourcepub async fn new_conversation(
&self,
id: &Vec<u8>,
creator_credential_type: MlsCredentialType,
config: MlsConversationConfiguration,
) -> Result<(), Error>
pub async fn new_conversation( &self, id: &Vec<u8>, creator_credential_type: MlsCredentialType, config: MlsConversationConfiguration, ) -> Result<(), Error>
Create a new empty conversation
§Arguments
id
- identifier of the group/conversation (must be unique otherwise the existing group will be overridden)creator_credential_type
- kind of credential the creator wants to create the group withconfig
- configuration of the group/conversation
§Errors
Errors can happen from the KeyStore or from OpenMls for ex if no [openmls::key_packages::KeyPackage] can be found in the KeyStore
Sourcepub async fn conversation_exists(&self, id: &Vec<u8>) -> Result<bool, Error>
pub async fn conversation_exists(&self, id: &Vec<u8>) -> Result<bool, Error>
Checks if a given conversation id exists locally
Sourcepub async fn random_bytes(&self, len: usize) -> Result<Vec<u8>, Error>
pub async fn random_bytes(&self, len: usize) -> Result<Vec<u8>, Error>
Generates a random byte array of the specified size
Sourcepub async fn e2ei_verify_group_state(
&self,
group_info: VerifiableGroupInfo,
) -> Result<E2eiConversationState, Error>
pub async fn e2ei_verify_group_state( &self, group_info: VerifiableGroupInfo, ) -> Result<E2eiConversationState, Error>
Sourcepub async fn get_credential_in_use(
&self,
group_info: VerifiableGroupInfo,
credential_type: MlsCredentialType,
) -> Result<E2eiConversationState, Error>
pub async fn get_credential_in_use( &self, group_info: VerifiableGroupInfo, credential_type: MlsCredentialType, ) -> Result<E2eiConversationState, Error>
Sourcepub async fn e2ei_is_enabled(
&self,
signature_scheme: SignatureScheme,
) -> Result<bool, Error>
pub async fn e2ei_is_enabled( &self, signature_scheme: SignatureScheme, ) -> Result<bool, Error>
Sourcepub async fn e2ei_is_pki_env_setup(&self) -> Result<bool, Error>
pub async fn e2ei_is_pki_env_setup(&self) -> Result<bool, Error>
See MlsCentral::e2ei_is_pki_env_setup. Unlike MlsCentral::e2ei_is_pki_env_setup, this function returns a result.
Sourcepub async fn e2ei_dump_pki_env(&self) -> Result<Option<E2eiDumpedPkiEnv>, Error>
pub async fn e2ei_dump_pki_env(&self) -> Result<Option<E2eiDumpedPkiEnv>, Error>
Sourcepub async fn e2ei_register_acme_ca(
&self,
trust_anchor_pem: String,
) -> Result<(), Error>
pub async fn e2ei_register_acme_ca( &self, trust_anchor_pem: String, ) -> Result<(), Error>
Registers a Root Trust Anchor CA for the use in E2EI processing.
Please note that without a Root Trust Anchor, all validations will fail; So this is the first step to perform after initializing your E2EI client
§Parameters
trust_anchor_pem
- PEM certificate to anchor as a Trust Root
Sourcepub async fn e2ei_register_intermediate_ca_pem(
&self,
cert_pem: String,
) -> Result<NewCrlDistributionPoint, Error>
pub async fn e2ei_register_intermediate_ca_pem( &self, cert_pem: String, ) -> Result<NewCrlDistributionPoint, Error>
Registers an Intermediate CA for the use in E2EI processing.
Please note that a Root Trust Anchor CA is needed to validate Intermediate CAs; You need to have a Root CA registered before calling this
§Parameters
cert_pem
- PEM certificate to register as an Intermediate CA
Sourcepub async fn e2ei_register_crl(
&self,
crl_dp: String,
crl_der: Vec<u8>,
) -> Result<CrlRegistration, Error>
pub async fn e2ei_register_crl( &self, crl_dp: String, crl_der: Vec<u8>, ) -> Result<CrlRegistration, Error>
Registers a CRL for the use in E2EI processing.
Please note that a Root Trust Anchor CA is needed to validate CRLs; You need to have a Root CA registered before calling this
§Parameters
crl_dp
- CRL Distribution Point; Basically the URL you fetched it fromcrl_der
- DER representation of the CRL
§Returns
A CrlRegistration with the dirty state of the new CRL (see struct) and its expiration timestamp
Sourcepub async fn e2ei_new_activation_enrollment(
&self,
display_name: String,
handle: String,
team: Option<String>,
expiry_sec: u32,
ciphersuite: MlsCiphersuite,
) -> Result<E2eiEnrollment, Error>
pub async fn e2ei_new_activation_enrollment( &self, display_name: String, handle: String, team: Option<String>, expiry_sec: u32, ciphersuite: MlsCiphersuite, ) -> Result<E2eiEnrollment, Error>
Generates an E2EI enrollment instance for a “regular” client (with a Basic credential) willing to migrate to E2EI. As a consequence, this method does not support changing the ClientId which should remain the same as the Basic one. Once the enrollment is finished, use the instance in CentralContext::save_x509_credential to save the new credential.
Sourcepub async fn e2ei_new_rotate_enrollment(
&self,
display_name: Option<String>,
handle: Option<String>,
team: Option<String>,
expiry_sec: u32,
ciphersuite: MlsCiphersuite,
) -> Result<E2eiEnrollment, Error>
pub async fn e2ei_new_rotate_enrollment( &self, display_name: Option<String>, handle: Option<String>, team: Option<String>, expiry_sec: u32, ciphersuite: MlsCiphersuite, ) -> Result<E2eiEnrollment, Error>
Generates an E2EI enrollment instance for a E2EI client (with a X509 certificate credential) having to change/rotate their credential, either because the former one is expired or it has been revoked. As a consequence, this method does not support changing neither ClientId which should remain the same as the previous one. It lets you change the DisplayName or the handle if you need to. Once the enrollment is finished, use the instance in CentralContext::save_x509_credential to do the rotation.
Sourcepub async fn save_x509_credential(
&self,
enrollment: &mut E2eiEnrollment,
certificate_chain: String,
) -> Result<NewCrlDistributionPoint, Error>
pub async fn save_x509_credential( &self, enrollment: &mut E2eiEnrollment, certificate_chain: String, ) -> Result<NewCrlDistributionPoint, Error>
Saves a new X509 credential. Requires first having enrolled a new X509 certificate with either CentralContext::e2ei_new_activation_enrollment or CentralContext::e2ei_new_rotate_enrollment.
§Expected actions to perform after this function (in this order)
- Rotate credentials for each conversation in crate::mls::conversation::ConversationGuard::e2ei_rotate
- Generate new key packages with [Client::generate_new_keypackages]
- Use these to replace the stale ones the in the backend
- Delete the stale ones locally using Self::delete_stale_key_packages
- This is the last step because you might still need the old key packages to avoid an orphan welcome message
Sourcepub async fn delete_stale_key_packages(
&self,
cipher_suite: MlsCiphersuite,
) -> Result<(), Error>
pub async fn delete_stale_key_packages( &self, cipher_suite: MlsCiphersuite, ) -> Result<(), Error>
Deletes all key packages whose leaf node’s credential does not match the most recently saved x509 credential with the provided signature scheme.
Sourcepub async fn e2ei_enrollment_stash(
&self,
enrollment: E2eiEnrollment,
) -> Result<Vec<u8>, Error>
pub async fn e2ei_enrollment_stash( &self, enrollment: E2eiEnrollment, ) -> Result<Vec<u8>, Error>
Allows persisting an active enrollment (for example while redirecting the user during OAuth) in order to resume it later with CentralContext::e2ei_enrollment_stash_pop
§Arguments
enrollment
- the enrollment instance to persist
§Returns
A handle for retrieving the enrollment later on
Sourcepub async fn e2ei_enrollment_stash_pop(
&self,
handle: Vec<u8>,
) -> Result<E2eiEnrollment, Error>
pub async fn e2ei_enrollment_stash_pop( &self, handle: Vec<u8>, ) -> Result<E2eiEnrollment, Error>
Fetches the persisted enrollment and deletes it from the keystore
§Arguments
handle
- returned by CentralContext::e2ei_enrollment_stash
Sourcepub async fn e2ei_new_enrollment(
&self,
client_id: ClientId,
display_name: String,
handle: String,
team: Option<String>,
expiry_sec: u32,
ciphersuite: MlsCiphersuite,
) -> Result<E2eiEnrollment, Error>
pub async fn e2ei_new_enrollment( &self, client_id: ClientId, display_name: String, handle: String, team: Option<String>, expiry_sec: u32, ciphersuite: MlsCiphersuite, ) -> Result<E2eiEnrollment, Error>
Creates an enrollment instance with private key material you can use in order to fetch a new x509 certificate from the acme server.
§Parameters
client_id
- client identifier e.g.b7ac11a4-8f01-4527-af88-1c30885a7931:6add501bacd1d90e@example.com
display_name
- human readable name displayed in the application e.g.Smith, Alice M (QA)
handle
- user handle e.g.alice.smith.qa@example.com
expiry_sec
- generated x509 certificate expiry in seconds
Sourcepub async fn e2ei_mls_init_only(
&self,
enrollment: &mut E2eiEnrollment,
certificate_chain: String,
nb_init_key_packages: Option<usize>,
) -> Result<NewCrlDistributionPoint, Error>
pub async fn e2ei_mls_init_only( &self, enrollment: &mut E2eiEnrollment, certificate_chain: String, nb_init_key_packages: Option<usize>, ) -> Result<NewCrlDistributionPoint, Error>
Parses the ACME server response from the endpoint fetching x509 certificates and uses it to initialize the MLS client with a certificate
Sourcepub async fn proteus_init(&self) -> Result<(), Error>
pub async fn proteus_init(&self) -> Result<(), Error>
Initializes the proteus client
Sourcepub async fn proteus_reload_sessions(&self) -> Result<(), Error>
pub async fn proteus_reload_sessions(&self) -> Result<(), Error>
Reloads the sessions from the key store
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or it will do nothing
Sourcepub async fn proteus_session_from_prekey(
&self,
session_id: &str,
prekey: &[u8],
) -> Result<Arc<RwLock<ProteusConversationSession>>, Error>
pub async fn proteus_session_from_prekey( &self, session_id: &str, prekey: &[u8], ) -> Result<Arc<RwLock<ProteusConversationSession>>, Error>
Creates a proteus session from a prekey
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_session_from_message(
&self,
session_id: &str,
envelope: &[u8],
) -> Result<(Arc<RwLock<ProteusConversationSession>>, Vec<u8>), Error>
pub async fn proteus_session_from_message( &self, session_id: &str, envelope: &[u8], ) -> Result<(Arc<RwLock<ProteusConversationSession>>, Vec<u8>), Error>
Creates a proteus session from a Proteus message envelope
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_session_save(&self, session_id: &str) -> Result<(), Error>
pub async fn proteus_session_save(&self, session_id: &str) -> Result<(), Error>
Saves a proteus session in the keystore
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_session_delete(
&self,
session_id: &str,
) -> Result<(), Error>
pub async fn proteus_session_delete( &self, session_id: &str, ) -> Result<(), Error>
Deletes a proteus session from the keystore
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_session(
&self,
session_id: &str,
) -> Result<Option<Arc<RwLock<ProteusConversationSession>>>, Error>
pub async fn proteus_session( &self, session_id: &str, ) -> Result<Option<Arc<RwLock<ProteusConversationSession>>>, Error>
Proteus session accessor
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_session_exists(
&self,
session_id: &str,
) -> Result<bool, Error>
pub async fn proteus_session_exists( &self, session_id: &str, ) -> Result<bool, Error>
Proteus session exists
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_decrypt(
&self,
session_id: &str,
ciphertext: &[u8],
) -> Result<Vec<u8>, Error>
pub async fn proteus_decrypt( &self, session_id: &str, ciphertext: &[u8], ) -> Result<Vec<u8>, Error>
Decrypts a proteus message envelope
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_encrypt(
&self,
session_id: &str,
plaintext: &[u8],
) -> Result<Vec<u8>, Error>
pub async fn proteus_encrypt( &self, session_id: &str, plaintext: &[u8], ) -> Result<Vec<u8>, Error>
Encrypts proteus message for a given session ID
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_encrypt_batched(
&self,
sessions: &[impl AsRef<str>],
plaintext: &[u8],
) -> Result<HashMap<String, Vec<u8>>, Error>
pub async fn proteus_encrypt_batched( &self, sessions: &[impl AsRef<str>], plaintext: &[u8], ) -> Result<HashMap<String, Vec<u8>>, Error>
Encrypts a proteus message for several sessions ID. This is more efficient than other methods as the calls are batched. This also reduces the rountrips when crossing over the FFI
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_new_prekey(&self, prekey_id: u16) -> Result<Vec<u8>, Error>
pub async fn proteus_new_prekey(&self, prekey_id: u16) -> Result<Vec<u8>, Error>
Creates a new Proteus prekey and returns the CBOR-serialized version of the prekey bundle
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_new_prekey_auto(&self) -> Result<(u16, Vec<u8>), Error>
pub async fn proteus_new_prekey_auto(&self) -> Result<(u16, Vec<u8>), Error>
Creates a new Proteus prekey with an automatically incremented ID and returns the CBOR-serialized version of the prekey bundle
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_last_resort_prekey(&self) -> Result<Vec<u8>, Error>
pub async fn proteus_last_resort_prekey(&self) -> Result<Vec<u8>, Error>
Returns the last resort prekey
Sourcepub async fn proteus_fingerprint(&self) -> Result<String, Error>
pub async fn proteus_fingerprint(&self) -> Result<String, Error>
Returns the proteus identity’s public key fingerprint
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_fingerprint_local(
&self,
session_id: &str,
) -> Result<String, Error>
pub async fn proteus_fingerprint_local( &self, session_id: &str, ) -> Result<String, Error>
Returns the proteus identity’s public key fingerprint
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_fingerprint_remote(
&self,
session_id: &str,
) -> Result<String, Error>
pub async fn proteus_fingerprint_remote( &self, session_id: &str, ) -> Result<String, Error>
Returns the proteus identity’s public key fingerprint
Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned
Sourcepub async fn proteus_cryptobox_migrate(&self, path: &str) -> Result<(), Error>
pub async fn proteus_cryptobox_migrate(&self, path: &str) -> Result<(), Error>
Migrates an existing Cryptobox data store (whether a folder or an IndexedDB database) located at path
to the keystore.
The client can then be initialized with CentralContext::proteus_init
Sourcepub async fn mls_provider(&self) -> Result<MlsCryptoProvider, Error>
pub async fn mls_provider(&self) -> Result<MlsCryptoProvider, Error>
Clones all references that the MlsCryptoProvider comprises.
Sourcepub async fn finish(&self) -> Result<(), Error>
pub async fn finish(&self) -> Result<(), Error>
Commits the transaction, meaning it takes all the enqueued operations and persist them into the keystore. After that the internal state is switched to invalid, causing errors if something is called from this object.
Sourcepub async fn abort(&self) -> Result<(), Error>
pub async fn abort(&self) -> Result<(), Error>
Aborts the transaction, meaning it discards all the enqueued operations. After that the internal state is switched to invalid, causing errors if something is called from this object.
Trait Implementations§
Source§impl Deref for CoreCryptoContext
impl Deref for CoreCryptoContext
Source§impl<UT> LiftRef<UT> for CoreCryptoContext
impl<UT> LiftRef<UT> for CoreCryptoContext
type LiftType = Arc<CoreCryptoContext>
Source§impl<UT> LowerError<UT> for CoreCryptoContext
impl<UT> LowerError<UT> for CoreCryptoContext
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for CoreCryptoContext
impl<UT> LowerReturn<UT> for CoreCryptoContext
Source§type ReturnType = <Arc<CoreCryptoContext> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<CoreCryptoContext> as LowerReturn<UniFfiTag>>::ReturnType
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Source§impl<UT> TypeId<UT> for CoreCryptoContext
impl<UT> TypeId<UT> for CoreCryptoContext
const TYPE_ID_META: MetadataBuffer
Auto Trait Implementations§
impl Freeze for CoreCryptoContext
impl !RefUnwindSafe for CoreCryptoContext
impl Send for CoreCryptoContext
impl Sync for CoreCryptoContext
impl Unpin for CoreCryptoContext
impl !UnwindSafe for CoreCryptoContext
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<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