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 register_epoch_observer( &self, epoch_observer: Arc<dyn EpochObserver>, ) -> Result<(), CoreCryptoError>

Add an epoch observer to this client.

This function should be called 0 or 1 times in a client’s lifetime. If called when an epoch observer already exists, this will return an error.

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 provide_transport( &self, callbacks: Arc<dyn MlsTransport>, ) -> Result<(), CoreCryptoError>

Source

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

Source

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

See [core_crypto::mls::conversation::ImmutableConversation::epoch]

Source

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

See [core_crypto::mls::conversation::ImmutableConversation::ciphersuite]

Source

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

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 get_client_ids( &self, conversation_id: Vec<u8>, ) -> Result<Vec<ClientId>, CoreCryptoError>

See [core_crypto::mls::conversation::ImmutableConversation::get_client_ids]

Source

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]

Source

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

See [core_crypto::mls::conversation::ImmutableConversation::get_external_sender]

Source§

impl CoreCrypto

Source§

impl CoreCrypto

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

See [core_crypto::mls::conversation::ConversationGuard::get_device_identities]

Source

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::conversation::ConversationGuard::get_user_identities]

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