CoreCryptoFfi
open class CoreCryptoFfi : CoreCryptoFfiProtocol, @unchecked Sendable
CoreCrypto wraps around MLS and Proteus implementations and provides a transactional interface for each.
-
conversationCiphersuite(conversationId:Asynchronous) Returns the ciphersuite in use for the given conversation.
Declaration
Swift
open func conversationCiphersuite(conversationId: ConversationId) async throws -> Ciphersuite -
conversationCredential(conversationId:Asynchronous) Get the credential ref for the given conversation.
Declaration
Swift
open func conversationCredential(conversationId: ConversationId) async throws -> CredentialRef -
conversationEpoch(conversationId:Asynchronous) Returns the current MLS epoch of the given conversation.
Declaration
Swift
open func conversationEpoch(conversationId: ConversationId) async throws -> UInt64 -
conversationExists(conversationId:Asynchronous) Returns true if a conversation with the given id exists in the local state.
Declaration
Swift
open func conversationExists(conversationId: ConversationId) async throws -> Bool -
e2eiConversationState(conversationId:Asynchronous) Returns the end-to-end identity verification state of the given conversation.
Declaration
Swift
open func e2eiConversationState(conversationId: ConversationId) async throws -> E2eiConversationState -
e2eiIsEnabled(ciphersuite:Asynchronous) Returns true if end-to-end identity is enabled for the given ciphersuite.
Declaration
Swift
open func e2eiIsEnabled(ciphersuite: Ciphersuite) async throws -> Bool -
e2eiIsPkiEnvSetup()AsynchronousReturns true if the PKI environment has been set up and its provider is configured.
Declaration
Swift
open func e2eiIsPkiEnvSetup() async -> Bool -
exportSecretKey(conversationId:AsynchronouskeyLength: ) Derives and exports a secret of
key_lengthbytes for the given conversation.The secret is derived from the MLS key schedule’s exporter mechanism (RFC 9420 §8.5), which produces output bound to the current group state and epoch. The exported value changes whenever the epoch advances.
Declaration
Swift
open func exportSecretKey(conversationId: ConversationId, keyLength: UInt32) async throws -> Data -
getClientIds(conversationId:Asynchronous) Returns the client ids of all members of the given conversation.
Declaration
Swift
open func getClientIds(conversationId: ConversationId) async throws -> [ClientId] -
getDeviceIdentities(conversationId:AsynchronousdeviceIds: ) Returns the E2EI identity claims for the specified devices in the given conversation.
Declaration
Swift
open func getDeviceIdentities(conversationId: ConversationId, deviceIds: [ClientId]) async throws -> [WireIdentity] -
getExternalSender(conversationId:Asynchronous) Returns the serialized public key of the external sender for the given conversation.
Declaration
Swift
open func getExternalSender(conversationId: ConversationId) async throws -> Data -
getPkiEnvironment()AsynchronousGet the PKI environment of the CoreCrypto instance.
Returns null if it is not set.
Declaration
Swift
open func getPkiEnvironment() async -> PkiEnvironment? -
getUserIdentities(conversationId:AsynchronoususerIds: ) Returns the E2EI identity claims for the specified users in the given conversation, grouped by user ID.
Declaration
Swift
open func getUserIdentities(conversationId: ConversationId, userIds: [String]) async throws -> [String : [WireIdentity]] -
isHistorySharingEnabled(conversationId:Asynchronous) Returns true if history sharing is currently enabled for the given conversation.
Declaration
Swift
open func isHistorySharingEnabled(conversationId: ConversationId) async throws -> Bool -
proteusFingerprint()AsynchronousReturns the hex-encoded public key fingerprint of this device’s Proteus identity.
Declaration
Swift
open func proteusFingerprint() async throws -> String -
proteusFingerprintLocal(sessionId:Asynchronous) Returns the hex-encoded local public key fingerprint for the Proteus session with the given ID.
Declaration
Swift
open func proteusFingerprintLocal(sessionId: String) async throws -> String -
proteusFingerprintRemote(sessionId:Asynchronous) Returns the hex-encoded remote public key fingerprint for the Proteus session with the given ID.
Declaration
Swift
open func proteusFingerprintRemote(sessionId: String) async throws -> String -
proteusSessionExists(sessionId:Asynchronous) Returns true if a Proteus session with the given ID exists in local storage.
Declaration
Swift
open func proteusSessionExists(sessionId: String) async throws -> Bool -
registerEpochObserver(epochObserver:Asynchronous) Add an epoch observer to this client.
This function should be called 0 or 1 times in a session’s lifetime. If called when an epoch observer already exists, this will return an error.
Declaration
Swift
open func registerEpochObserver(epochObserver: EpochObserver) async throws -
registerHistoryObserver(historyObserver:Asynchronous) Add a history observer to this client.
This function should be called 0 or 1 times in a session’s lifetime. If called when a history observer already exists, this will return an error.
Declaration
Swift
open func registerHistoryObserver(historyObserver: HistoryObserver) async throws -
setPkiEnvironment(pkiEnvironment:Asynchronous) Set the PKI environment of the CoreCrypto instance.
Declaration
Swift
open func setPkiEnvironment(pkiEnvironment: PkiEnvironment?) async throws -
transactionFfi(command:Asynchronous) 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(async |context| { // your implementation here Ok(()) }))?;Declaration
Swift
open func transactionFfi(command: CoreCryptoCommand) async throws