ECPrivateKey constructor

ECPrivateKey(
  1. Uint8List data, {
  2. bool compressed = true,
})

Constructs a private key from a 32-byte scalar. The public key may be in the compressed format which is the default. InvalidPrivateKey will be thrown if the private key is not within the secp256k1 order.

Implementation

ECPrivateKey(Uint8List data, { this.compressed = true })
  : _data = copyCheckBytes(data, privateKeyLength, name: "Private key data") {
  if (!secp256k1.privKeyVerify(data)) throw InvalidPrivateKey();
}