ETHPrivateKey.fromBytes constructor

ETHPrivateKey.fromBytes(
  1. List<int> keyBytes
)

Creates an ETHPrivateKey instance from a list of bytes representing the private key.

Implementation

factory ETHPrivateKey.fromBytes(List<int> keyBytes) {
  try {
    final Secp256k1PrivateKeyEcdsa key =
        Secp256k1PrivateKeyEcdsa.fromBytes(keyBytes);
    return ETHPrivateKey._(key);
  } catch (e) {
    throw MessageException("invalid ethereum private key",
        details: {"input": BytesUtils.toHexString(keyBytes)});
  }
}