pointFromScalar method

Uint8List pointFromScalar(
  1. Uint8List d
)

Implementation

Uint8List pointFromScalar(Uint8List d) {
  if (!isPrivate(d)) {
    throw ArgumentError('The argument must be a private key');
  }

  final secp256k1 = ECCSecp256k1();

  const bigIntEndian = BigIntBigEndian();
  final dd = bigIntEndian.decode(d);
  final pp = secp256k1.G * dd;

  if (pp!.isInfinity) {
    throw Exception('Derived infinity');
  }

  return pp.getEncoded(true);
}