CoreCryptoFfi
open class CoreCryptoFfi : CoreCryptoFfiProtocol, @unchecked Sendable
CoreCrypto wraps around MLS and Proteus implementations and provides a transactional interface for each.
-
Construct a new
CoreCryptoFfiinstance. MLS or proteus can be initialized with [core_crypto::transaction_context::TransactionContext::mls_init] or [core_crypto::transaction_context::TransactionContext::proteus_init], respectively.Declaration
Swift
public convenience init(database: Database) throws -
conversationCiphersuite(conversationId:Asynchronous) See [core_crypto::mls::conversation::Conversation::ciphersuite]
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) See [core_crypto::mls::conversation::Conversation::epoch]
Declaration
Swift
open func conversationEpoch(conversationId: ConversationId) async throws -> UInt64 -
conversationExists(conversationId:Asynchronous) See [core_crypto::Session::conversation_exists]
Declaration
Swift
open func conversationExists(conversationId: ConversationId) async throws -> Bool -
e2eiConversationState(conversationId:Asynchronous) See [core_crypto::mls::conversation::Conversation::e2ei_conversation_state]
Declaration
Swift
open func e2eiConversationState(conversationId: ConversationId) async throws -> E2eiConversationState -
e2eiIsEnabled(ciphersuite:Asynchronous) See [core_crypto::Session::e2ei_is_enabled]
Declaration
Swift
open func e2eiIsEnabled(ciphersuite: Ciphersuite) async throws -> Bool -
e2eiIsPkiEnvSetup()AsynchronousSee [core_crypto::Session::e2ei_is_pki_env_setup]
Declaration
Swift
open func e2eiIsPkiEnvSetup() async -> Bool -
exportSecretKey(conversationId:AsynchronouskeyLength: ) See [core_crypto::mls::conversation::Conversation::export_secret_key]
Declaration
Swift
open func exportSecretKey(conversationId: ConversationId, keyLength: UInt32) async throws -> Data -
getClientIds(conversationId:Asynchronous) See [core_crypto::mls::conversation::Conversation::get_client_ids]
Declaration
Swift
open func getClientIds(conversationId: ConversationId) async throws -> [ClientId] -
getDeviceIdentities(conversationId:AsynchronousdeviceIds: ) See [core_crypto::mls::conversation::Conversation::get_device_identities]
Declaration
Swift
open func getDeviceIdentities(conversationId: ConversationId, deviceIds: [ClientId]) async throws -> [WireIdentity] -
getExternalSender(conversationId:Asynchronous) See [core_crypto::mls::conversation::Conversation::get_external_sender]
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: ) See [core_crypto::mls::conversation::Conversation::get_user_identities]
Declaration
Swift
open func getUserIdentities(conversationId: ConversationId, userIds: [String]) async throws -> [String : [WireIdentity]] -
isHistorySharingEnabled(conversationId:Asynchronous) See [core_crypto::mls::conversation::Conversation::is_history_sharing_enabled]
Declaration
Swift
open func isHistorySharingEnabled(conversationId: ConversationId) async throws -> Bool -
proteusFingerprint()AsynchronousSee [core_crypto::proteus::ProteusCentral::fingerprint]
Declaration
Swift
open func proteusFingerprint() async throws -> String -
proteusFingerprintLocal(sessionId:Asynchronous) See [core_crypto::proteus::ProteusCentral::fingerprint_local]
Declaration
Swift
open func proteusFingerprintLocal(sessionId: String) async throws -> String -
proteusFingerprintRemote(sessionId:Asynchronous) See [core_crypto::proteus::ProteusCentral::fingerprint_remote]
Declaration
Swift
open func proteusFingerprintRemote(sessionId: String) async throws -> String -
proteusSessionExists(sessionId:Asynchronous) See [core_crypto::proteus::ProteusCentral::session_exists]
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 an 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 -
transaction(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 transaction(command: CoreCryptoCommand) async throws