CoreCryptoFfiProtocol

public protocol CoreCryptoFfiProtocol : AnyObject, Sendable

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

  • Gets the public key from a [Credential][crate::Credential] which has been added to this client.

    The ciphersuite and credential type act as filters.

    If there exist multiple credentials which match these filters, this returns the one with the latest earliest_validity.

    See [core_crypto::transaction_context::TransactionContext::client_public_key]

    Declaration

    Swift

    func clientPublicKey(ciphersuite: Ciphersuite, credentialType: CredentialType) async throws -> Data
  • See [core_crypto::mls::conversation::Conversation::ciphersuite]

    Declaration

    Swift

    func conversationCiphersuite(conversationId: ConversationId) async throws -> Ciphersuite
  • See [core_crypto::mls::conversation::Conversation::epoch]

    Declaration

    Swift

    func conversationEpoch(conversationId: ConversationId) async throws -> UInt64
  • See [core_crypto::Session::conversation_exists]

    Declaration

    Swift

    func conversationExists(conversationId: ConversationId) async throws -> Bool
  • See [core_crypto::Session::e2ei_is_enabled]

    Declaration

    Swift

    func e2eiIsEnabled(ciphersuite: Ciphersuite) async throws -> Bool
  • e2eiIsPkiEnvSetup() Asynchronous

    See [core_crypto::Session::e2ei_is_pki_env_setup]

    Declaration

    Swift

    func e2eiIsPkiEnvSetup() async -> Bool
  • See [core_crypto::mls::conversation::Conversation::export_secret_key]

    Declaration

    Swift

    func exportSecretKey(conversationId: ConversationId, keyLength: UInt32) async throws -> Data
  • See [core_crypto::mls::conversation::Conversation::get_client_ids]

    Declaration

    Swift

    func getClientIds(conversationId: ConversationId) async throws -> [ClientId]
  • See [core_crypto::mls::conversation::Conversation::get_device_identities]

    Declaration

    Swift

    func getDeviceIdentities(conversationId: ConversationId, deviceIds: [ClientId]) async throws -> [WireIdentity]
  • See [core_crypto::mls::conversation::Conversation::get_external_sender]

    Declaration

    Swift

    func getExternalSender(conversationId: ConversationId) async throws -> Data
  • See [core_crypto::mls::conversation::Conversation::get_user_identities]

    Declaration

    Swift

    func getUserIdentities(conversationId: ConversationId, userIds: [String]) async throws -> [String : [WireIdentity]]
  • See [core_crypto::mls::conversation::Conversation::is_history_sharing_enabled]

    Declaration

    Swift

    func isHistorySharingEnabled(conversationId: ConversationId) async throws -> Bool
  • proteusFingerprint() Asynchronous

    See [core_crypto::proteus::ProteusCentral::fingerprint]

    Declaration

    Swift

    func proteusFingerprint() async throws -> String
  • See [core_crypto::proteus::ProteusCentral::fingerprint_local]

    Declaration

    Swift

    func proteusFingerprintLocal(sessionId: String) async throws -> String
  • See [core_crypto::proteus::ProteusCentral::fingerprint_remote]

    Declaration

    Swift

    func proteusFingerprintRemote(sessionId: String) async throws -> String
  • See [core_crypto::proteus::ProteusCentral::session_exists]

    Declaration

    Swift

    func proteusSessionExists(sessionId: String) async throws -> Bool
  • See [core_crypto::Session::provide_transport]

    Declaration

    Swift

    func provideTransport(callbacks: MlsTransport) async throws
  • 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

    func registerEpochObserver(epochObserver: EpochObserver) async throws
  • 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

    func registerHistoryObserver(historyObserver: HistoryObserver) 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

    func transaction(command: CoreCryptoCommand) async throws