askarKeyCryptoBoxSealOpen function
Implementation
AskarResult<Uint8List> askarKeyCryptoBoxSealOpen(
LocalKeyHandle localKeyHandle,
Uint8List ciphertext,
) {
Pointer<NativeByteBuffer> byteBufferPointer = bytesListToByteBuffer(ciphertext);
Pointer<NativeSecretBuffer> secretBufferPointer = calloc<NativeSecretBuffer>();
try {
final funcResult = nativeAskarKeyCryptoBoxSealOpen(
localKeyHandle.toInt(),
byteBufferPointer.ref,
secretBufferPointer,
);
final errorCode = ErrorCode.fromInt(funcResult);
final value = secretBufferToBytesList(secretBufferPointer.ref);
return AskarResult<Uint8List>(errorCode, value);
} finally {
freeByteBufferPointer(byteBufferPointer);
freeSecretBufferPointer(secretBufferPointer);
}
}