vrfSign method

  1. @override
List<int> vrfSign(
  1. List<int> message, {
  2. List<int>? context,
  3. List<int>? extra,
})
override

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;
}