privateKeyToPublicKey static method

Uint8List privateKeyToPublicKey(
  1. Uint8List privateKey
)

Generates a public key for the given private key using the ecdsa curve which Ethereum uses.

Implementation

static Uint8List privateKeyToPublicKey(Uint8List privateKey) {
  final privateKeyNum = decodeBigInt(privateKey);
  final p = _params.G * privateKeyNum;

  //skip the type flag, https://github.com/ethereumjs/ethereumjs-util/blob/master/index.js#L319
  return Uint8List.view(p!.getEncoded(false).buffer, 1);
}