askarStoreGenerateRawKey function
Implementation
AskarResult<String> askarStoreGenerateRawKey({Uint8List? seed}) {
// Generate a random seed if not provided
seed ??= generateRandomSeed();
Pointer<Pointer<Utf8>> utf8PtPointer = calloc<Pointer<Utf8>>();
Pointer<NativeByteBuffer> byteBufferPointer = nullptr;
try {
byteBufferPointer = bytesListToByteBuffer(seed);
final funcResult = nativeAskarStoreGenerateRawKey(
byteBufferPointer.ref,
utf8PtPointer,
);
final errorCode = ErrorCode.fromInt(funcResult);
final String value =
(errorCode == ErrorCode.success) ? utf8PtPointer.value.toDartString() : "";
return AskarResult<String>(errorCode, value);
} finally {
freePointer(utf8PtPointer);
freeByteBufferPointer(byteBufferPointer);
}
}