exportIdentity method
Exports the current device as an identity export.
Returns a Uint8List containing the identity export of the current identity of this SDK instance.
Implementation
Uint8List exportIdentity() {
if (_closed) {
throw SealdException(
code: "INSTANCE_CLOSED",
id: "FLUTTER_INSTANCE_CLOSED",
description: "Instance already closed.");
}
final Pointer<Pointer<Uint8>> result = calloc<Pointer<Uint8>>();
final Pointer<Int> resultLen = calloc<Int>();
final Pointer<Pointer<NativeSealdError>> err =
calloc<Pointer<NativeSealdError>>();
final int resultCode = _bindings.SealdSdk_ExportIdentity(
_ptr.pointer(), result, resultLen, err);
if (resultCode != 0) {
calloc.free(result);
calloc.free(resultLen);
throw SealdException._fromCPtr(err);
} else {
final Uint8List cIdentityExport =
result.value.asTypedList(resultLen.value);
// Copying the data in a Dart-created Uint8List, to avoid having to free memory later
final Uint8List res = Uint8List.fromList(cIdentityExport);
calloc.free(result.value);
calloc.free(result);
calloc.free(resultLen);
calloc.free(err);
return res;
}
}