askarKeyVerifySignature function
Implementation
AskarResult<bool> askarKeyVerifySignature(
LocalKeyHandle handle,
Uint8List message,
Uint8List signature,
SignatureAlgorithm sigType,
) {
Pointer<Int8> intPointer = calloc<Int8>();
Pointer<Utf8> sigTypePointer = nullptr;
Pointer<NativeByteBuffer> messageAsByteBufferPt = nullptr;
Pointer<NativeByteBuffer> signatureAsByteBufferPt = nullptr;
try {
sigTypePointer = sigType.value.toNativeUtf8();
messageAsByteBufferPt = bytesListToByteBuffer(message);
signatureAsByteBufferPt = bytesListToByteBuffer(signature);
final funcResult = nativeAskarKeyVerifySignature(
handle.toInt(),
messageAsByteBufferPt.ref,
signatureAsByteBufferPt.ref,
sigTypePointer,
intPointer,
);
final errorCode = ErrorCode.fromInt(funcResult);
final int output = (errorCode == ErrorCode.success) ? intPointer.value.toInt() : 0;
return AskarResult<bool>(errorCode, intToBool(output));
} finally {
freePointer(intPointer);
freePointer(sigTypePointer);
freeByteBufferPointer(messageAsByteBufferPt);
freeByteBufferPointer(signatureAsByteBufferPt);
}
}