core_crypto

Struct CoreCrypto

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

Wrapper superstruct for both mls::MlsCentral and proteus::ProteusCentral

As std::ops::Deref is implemented, this struct is automatically dereferred to mls::MlsCentral apart from proteus_* calls

Implementations§

Source§

impl CoreCrypto

Source

pub async fn proteus_session( &self, session_id: &str, ) -> Result<Option<Arc<RwLock<ProteusConversationSession>>>>

Proteus session accessor

Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned

Source

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

Proteus session exists

Warning: The Proteus client MUST be initialized with CentralContext::proteus_init first or an error will be returned

Source

pub fn proteus_last_resort_prekey_id() -> u16

Returns the proteus last resort prekey id (u16::MAX = 65535)

Source

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

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

Source

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

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

Source

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

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

Source§

impl CoreCrypto

Source

pub async fn new_transaction(&self) -> Result<CentralContext>

Creates a new transaction. All operations that persist data will be buffered in memory and when CentralContext::finish is called, the data will be persisted in a single database transaction.

Source§

impl CoreCrypto

Source

pub fn take(self) -> MlsCentral

Allows to extract the MLS Client from the wrapper superstruct

Methods from Deref<Target = MlsCentral>§

Source

pub async fn get_raw_conversation( &self, id: &ConversationId, ) -> Result<ImmutableConversation>

Get an immutable view of an MlsConversation.

Because it operates on the raw conversation type, this may be faster than CentralContext::conversation for transient and immutable purposes. For long-lived or mutable purposes, prefer the other method.

Source

pub async fn provide_transport(&self, transport: Arc<dyn MlsTransport>)

Provide the implementation of functions to communicate with the delivery service (see MlsTransport).

Source

pub async fn client_public_key( &self, ciphersuite: MlsCiphersuite, credential_type: MlsCredentialType, ) -> Result<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 authorization
  • credential_type - of the credential to look for
Source

pub async fn client_id(&self) -> Result<ClientId>

Returns the client’s id as a buffer

Source

pub async fn conversation_exists(&self, id: &ConversationId) -> Result<bool>

Checks if a given conversation id exists locally

Source

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

Generates a random byte array of the specified size

Source

pub async fn reseed(&self, seed: Option<EntropySeed>) -> Result<()>

Source

pub async fn e2ei_verify_group_state( &self, group_info: VerifiableGroupInfo, ) -> Result<E2eiConversationState>

Verifies a Group state before joining it

Source

pub async fn get_credential_in_use( &self, group_info: VerifiableGroupInfo, credential_type: MlsCredentialType, ) -> Result<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

pub async fn e2ei_is_enabled( &self, signature_scheme: SignatureScheme, ) -> Result<bool>

Returns true when end-to-end-identity is enabled for the given SignatureScheme

Source

pub async fn e2ei_is_pki_env_setup(&self) -> bool

Returns whether the E2EI PKI environment is setup (i.e. Root CA, Intermediates, CRLs)

Source

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

Dumps the PKI environment as PEM

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 Deref for CoreCrypto

Source§

type Target = MlsCentral

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for CoreCrypto

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl From<MlsCentral> for CoreCrypto

Source§

fn from(mls: MlsCentral) -> Self

Converts to this type from the input type.

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.

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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