VRFProof.fromBytes constructor

VRFProof.fromBytes(
  1. List<int> bytes
)

Creates a VRFProof instance from a byte representation. The input bytes are expected to be properly formatted for a VRF proof.

Implementation

factory VRFProof.fromBytes(List<int> bytes) {
  _KeyUtils._checkKeysBytes(
      bytes, SchnorrkelKeyCost.vrfProofLength, "VRF proof");
  final c = _KeyUtils.toCanonical(bytes.sublist(0, 32));
  final s = _KeyUtils.toCanonical(bytes.sublist(32));
  if (c == null || s == null) {
    throw const ArgumentException("invalid VRF proof bytes");
  }
  return VRFProof._(c, s);
}