createAnonymousEncryptionSessionAsync method

Future<SealdAnonymousEncryptionSession> createAnonymousEncryptionSessionAsync(
  1. String encryptionToken,
  2. String getKeysToken,
  3. List<String> recipients, {
  4. List<SealdAnonymousTmrRecipient>? tmrRecipients,
})

Create an anonymous encryption session, and returns the associated SealdAnonymousEncryptionSession instance, with which you can then encrypt/decrypt multiple messages.

encryptionToken - Mandatory. The JWT used for EncryptionSession creation. getKeysToken - Optional. The JWT used for the key retrieval. If not supplied, the key retrieval will use encryptionToken recipients - The Seald IDs of users who should be able to retrieve this session. tmrRecipients - Array of TMR recipients of the session to create. Returns the created SealdAnonymousEncryptionSession instance.

Implementation

Future<SealdAnonymousEncryptionSession> createAnonymousEncryptionSessionAsync(
    String encryptionToken, String getKeysToken, List<String> recipients,
    {List<SealdAnonymousTmrRecipient>? tmrRecipients}) async {
  final _TransferablePointer<NativeSealdAnonymousEncryptionSession> res =
      await compute(
          (Map<String, dynamic> args) => _createAnonymousEncryptionSession(
              args["encryptionToken"],
              args["getKeysToken"],
              args["recipients"],
              tmrRecipients: args["tmrRecipients"]),
          {
        "encryptionToken": encryptionToken,
        "getKeysToken": getKeysToken,
        "recipients": recipients,
        "tmrRecipients": tmrRecipients
      });
  return SealdAnonymousEncryptionSession._fromC(res.pointer());
}