CoreCryptoContext
open class CoreCryptoContext : CoreCryptoContextProtocol, @unchecked Sendable
                The CoreCryptoContext holds the primary CoreCrypto APIs.
An instance of this struct is provided to the function handed to CoreCrypto::transaction.
Every mutable operation is done through this struct. This struct will buffer all operations in memory and when [TransactionContext::finish] is called, it will persist the data into the keystore.
- 
                  
                  
See [core_crypto::mls::conversation::ConversationGuard::add_members]
Declaration
Swift
open func addClientsToConversation(conversationId: ConversationId, keyPackages: [KeyPackage]) async throws -> [String]? - 
                  
                  
See [core_crypto::transaction_context::TransactionContext::get_or_create_client_keypackages]
Declaration
Swift
open func clientKeypackages(ciphersuite: Ciphersuite, credentialType: CredentialType, amountRequested: UInt32) async throws -> [KeyPackage] - 
                  
clientPublicKey(ciphersuite:AsynchronouscredentialType: ) See [core_crypto::transaction_context::TransactionContext::client_public_key]
Declaration
Swift
open func clientPublicKey(ciphersuite: Ciphersuite, credentialType: CredentialType) async throws -> Data - 
                  
                  
See [core_crypto::transaction_context::TransactionContext::client_valid_key_packages_count]
Declaration
Swift
open func clientValidKeypackagesCount(ciphersuite: Ciphersuite, credentialType: CredentialType) async throws -> UInt64 - 
                  
commitPendingProposals(conversationId:Asynchronous) See [core_crypto::mls::conversation::ConversationGuard::commit_pending_proposals]
Declaration
Swift
open func commitPendingProposals(conversationId: ConversationId) async throws - 
                  
conversationCiphersuite(conversationId:Asynchronous) See [core_crypto::mls::conversation::Conversation::ciphersuite]
Declaration
Swift
open func conversationCiphersuite(conversationId: ConversationId) async throws -> Ciphersuite - 
                  
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::prelude::Session::conversation_exists]
Declaration
Swift
open func conversationExists(conversationId: ConversationId) async throws -> Bool - 
                  
                  
See [core_crypto::transaction_context::TransactionContext::new_conversation]
Declaration
Swift
open func createConversation(conversationId: ConversationId, creatorCredentialType: CredentialType, config: ConversationConfiguration) async throws - 
                  
decryptMessage(conversationId:Asynchronouspayload: ) See [core_crypto::mls::conversation::ConversationGuard::decrypt_message]
Declaration
Swift
open func decryptMessage(conversationId: ConversationId, payload: Data) async throws -> DecryptedMessage - 
                  
deleteStaleKeyPackages(ciphersuite:Asynchronous) See [core_crypto::transaction_context::TransactionContext::delete_stale_key_packages]
Declaration
Swift
open func deleteStaleKeyPackages(ciphersuite: Ciphersuite) async throws - 
                  
disableHistorySharing(conversationId:Asynchronous) See [core_crypto::mls::conversation::ConversationGuard::disable_history_sharing]
Declaration
Swift
open func disableHistorySharing(conversationId: ConversationId) async throws - 
                  
e2eiConversationState(conversationId:Asynchronous) See [core_crypto::mls::conversation::Conversation::e2ei_conversation_state]
Declaration
Swift
open func e2eiConversationState(conversationId: ConversationId) async throws -> E2eiConversationState - 
                  
e2eiEnrollmentStash(enrollment:Asynchronous) See [core_crypto::transaction_context::TransactionContext::e2ei_enrollment_stash]
Note that this can only succeed if the enrollment is unique and there are no other hard refs to it.
Declaration
Swift
open func e2eiEnrollmentStash(enrollment: E2eiEnrollment) async throws -> Data - 
                  
e2eiEnrollmentStashPop(handle:Asynchronous) See [core_crypto::transaction_context::TransactionContext::e2ei_enrollment_stash_pop]
Declaration
Swift
open func e2eiEnrollmentStashPop(handle: Data) async throws -> E2eiEnrollment - 
                  
