addRecipients method

Map<String, SealdActionStatus> addRecipients(
  1. List<SealdRecipientWithRights> recipients
)

Adds new recipients to this session. These recipients will be able to read all encrypted messages of this session.

recipients - The Seald IDs of users to add to this session. Returns a Map which gives the result of the adding as a SealdActionStatus for each of the added recipient's devices. The keys of the Map correspond to the deviceIds of the recipients you are trying to add.

Implementation

Map<String, SealdActionStatus> addRecipients(
    List<SealdRecipientWithRights> recipients) {
  final Pointer<NativeSealdRecipientsWithRightsArray> nativeRecipients =
      SealdRecipientWithRights._toCArray(recipients);
  final Pointer<Pointer<NativeSealdActionStatusArray>> result =
      calloc<Pointer<NativeSealdActionStatusArray>>();
  final Pointer<Pointer<NativeSealdError>> err =
      calloc<Pointer<NativeSealdError>>();

  final int resultCode = _bindings.SealdEncryptionSession_AddRecipients(
      _ptr.pointer(), nativeRecipients, result, err);

  _bindings.SealdRecipientsWithRightsArray_Free(nativeRecipients);

  if (resultCode != 0) {
    calloc.free(result);
    throw SealdException._fromCPtr(err);
  } else {
    final Map<String, SealdActionStatus> res =
        SealdActionStatus._fromCArray(result.value);
    calloc.free(result);
    calloc.free(err);
    return res;
  }
}