revokeRecipients method

SealdRevokeResult revokeRecipients({
  1. List<String>? recipientsIds,
  2. List<String>? proxySessionsIds,
})

Revokes some recipients or proxy sessions from this session. If you want to revoke all recipients, see SealdEncryptionSession.revokeAll instead. If you want to revoke all recipients besides yourself, see SealdEncryptionSession.revokeOthers.

recipientsIds - The Seald IDs of users to revoke from this session. proxySessionsIds - The IDs of proxy sessions to revoke from this session. Returns a SealdRevokeResult.

Implementation

SealdRevokeResult revokeRecipients(
    {List<String>? recipientsIds, List<String>? proxySessionsIds}) {
  final Pointer<NativeSealdStringArray> nativeRecipientsIds =
      _sealdStringArrayFromList(recipientsIds);
  final Pointer<NativeSealdStringArray> nativeProxySessionsIds =
      _sealdStringArrayFromList(proxySessionsIds);
  final Pointer<Pointer<NativeSealdRevokeResult>> result =
      calloc<Pointer<NativeSealdRevokeResult>>();
  final Pointer<Pointer<NativeSealdError>> err =
      calloc<Pointer<NativeSealdError>>();

  final int resultCode = _bindings.SealdEncryptionSession_RevokeRecipients(
      _ptr.pointer(),
      nativeRecipientsIds,
      nativeProxySessionsIds,
      result,
      err);

  if (nativeRecipientsIds != nullptr) {
    _bindings.SealdStringArray_Free(nativeRecipientsIds);
  }
  if (nativeProxySessionsIds != nullptr) {
    _bindings.SealdStringArray_Free(nativeProxySessionsIds);
  }

  if (resultCode != 0) {
    calloc.free(result);
    throw SealdException._fromCPtr(err);
  } else {
    final SealdRevokeResult res = SealdRevokeResult._fromC(result.value);
    calloc.free(result);
    calloc.free(err);
    return res;
  }
}