CoreCryptoFfi

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

Constructors

Link copied to clipboard
constructor(pointer: Pointer)
constructor(noPointer: NoPointer)

This constructor can be used to instantiate a fake object. Only used for tests. Any attempt to actually use an object constructed this way will fail as there is no connected Rust object.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open suspend override fun conversationCiphersuite(conversationId: ConversationId): Ciphersuite

Returns the ciphersuite in use for the given conversation.

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

Get the credential ref for the given conversation.

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

Returns the current MLS epoch of the given conversation.

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

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

Link copied to clipboard
open override fun destroy()
Link copied to clipboard
open suspend override fun e2eiConversationState(conversationId: ConversationId): E2eiConversationState

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

Link copied to clipboard
open suspend override fun e2eiIsEnabled(ciphersuite: Ciphersuite): Boolean

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

Link copied to clipboard
open suspend override fun e2eiIsPkiEnvSetup(): Boolean

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

Link copied to clipboard
open suspend override fun exportSecretKey(conversationId: ConversationId, keyLength: UInt): ByteArray

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

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

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

Link copied to clipboard
open suspend override 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
open suspend override fun getExternalSender(conversationId: ConversationId): ByteArray

Returns the serialized public key of the external sender for the given conversation.

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

Get the PKI environment of the CoreCrypto instance.

Link copied to clipboard
open suspend override fun getUserIdentities(conversationId: ConversationId, userIds: List<String>): Map<String, List<WireIdentity>>

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

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

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

Link copied to clipboard

Wrap a CoreCryptoFfi instance in a CoreCrypto instance. Should largely be invisible to end-users.

Link copied to clipboard
open suspend override fun proteusFingerprint(): String

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

Link copied to clipboard
open suspend override 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
open suspend override 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
open suspend override fun proteusSessionExists(sessionId: String): Boolean

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

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

Add an epoch observer to this client.

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

Add a history observer to this client.

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

Set the PKI environment of the CoreCrypto instance.

Link copied to clipboard
open suspend override 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
fun uniffiClonePointer(): Pointer