searchGroupTMRTemporaryKeys method

SealdListedGroupTMRTemporaryKey searchGroupTMRTemporaryKeys(
  1. String tmrJWT, {
  2. SealdSearchGroupTMRTemporaryKeysOpts? opts,
})

Search group TMR temporary keys that can be used with the TMR JWT.

tmrJWT TMR JWT to use. opts Option to filter the search results. Returns a SealdListedGroupTMRTemporaryKey instance holding the found temporary keys.

Implementation

SealdListedGroupTMRTemporaryKey searchGroupTMRTemporaryKeys(String tmrJWT,
    {SealdSearchGroupTMRTemporaryKeysOpts? opts}) {
  if (_closed) {
    throw SealdException(
        code: "INSTANCE_CLOSED",
        id: "FLUTTER_INSTANCE_CLOSED",
        description: "Instance already closed.");
  }
  final Pointer<Utf8> nativeTmrJWT = tmrJWT.toNativeUtf8();
  final Pointer<NativeSealdSearchGroupTMRTemporaryKeysOpts> nativeOpts =
      opts?._toC() ?? nullptr;

  final Pointer<Int> nbPageFound = calloc<Int>();
  final Pointer<Pointer<NativeSealdGroupTMRTemporaryKeysArray>> result =
      calloc<Pointer<NativeSealdGroupTMRTemporaryKeysArray>>();
  final Pointer<Pointer<NativeSealdError>> err =
      calloc<Pointer<NativeSealdError>>();

  final int resultCode = _bindings.SealdSdk_SearchGroupTMRTemporaryKeys(
      _ptr.pointer(), nativeTmrJWT, nativeOpts, nbPageFound, result, err);

  calloc.free(nativeTmrJWT);
  _bindings.SealdSearchGroupTMRTemporaryKeysOpts_Free(nativeOpts);

  if (resultCode != 0) {
    calloc.free(result);
    throw SealdException._fromCPtr(err);
  } else {
    final SealdListedGroupTMRTemporaryKey gTMRtempKeys =
        SealdListedGroupTMRTemporaryKey._fromC(result.value, nbPageFound);
    calloc.free(result);
    calloc.free(nbPageFound);
    calloc.free(err);
    return gTMRtempKeys;
  }
}