pushJWT method

void pushJWT(
  1. String jwt
)

Pushes a given JWT to the Seald server, for example, to add a connector to the current account.

jwt - The JWT to push.

Implementation

void pushJWT(String jwt) {
  if (_closed) {
    throw SealdException(
        code: "INSTANCE_CLOSED",
        id: "FLUTTER_INSTANCE_CLOSED",
        description: "Instance already closed.");
  }
  final Pointer<Utf8> nativeJwt = jwt.toNativeUtf8();
  final Pointer<Pointer<NativeSealdError>> err =
      calloc<Pointer<NativeSealdError>>();

  final int resultCode =
      _bindings.SealdSdk_PushJWT(_ptr.pointer(), nativeJwt, err);

  calloc.free(nativeJwt);

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