G1AffinePoint.fromBytes constructor

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

Creates a G1 affine point from bytes, validating that it is on-curve and in the correct subgroup.

Implementation

factory G1AffinePoint.fromBytes(List<int> bytes) {
  final affine = G1AffinePoint.fromBytesUnchecked(bytes);
  if (affine.isOnCurve() && affine.isTorsionFree()) {
    return affine;
  }
  throw ArgumentException.invalidOperationArguments(
    "fromBytes",
    reason: "Invalid G1 encoding.",
  );
}