validateKeyBits static method

Uint8List validateKeyBits(
  1. Uint8List bytes
)

Throws an error on invalid bytes and return the bytes itself anyway

Implementation

static Uint8List validateKeyBits(Uint8List bytes) {
  var valid = ((bytes[0] & 7) == 0) && ((bytes[31] & 192) == 64);
  if (bytes.length < 32 || !valid) {
    throw InvalidSigningKeyError();
  }

  return bytes;
}