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 = bytes.sublist(0, 32);
  final s = bytes.sublist(32);
  if (!_KeyUtils.isCanonical(c) || !_KeyUtils.isCanonical(s)) {
    throw ArgumentException("invalid VRF proof bytes");
  }
  return VRFProof._(c, s);
}