ECPrivate.fromBytes constructor

ECPrivate.fromBytes(
  1. Uint8List prive
)

creates an object from raw 32 bytes

Implementation

factory ECPrivate.fromBytes(Uint8List prive) {
  if (!ec.isPrivate(prive)) {
    throw Exception("wrong ec private");
  }
  final priveHex = bytesToHex(prive);
  final public = ec.pointFromScalar(prive, false);
  final publicHex = bytesToHex(public!);
  return ECPrivate._(
    priveHex: priveHex,
    publicHex: publicHex,
  );
}