isValidKeyEncoding static method
Checks whether keyBytes is a valid public key of the given type
when interpreted with the given encoding.
Implementation
static bool isValidKeyEncoding(
List<int> keyBytes,
CryptoKeyEncoding encoding,
) {
switch (encoding) {
case CryptoKeyEncoding.base:
try {
final decode = layout().deserialize(keyBytes);
return decode.consumed == keyBytes.length;
} catch (_) {
return false;
}
case CryptoKeyEncoding.uncompressed:
return false;
}
}