derivePublicKey function

Uint8List derivePublicKey(
  1. BigInt privateKey,
  2. bool compressed
)

Generates a public key for the given private key. @param privateKey is a BigInt @param compressed The output public key is compressed or not.

Implementation

Uint8List derivePublicKey(BigInt privateKey, bool compressed) {
  final p = (ECCurve_secp256k1().G * privateKey)!;

  return Uint8List.view(p.getEncoded(compressed).buffer, 1);
}