core_crypto_ffi

Struct CoreCrypto

Source
pub struct CoreCrypto { /* private fields */ }

Implementations§

Source§

impl CoreCrypto

Source

pub async fn transaction( &self, command: Arc<dyn CoreCryptoCommand>, ) -> Result<(), CoreCryptoError>

Starts a new transaction in Core Crypto. If the callback succeeds, it will be committed, otherwise, every operation performed with the context will be discarded.

When calling this function from within Rust, async functions accepting a context implement CoreCryptoCommand, so operations can be defined inline as follows:

β“˜
core_crypto.transaction(Arc::new(|context| async {
    // your implementation here
    Ok(())
}))?;
Source§

impl CoreCrypto

Source

pub async fn new( path: String, key: String, client_id: Option<ClientId>, ciphersuites: Option<Ciphersuites>, nb_key_package: Option<u32>, ) -> Result<Self, CoreCryptoError>

Source

pub async fn mls_init( &self, client_id: ClientId, ciphersuites: Ciphersuites, nb_key_package: Option<u32>, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn mls_generate_keypairs( &self, ciphersuites: Ciphersuites, ) -> Result<Vec<ClientId>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn mls_init_with_client_id( &self, client_id: ClientId, tmp_client_ids: Vec<ClientId>, ciphersuites: Ciphersuites, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn restore_from_disk(&self) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn unload(self: Arc<Self>) -> Result<(), CoreCryptoError>

Source

pub async fn wipe(self: Arc<Self>) -> Result<(), CoreCryptoError>

Source

pub async fn set_callbacks( &self, callbacks: Arc<dyn CoreCryptoCallbacks>, ) -> Result<(), CoreCryptoError>

Source

pub async fn client_public_key( &self, ciphersuite: Ciphersuite, credential_type: MlsCredentialType, ) -> Result<Vec<u8>, CoreCryptoError>

Source

pub async fn client_keypackages( &self, ciphersuite: Ciphersuite, credential_type: MlsCredentialType, amount_requested: u32, ) -> Result<Vec<Vec<u8>>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn client_valid_keypackages_count( &self, ciphersuite: Ciphersuite, credential_type: MlsCredentialType, ) -> Result<u64, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn delete_keypackages( &self, refs: Vec<Vec<u8>>, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn create_conversation( &self, conversation_id: Vec<u8>, creator_credential_type: MlsCredentialType, config: ConversationConfiguration, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn conversation_epoch( &self, conversation_id: Vec<u8>, ) -> Result<u64, CoreCryptoError>

Source

pub async fn conversation_ciphersuite( &self, conversation_id: &ConversationId, ) -> Result<Ciphersuite, CoreCryptoError>

Source

pub async fn process_welcome_message( &self, welcome_message: Vec<u8>, custom_configuration: CustomConfiguration, ) -> Result<WelcomeBundle, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn add_clients_to_conversation( &self, conversation_id: Vec<u8>, key_packages: Vec<Vec<u8>>, ) -> Result<MemberAddedMessages, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn remove_clients_from_conversation( &self, conversation_id: Vec<u8>, clients: Vec<ClientId>, ) -> Result<CommitBundle, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn mark_conversation_as_child_of( &self, child_id: Vec<u8>, parent_id: Vec<u8>, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn update_keying_material( &self, conversation_id: Vec<u8>, ) -> Result<CommitBundle, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn commit_pending_proposals( &self, conversation_id: Vec<u8>, ) -> Result<Option<CommitBundle>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn wipe_conversation( &self, conversation_id: Vec<u8>, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn decrypt_message( &self, conversation_id: Vec<u8>, payload: Vec<u8>, ) -> Result<DecryptedMessage, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn encrypt_message( &self, conversation_id: Vec<u8>, message: Vec<u8>, ) -> Result<Vec<u8>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn conversation_exists( &self, conversation_id: Vec<u8>, ) -> Result<bool, CoreCryptoError>

Source

pub async fn new_add_proposal( &self, conversation_id: Vec<u8>, keypackage: Vec<u8>, ) -> Result<ProposalBundle, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn new_update_proposal( &self, conversation_id: Vec<u8>, ) -> Result<ProposalBundle, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn new_remove_proposal( &self, conversation_id: Vec<u8>, client_id: ClientId, ) -> Result<ProposalBundle, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn new_external_add_proposal( &self, conversation_id: Vec<u8>, epoch: u64, ciphersuite: Ciphersuite, credential_type: MlsCredentialType, ) -> Result<Vec<u8>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn join_by_external_commit( &self, group_info: Vec<u8>, custom_configuration: CustomConfiguration, credential_type: MlsCredentialType, ) -> Result<ConversationInitBundle, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn merge_pending_group_from_external_commit( &self, conversation_id: Vec<u8>, ) -> Result<Option<Vec<BufferedDecryptedMessage>>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn clear_pending_group_from_external_commit( &self, conversation_id: Vec<u8>, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn random_bytes(&self, len: u32) -> Result<Vec<u8>, CoreCryptoError>

Source

pub async fn reseed_rng(&self, seed: Vec<u8>) -> Result<(), CoreCryptoError>

Source

pub async fn commit_accepted( &self, conversation_id: Vec<u8>, ) -> Result<Option<Vec<BufferedDecryptedMessage>>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn clear_pending_proposal( &self, conversation_id: Vec<u8>, proposal_ref: Vec<u8>, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn clear_pending_commit( &self, conversation_id: Vec<u8>, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn get_client_ids( &self, conversation_id: Vec<u8>, ) -> Result<Vec<ClientId>, CoreCryptoError>

Source

pub async fn export_secret_key( &self, conversation_id: Vec<u8>, key_length: u32, ) -> Result<Vec<u8>, CoreCryptoError>

Source

pub async fn get_external_sender( &self, conversation_id: Vec<u8>, ) -> Result<Vec<u8>, CoreCryptoError>

Source§

impl CoreCrypto

Source

pub async fn proteus_init(&self) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn proteus_session_from_prekey( &self, session_id: String, prekey: Vec<u8>, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn proteus_session_from_message( &self, session_id: String, envelope: Vec<u8>, ) -> Result<Vec<u8>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn proteus_session_save( &self, session_id: String, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.

See core_crypto::proteus::ProteusCentral::session_save Note: This isn’t usually needed as persisting sessions happens automatically when decrypting/encrypting messages and initializing Sessions

Source

pub async fn proteus_session_delete( &self, session_id: String, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn proteus_session_exists( &self, session_id: String, ) -> Result<bool, CoreCryptoError>

Source

pub async fn proteus_decrypt( &self, session_id: String, ciphertext: Vec<u8>, ) -> Result<Vec<u8>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn proteus_encrypt( &self, session_id: String, plaintext: Vec<u8>, ) -> Result<Vec<u8>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn proteus_encrypt_batched( &self, sessions: Vec<String>, plaintext: Vec<u8>, ) -> Result<HashMap<String, Vec<u8>>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn proteus_new_prekey( &self, prekey_id: u16, ) -> Result<Vec<u8>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn proteus_new_prekey_auto( &self, ) -> Result<ProteusAutoPrekeyBundle, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn proteus_last_resort_prekey( &self, ) -> Result<Vec<u8>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub fn proteus_last_resort_prekey_id(&self) -> Result<u16, CoreCryptoError>

Source

pub async fn proteus_fingerprint(&self) -> Result<String, CoreCryptoError>

Source

pub async fn proteus_fingerprint_local( &self, session_id: String, ) -> Result<String, CoreCryptoError>

Source

pub async fn proteus_fingerprint_remote( &self, session_id: String, ) -> Result<String, CoreCryptoError>

Source

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

Source

pub async fn proteus_cryptobox_migrate( &self, path: String, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub fn proteus_last_error_code(&self) -> Option<u16>

Returns the latest proteus error code. If 0, no error has occured

NOTE: This will clear the last error code.

Source§

impl CoreCrypto

Source

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>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn e2ei_new_activation_enrollment( &self, display_name: String, handle: String, team: Option<String>, expiry_sec: u32, ciphersuite: Ciphersuite, ) -> Result<E2eiEnrollment, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

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>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn e2ei_dump_pki_env( &self, ) -> Result<Option<E2eiDumpedPkiEnv>, CoreCryptoError>

Source

pub async fn e2ei_is_pki_env_setup(&self) -> bool

Source

pub async fn e2ei_register_acme_ca( &self, trust_anchor_pem: String, ) -> Result<(), CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn e2ei_register_intermediate_ca( &self, cert_pem: String, ) -> Result<Option<Vec<String>>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn e2ei_register_crl( &self, crl_dp: String, crl_der: Vec<u8>, ) -> Result<CrlRegistration, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn e2ei_mls_init_only( &self, enrollment: Arc<E2eiEnrollment>, certificate_chain: String, nb_key_package: Option<u32>, ) -> Result<Option<Vec<String>>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn e2ei_rotate( &self, conversation_id: Vec<u8>, ) -> Result<CommitBundle, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn e2ei_rotate_all( &self, enrollment: Arc<E2eiEnrollment>, certificate_chain: String, new_key_packages_count: u32, ) -> Result<RotateBundle, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn e2ei_enrollment_stash( &self, enrollment: Arc<E2eiEnrollment>, ) -> Result<Vec<u8>, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn e2ei_enrollment_stash_pop( &self, handle: Vec<u8>, ) -> Result<E2eiEnrollment, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn e2ei_conversation_state( &self, conversation_id: Vec<u8>, ) -> Result<E2eiConversationState, CoreCryptoError>

πŸ‘ŽDeprecated: Please create a transaction in Core Crypto and call this method from it.
Source

pub async fn e2ei_is_enabled( &self, ciphersuite: Ciphersuite, ) -> Result<bool, CoreCryptoError>

Source

pub async fn get_device_identities( &self, conversation_id: Vec<u8>, device_ids: Vec<ClientId>, ) -> Result<Vec<WireIdentity>, CoreCryptoError>

Source

pub async fn get_user_identities( &self, conversation_id: Vec<u8>, user_ids: Vec<String>, ) -> Result<HashMap<String, Vec<WireIdentity>>, CoreCryptoError>

Source

pub async fn get_credential_in_use( &self, group_info: Vec<u8>, credential_type: MlsCredentialType, ) -> Result<E2eiConversationState, CoreCryptoError>

Trait Implementations§

Source§

impl Debug for CoreCrypto

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<UT> LiftRef<UT> for CoreCrypto

Source§

impl<UT> LowerError<UT> for CoreCrypto

Source§

fn lower_error(obj: Self) -> RustBuffer

Lower this value for scaffolding function return Read more
Source§

impl<UT> LowerReturn<UT> for CoreCrypto

Source§

type ReturnType = <Arc<CoreCrypto> as LowerReturn<UniFfiTag>>::ReturnType

The type that should be returned by scaffolding functions for this type. Read more
Source§

fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>

Lower the return value from an scaffolding call Read more
Β§

fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>

Lower the return value for failed argument lifts Read more
Source§

impl<UT> TypeId<UT> for CoreCrypto

Source§

const TYPE_ID_META: MetadataBuffer

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> 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, 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

Β§

impl<T> ErasedDestructor for T
where T: 'static,

Β§

impl<T> MaybeSendSync for T