CoreCryptoFfiInterface

CoreCrypto wraps around MLS and Proteus implementations and provides a transactional interface for each.

Inheritors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract suspend fun conversationCipherSuite(conversationId: ConversationId): CipherSuite

Returns the cipher_suite in use for the given conversation.

Link copied to clipboard
abstract suspend fun conversationCredential(conversationId: ConversationId): CredentialRef

Get the credential ref for the given conversation.

Link copied to clipboard
abstract suspend fun conversationEpoch(conversationId: ConversationId): ULong

Returns the current MLS epoch of the given conversation.

Link copied to clipboard
abstract suspend fun conversationExists(conversationId: ConversationId): Boolean

Returns true if a conversation with the given id exists in the local state.

Link copied to clipboard
abstract suspend fun e2eiConversationState(conversationId: ConversationId): E2eiConversationState

Returns the end-to-end identity verification state of the given conversation.

Link copied to clipboard
abstract suspend fun e2eiIsEnabled(cipherSuite: CipherSuite): Boolean

Returns true if end-to-end identity is enabled for the given cipher_suite.

Link copied to clipboard
abstract suspend fun e2eiIsPkiEnvSetup(): Boolean

Returns true if the PKI environment has been set up and its provider is configured.

Link copied to clipboard
abstract suspend fun exportSecretKey(conversationId: ConversationId, keyLength: UInt): SecretKey

Derives and exports a secret of key_length bytes for the given conversation.

Link copied to clipboard
abstract suspend fun findCredentials(clientId: ClientId? = null, publicKey: ByteArray? = null, cipherSuite: CipherSuite? = null, credentialType: CredentialType? = null, earliestValidity: ULong? = null): List<CredentialRef>

Get all credentials from this client which match the provided parameters.

Link copied to clipboard
abstract suspend fun getClientIds(conversationId: ConversationId): List<ClientId>

Returns the client ids of all members of the given conversation.

Link copied to clipboard
abstract suspend fun getCredentials(): List<CredentialRef>

Get all credentials from this client.

Link copied to clipboard
abstract suspend fun getDeviceIdentities(conversationId: ConversationId, deviceIds: List<ClientId>): List<WireIdentity>

Returns the E2EI identity claims for the specified devices in the given conversation.

Link copied to clipboard
abstract suspend fun getExternalSender(conversationId: ConversationId): ExternalSender

Returns the external sender for the given conversation.

Link copied to clipboard
abstract suspend fun getPkiEnvironment(): PkiEnvironment?

Get the PKI environment of the CoreCrypto instance.

Link copied to clipboard
abstract suspend fun getUserIdentities(conversationId: ConversationId, userIds: List<Uuid>): Map<Uuid, List<WireIdentity>>

Returns the E2EI identity claims for the specified users in the given conversation, grouped by user ID.

Link copied to clipboard
abstract suspend fun isHistorySharingEnabled(conversationId: ConversationId): Boolean

Returns true if history sharing is currently enabled for the given conversation.

Link copied to clipboard
abstract suspend fun proteusFingerprint(): String

Returns the hex-encoded public key fingerprint of this device's Proteus identity.

Link copied to clipboard
abstract suspend fun proteusFingerprintLocal(sessionId: String): String

Returns the hex-encoded local public key fingerprint for the Proteus session with the given ID.

Link copied to clipboard
abstract suspend fun proteusFingerprintRemote(sessionId: String): String

Returns the hex-encoded remote public key fingerprint for the Proteus session with the given ID.

Link copied to clipboard
abstract suspend fun proteusSessionExists(sessionId: String): Boolean

Returns true if a Proteus session with the given ID exists in local storage.

Link copied to clipboard
abstract suspend fun publicKey(credentialRef: CredentialRef): ByteArray

Get the public key associated with this credential

Link copied to clipboard
abstract suspend fun registerEpochObserver(epochObserver: EpochObserver)

Add an epoch observer to this client.

Link copied to clipboard
abstract suspend fun registerHistoryObserver(historyObserver: HistoryObserver)

Add a history observer to this client.

Link copied to clipboard
abstract suspend fun setPkiEnvironment(pkiEnvironment: PkiEnvironment?)

Set the PKI environment of the CoreCrypto instance.

Link copied to clipboard
abstract suspend fun transactionFfi(command: CoreCryptoCommand)

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.

Link copied to clipboard
abstract suspend fun transactionFfiCancellable(command: CoreCryptoCommand, cancellation: CoreCryptoCancellationToken)

Like transaction_ffi, but cancellable.