e2eiIsEnabled(ciphersuite:Asynchronous) See [core_crypto::prelude::Session::e2ei_is_enabled]
Declaration
Swift
open func e2eiIsEnabled(ciphersuite: Ciphersuite) async throws -> Bool - 
                  
e2eiIsPkiEnvSetup()AsynchronousSee [core_crypto::prelude::Session::e2ei_is_pki_env_setup]
Declaration
Swift
open func e2eiIsPkiEnvSetup() async throws -> Bool - 
                  
                  
See [core_crypto::transaction_context::TransactionContext::e2ei_mls_init_only]
Declaration
Swift
open func e2eiMlsInitOnly(enrollment: E2eiEnrollment, certificateChain: String, nbKeyPackage: UInt32?) async throws -> [String]? - 
                  
                  
See [core_crypto::transaction_context::TransactionContext::e2ei_new_activation_enrollment]
Declaration
Swift
open func e2eiNewActivationEnrollment(displayName: String, handle: String, team: String?, expirySec: UInt32, ciphersuite: Ciphersuite) async throws -> E2eiEnrollment - 
                  
                  
See [core_crypto::transaction_context::TransactionContext::e2ei_new_enrollment]
Declaration
Swift
open func e2eiNewEnrollment(clientId: String, displayName: String, handle: String, team: String?, expirySec: UInt32, ciphersuite: Ciphersuite) async throws -> E2eiEnrollment - 
                  
                  
See [core_crypto::transaction_context::TransactionContext::e2ei_new_rotate_enrollment]
Declaration
Swift
open func e2eiNewRotateEnrollment(displayName: String?, handle: String?, team: String?, expirySec: UInt32, ciphersuite: Ciphersuite) async throws -> E2eiEnrollment - 
                  
e2eiRegisterAcmeCa(trustAnchorPem:Asynchronous) See [core_crypto::transaction_context::TransactionContext::e2ei_register_acme_ca]
Declaration
Swift
open func e2eiRegisterAcmeCa(trustAnchorPem: String) async throws - 
                  
e2eiRegisterCrl(crlDp:AsynchronouscrlDer: ) See [core_crypto::transaction_context::TransactionContext::e2ei_register_crl]
Declaration
Swift
open func e2eiRegisterCrl(crlDp: String, crlDer: Data) async throws -> CrlRegistration - 
                  
e2eiRegisterIntermediateCa(certPem:Asynchronous) See [core_crypto::transaction_context::TransactionContext::e2ei_register_intermediate_ca_pem]
Declaration
Swift
open func e2eiRegisterIntermediateCa(certPem: String) async throws -> [String]? - 
                  
e2eiRotate(conversationId:Asynchronous) See [core_crypto::mls::conversation::ConversationGuard::e2ei_rotate]
Declaration
Swift
open func e2eiRotate(conversationId: ConversationId) async throws - 
                  
enableHistorySharing(conversationId:Asynchronous) See [core_crypto::mls::conversation::ConversationGuard::enable_history_sharing]
Declaration
Swift
open func enableHistorySharing(conversationId: ConversationId) async throws - 
                  
encryptMessage(conversationId:Asynchronousmessage: ) See [core_crypto::mls::conversation::ConversationGuard::encrypt_message]
Declaration
Swift
open func encryptMessage(conversationId: ConversationId, message: Data) async throws -> Data - 
                  
exportSecretKey(conversationId:AsynchronouskeyLength: ) See [core_crypto::mls::conversation::Conversation::export_secret_key]
Declaration
Swift
open func exportSecretKey(conversationId: ConversationId, keyLength: UInt32) async throws -> SecretKey - 
                  
getClientIds(conversationId:Asynchronous) See [core_crypto::mls::conversation::Conversation::get_client_ids]
Declaration
Swift
open func getClientIds(conversationId: ConversationId) async throws -> [ClientId] - 
                  
