createEncryptionSessionAsync method

Future<SealdEncryptionSession> createEncryptionSessionAsync(
  1. List<SealdRecipientWithRights> recipients, {
  2. String? metadata,
  3. bool useCache = true,
})

Create an encryption session, and returns the associated SealdEncryptionSession instance, with which you can then encrypt/decrypt multiple messages. Warning: if you want to be able to retrieve the session later, you must put your own Seald ID in the recipients argument.

recipients - The Seald IDs of users who should be able to retrieve this session. metadata - Arbitrary metadata string, not encrypted, for later reference. Max 1024 characters long. useCache - Whether or not to use the cache (if enabled globally). Returns the created SealdEncryptionSession instance.

Implementation

Future<SealdEncryptionSession> createEncryptionSessionAsync(
    List<SealdRecipientWithRights> recipients,
    {String? metadata,
    bool useCache = true}) async {
  final _TransferablePointer<NativeSealdEncryptionSession> res =
      await compute(
          (Map<String, dynamic> args) => _createEncryptionSession(
              args["recipients"],
              metadata: args["metadata"],
              useCache: args["useCache"]),
          {
        "recipients": recipients,
        "metadata": metadata,
        "useCache": useCache
      });
  return SealdEncryptionSession._fromC(res.pointer());
}