vrfVerify method
Implementation
@override
bool vrfVerify(List<int> message, List<int> vrfSign,
{List<int>? context, List<int>? extra}) {
if (vrfSign.length != _SubstrateEcdsaSignerCons.vrfLength) {
throw ArgumentException(
"Invalid vrf length. excepted: ${_SubstrateEcdsaSignerCons.vrfLength} got: ${vrfSign.length}");
}
final List<int> signature =
vrfSign.sublist(QuickCrypto.blake2b256DigestSize);
final verifySignature = verify(message, signature);
if (verifySignature) {
final vrfHash = vrfSign.sublist(0, QuickCrypto.blake2b256DigestSize);
final vrf = QuickCrypto.blake2b256Hash([
...BytesUtils.tryToBytes(context) ?? [],
...BytesUtils.tryToBytes(extra) ?? [],
...signature,
]);
return BytesUtils.bytesEqual(vrf, vrfHash);
}
return false;
}