getData()AsynchronousSee [core_crypto::transaction_context::TransactionContext::get_data]
Declaration
Swift
open func getData() async throws -> Data? - 
                  
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 -> ExternalSenderKey - 
                  
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]] - 
                  
                  
See [core_crypto::transaction_context::TransactionContext::join_by_external_commit]
Declaration
Swift
open func joinByExternalCommit(groupInfo: GroupInfo, customConfiguration: CustomConfiguration, credentialType: CredentialType) async throws -> WelcomeBundle - 
                  
markConversationAsChildOf(childId:AsynchronousparentId: ) See [core_crypto::mls::conversation::ConversationGuard::mark_as_child_of]
Declaration
Swift
open func markConversationAsChildOf(childId: ConversationId, parentId: ConversationId) async throws - 
                  
mlsInit(clientId:Asynchronousciphersuites: nbKeyPackage: ) See [core_crypto::transaction_context::TransactionContext::mls_init]
Declaration
Swift
open func mlsInit(clientId: ClientId, ciphersuites: [Ciphersuite], nbKeyPackage: UInt32?) async throws - 
                  
                  
See [core_crypto::transaction_context::TransactionContext::process_raw_welcome_message]
Declaration
Swift
open func processWelcomeMessage(welcomeMessage: Welcome, customConfiguration: CustomConfiguration) async throws -> WelcomeBundle - 
                  
proteusDecrypt(sessionId:Asynchronousciphertext: ) See [core_crypto::transaction_context::TransactionContext::proteus_decrypt]
Declaration
Swift
open func proteusDecrypt(sessionId: String, ciphertext: Data) async throws -> Data - 
                  
proteusDecryptSafe(sessionId:Asynchronousciphertext: ) Decrypt a message whether or not the proteus session already exists, and saves the session.
This is intended to replace simple usages of
proteusDecrypt.However, when decrypting large numbers of messages in a single session, the existing methods may be more efficient.
Declaration
Swift
open func proteusDecryptSafe(sessionId: String, ciphertext: Data) async throws -> Data - 
                  
proteusEncrypt(sessionId:Asynchronousplaintext: ) See [core_crypto::transaction_context::TransactionContext::proteus_encrypt]
Declaration
Swift
open func proteusEncrypt(sessionId: String, plaintext: Data) async throws -> Data - 
                  
proteusEncryptBatched(sessions:Asynchronousplaintext: ) See [core_crypto::transaction_context::TransactionContext::proteus_encrypt_batched]
Declaration
Swift
open func proteusEncryptBatched(sessions: [String], plaintext: Data) async throws -> [String : Data] - 
                  
proteusFingerprint()AsynchronousSee [core_crypto::transaction_context::TransactionContext::proteus_fingerprint]
Declaration
Swift
open func proteusFingerprint() async throws -> String - 
                  
proteusFingerprintLocal(sessionId:Asynchronous) See [core_crypto::transaction_context::TransactionContext::proteus_fingerprint_local]
Declaration
Swift
open func proteusFingerprintLocal(sessionId: String) async throws -> String - 
                  
                  
See [core_crypto::proteus::ProteusCentral::fingerprint_prekeybundle]
Declaration
Swift
open func proteusFingerprintPrekeybundle(prekey: Data) throws -> String - 
                  
proteusFingerprintRemote(sessionId:Asynchronous) See [core_crypto::transaction_context::TransactionContext::proteus_fingerprint_remote]
Declaration
Swift
open func proteusFingerprintRemote(sessionId: String) async throws -> String - 
                  
proteusInit()AsynchronousSee [core_crypto::proteus::ProteusCentral::try_new]
Declaration
Swift
open func proteusInit() async throws - 
                  
proteusLastResortPrekey()AsynchronousSee [core_crypto::transaction_context::TransactionContext::proteus_last_resort_prekey]
Declaration
Swift
open func proteusLastResortPrekey() async throws -> Data - 
                  
                  
See [core_crypto::proteus::ProteusCentral::last_resort_prekey_id]
Declaration
Swift
open func proteusLastResortPrekeyId() throws -> UInt16 - 
                  
