addProxySession method

void addProxySession(
  1. String proxySessionId, [
  2. SealdRecipientRights? rights
])

Add a proxy session as a recipient of this session. Any recipient of the proxy session will also be able to retrieve this session. The current user has to be a direct recipient of the proxy session.

proxySessionId - The ID of the session to add as proxy. rights - The rights to assign to this proxy.

Implementation

void addProxySession(String proxySessionId, [SealdRecipientRights? rights]) {
  final Pointer<Utf8> nativeProxySessionId = proxySessionId.toNativeUtf8();
  final Pointer<Pointer<NativeSealdError>> err =
      calloc<Pointer<NativeSealdError>>();

  final SealdRecipientRights currentRights = rights ?? SealdRecipientRights();
  final int resultCode = _bindings.SealdEncryptionSession_AddProxySession(
      _ptr.pointer(),
      nativeProxySessionId,
      currentRights.read ? 1 : 0,
      currentRights.forward ? 1 : 0,
      currentRights.revoke ? 1 : 0,
      err);

  calloc.free(nativeProxySessionId);

  if (resultCode != 0) {
    throw SealdException._fromCPtr(err);
  } else {
    calloc.free(err);
  }
}