CoreCryptoProtocol

public protocol CoreCryptoProtocol

Undocumented

  • historyClient(_:) Asynchronous

    Instantiate a history client.

    This client exposes the full interface of Self, but it should only be used to decrypt messages. Other use is a logic error.

    Declaration

    Swift

    static func historyClient(_ historySecret: HistorySecret) async throws -> Self
  • transaction(_:) Asynchronous

    Starts a transaction in Core Crypto. If the closure succeeds without throwing an error, it will be committed, otherwise, every operation performed with the context will be discarded.

    Declaration

    Swift

    func transaction<Result>(
        _ block: @escaping (_ context: CoreCryptoContextProtocol) async throws -> Result
    ) async throws -> Result

    Parameters

    block

    the closure to be executed within the transaction context. A CoreCryptoContext is provided on which any operations should be performed.

    Return Value

    Result value returned from the closure if any.

  • Register a callback which will be called when performing MLS operations which require communication with the delivery service.

    Declaration

    Swift

    func provideTransport(transport: any MlsTransport) async throws
  • Register an Epoch Observer which will be notified every time a conversation’s epoch changes.

    This function should be called 0 or 1 times in the lifetime of CoreCrypto, regardless of the number of transactions.

    Declaration

    Swift

    func registerEpochObserver(_ epochObserver: EpochObserver) async throws

    Parameters

    epochObserver

    epoch observer to register

  • Register a History Observer which will be notified every time a new history secret is created locally.

    This function should be called 0 or 1 times in the lifetime of CoreCrypto, regardless of the number of transactions.

    Declaration

    Swift

    func registerHistoryObserver(_ historyObserver: HistoryObserver) async throws

    Parameters

    historyObserver

    history observer to register

  • Check if history sharing is enabled, i.e., if any of the conversation members have a ClientId starting with the specific history client prefix.

    Declaration

    Swift

    func isHistorySharingEnabled(conversationId: ConversationId) async throws -> Bool
  • Register CoreCrypto a logger

    Declaration

    Swift

    static func setLogger(_ logger: CoreCryptoLogger)
  • Set the log level limit for logs which should be forwarded to the registered CoreCryptoLogger

    The default log level is info.

    Declaration

    Swift

    static func setMaxLogLevel(_ level: CoreCryptoLogLevel)
  • CoreCrypto build version number

    Declaration

    Swift

    static func version() -> String
  • Build metadata describing under which conditions this version of CoreCrypto was build.

    Declaration

    Swift

    static func buildMetadata() -> BuildMetadata