getPublicKey method

Uint8List getPublicKey(
  1. BigInt privateKey, [
  2. bool isCompressed = true
])

If isCompressed is true, return public key length is 33 (flag + x), otherwise, public key length is 64 (x + y)

Implementation

Uint8List getPublicKey(BigInt privateKey, [bool isCompressed = true]) {
  final p = (_ecDomainParams.G * privateKey);
  final buffer = p!.getEncoded(isCompressed);
  return isCompressed ? buffer : Uint8List.sublistView(buffer, 1);
}