isValidPrivateKey function

bool isValidPrivateKey(
  1. Uint8List privKey
)

Implementation

bool isValidPrivateKey(Uint8List privKey) {
  if (privKey.length != 32)
    return false;
  else if (privKey.every((byte) => byte == 0x0)) return false;

  final maxInt = hexToInt(MAX_PRIV_KEY_VALUE);
  final privKeyInt = hexToInt(HEX.encode(privKey));
  return privKeyInt <= maxInt;
}