ECPublicKey constructor

ECPublicKey(
  1. Uint8List data
)

Constructs a public key from a 33-byte compressed or 65-byte uncompressed representation. InvalidPublicKey will be thrown if the public key is invalid or in the wrong format.

Implementation

ECPublicKey(Uint8List data) : _data = Uint8List.fromList(data) {
  if (data.length != 33 && data.length != 65) {
    throw InvalidPublicKey();
  }
  if (!secp256k1.pubKeyVerify(data)) throw InvalidPublicKey();
}