G1NativeAffinePoint.fromBytes constructor

G1NativeAffinePoint.fromBytes(
  1. List<int> bytes, {
  2. bool check = true,
})

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

Implementation

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