vrfSign method
Implementation
@override
List<int> vrfSign(List<int> message, {List<int>? context, List<int>? extra}) {
final msg = BytesUtils.toBytes(message, unmodifiable: true);
final signature = _signer.sign(message);
final vrf = QuickCrypto.blake2b256Hash([
...BytesUtils.tryToBytes(context) ?? [],
...BytesUtils.tryToBytes(extra) ?? [],
...signature,
]);
final List<int> vrfResult = [...vrf, ...signature];
final verify = toVerifyKey()
.vrfVerify(List.from(vrfResult), msg, context: context, extra: extra);
if (!verify) {
throw const MessageException(
'The created signature does not pass verification.');
}
return vrfResult;
}