fromBytes static method
Parses untagged bytes into the matching level key. Throws when the length matches no ML-DSA parameter set.
Implementation
static BaseMLDSAPrivateKey fromBytes(List<int> bytes) {
final params = MLDSAParams.fromSecretKey(bytes);
return switch (params.level) {
44 => MLDSA44PrivateKey.fromBytes(bytes),
65 => MLDSA65PrivateKey.fromBytes(bytes),
87 => MLDSA87PrivateKey.fromBytes(bytes),
_ =>
throw CoreErrors.cryptoFailed(
"BaseMLDSAPrivateKey.fromBytes",
reason: 'Unsupported ML-DSA secret key level.',
),
};
}