vrfVerify method
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 ArgumentException.invalidOperationArguments(
"vrfVerify",
name: "vrfSign",
reason: "Invalid vrf signature bytes 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),
);
}