validatePublicValue static method

BigInt validatePublicValue(
  1. BigInt N,
  2. BigInt val
)

Implementation

static BigInt validatePublicValue(BigInt N, BigInt val) {
  val = val % N;

  // Check that val % N != 0
  if (val == BigInt.zero) {
    throw Exception('Invalid public value: 0');
  }

  return val;
}