proteusNewPrekey(prekeyId:Asynchronous) Creates a new Proteus prekey with the given id and returns the CBOR-serialized version of the prekey bundle
Warning: The Proteus client MUST be initialized with
proteus_initfirst or an error will be returnedSee [core_crypto::transaction_context::TransactionContext::proteus_new_prekey]
Declaration
Swift
open func proteusNewPrekey(prekeyId: UInt16) async throws -> Data - 
                  
proteusNewPrekeyAuto()AsynchronousCreates a new Proteus prekey with an automatically incremented ID and returns the CBOR-serialized version of the prekey bundle
Warning: The Proteus client MUST be initialized with
proteus_initfirst or an error will be returnedSee [core_crypto::transaction_context::TransactionContext::proteus_new_prekey_auto]
Declaration
Swift
open func proteusNewPrekeyAuto() async throws -> ProteusAutoPrekeyBundle - 
                  
proteusReloadSessions()AsynchronousSee [core_crypto::transaction_context::TransactionContext::proteus_reload_sessions]
Declaration
Swift
open func proteusReloadSessions() async throws - 
                  
proteusSessionDelete(sessionId:Asynchronous) See [core_crypto::transaction_context::TransactionContext::proteus_session_delete]
Declaration
Swift
open func proteusSessionDelete(sessionId: String) async throws - 
                  
proteusSessionExists(sessionId:Asynchronous) See [core_crypto::transaction_context::TransactionContext::proteus_session_exists]
Declaration
Swift
open func proteusSessionExists(sessionId: String) async throws -> Bool - 
                  
proteusSessionFromMessage(sessionId:Asynchronousenvelope: ) See [core_crypto::transaction_context::TransactionContext::proteus_session_from_message]
Declaration
Swift
open func proteusSessionFromMessage(sessionId: String, envelope: Data) async throws -> Data - 
                  
proteusSessionFromPrekey(sessionId:Asynchronousprekey: ) See [core_crypto::transaction_context::TransactionContext::proteus_session_from_prekey]
Declaration
Swift
open func proteusSessionFromPrekey(sessionId: String, prekey: Data) async throws - 
                  
proteusSessionSave(sessionId:Asynchronous) See [core_crypto::transaction_context::TransactionContext::proteus_session_save]
Note: This isn’t usually needed as persisting sessions happens automatically when decrypting/encrypting messages and initializing Sessions
Declaration
Swift
open func proteusSessionSave(sessionId: String) async throws - 
                  
randomBytes(len:Asynchronous) See [core_crypto::prelude::Session::random_bytes].
Declaration
Swift
open func randomBytes(len: UInt32) async throws -> Data - 
                  
                  
See [core_crypto::mls::conversation::ConversationGuard::remove_members]
Declaration
Swift
open func removeClientsFromConversation(conversationId: ConversationId, clients: [ClientId]) async throws - 
                  
saveX509Credential(enrollment:AsynchronouscertificateChain: ) See [core_crypto::transaction_context::TransactionContext::save_x509_credential]
Declaration
Swift
open func saveX509Credential(enrollment: E2eiEnrollment, certificateChain: String) async throws -> [String]? - 
                  
setData(data:Asynchronous) See [core_crypto::transaction_context::TransactionContext::set_data]
Declaration
Swift
open func setData(data: Data) async throws - 
                  
updateKeyingMaterial(conversationId:Asynchronous) See [core_crypto::mls::conversation::ConversationGuard::update_key_material]
Declaration
Swift
open func updateKeyingMaterial(conversationId: ConversationId) async throws - 
                  
wipeConversation(conversationId:Asynchronous) See [core_crypto::mls::conversation::ConversationGuard::wipe]
Declaration
Swift
open func wipeConversation(conversationId: ConversationId) async throws