CoreCryptoProtocol
public protocol CoreCryptoProtocol
Defines the protocol for a client.
-
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 -> ResultParameters
blockthe closure to be executed within the transaction context. A
CoreCryptoContextis provided on which any operations should be performed.Return Value
Result value returned from the closure if any.
-
provideTransport(transport:Asynchronous) 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 -
registerEpochObserver(_:Asynchronous) 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 throwsParameters
epochObserverepoch observer to register
-
registerHistoryObserver(_:Asynchronous) 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 throwsParameters
historyObserverhistory observer to register
-
isHistorySharingEnabled(conversationId:Asynchronous) Check if history sharing is enabled, i.e., if any of the conversation members have a
ClientIdstarting with the specific history client prefix.Declaration
Swift
func isHistorySharingEnabled(conversationId: ConversationId) async throws -> Bool