vrfVerify method

bool vrfVerify(
  1. List<int> message,
  2. List<int> vrfSign, {
  3. List<int>? context,
  4. List<int>? extra,
})

Implementation

bool vrfVerify(List<int> message, List<int> vrfSign,
    {List<int>? context, List<int>? extra}) {
  if (vrfSign.length != _SubstrateSr25519SignerConst.vrfResultLength &&
      vrfSign.length != SchnorrkelKeyCost.vrfProofLength) {
    throw CryptoSignException(
        "Invalid VrfSign bytes length. expected: ${_SubstrateSr25519SignerConst.vrfResultLength}, ${SchnorrkelKeyCost.vrfProofLength} got: ${vrfSign.length} ");
  }
  final MerlinTranscript script =
      _SubstrateSr25519SignerUtils.substrateVrfSignScript(message, context);
  VRFPreOut output;
  VRFProof proof;
  if (vrfSign.length == SchnorrkelKeyCost.vrfProofLength) {
    output = _signer.vrfInOut(script).toVRFPreOut();
    proof = VRFProof.fromBytes(vrfSign);
  } else {
    output = VRFPreOut(vrfSign.sublist(0, SchnorrkelKeyCost.vrfPreOutLength));
    proof = VRFProof.fromBytes(
        vrfSign.sublist(SchnorrkelKeyCost.vrfPreOutLength));
  }
  return _signer.publicKey().vrfVerify(
      _SubstrateSr25519SignerUtils.substrateVrfSignScript(message, context),
      output,
      proof,
      verifyScript: _SubstrateSr25519SignerUtils.vrfScript(extra: extra));
}