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",
    "VRFProof",
  );
  final c = _KeyUtils.toCanonical(bytes.sublist(0, 32));
  final s = _KeyUtils.toCanonical(bytes.sublist(32));
  if (c == null || s == null) {
    throw ArgumentException.invalidOperationArguments(
      "VRFProof",
      reason: "Invalid vrf proof bytes.",
    );
  }
  return VRFProof._(c, s);
}