encKeyFor method
The decapsulation key for the key kid names, and which KEM it
belongs to — for opening by composing mixins, not for application use.
Null if this client holds no such key.
By kid rather than "the current one", because a retired key still opens what was sealed to it before it was retired, which is the only reason it is still held.
Not the seed — for ML-KEM the two differ. It is derived from the persisted seed at register time so a caller never has to know which.
Implementation
@protected
({Uint8List secretKey, String keyAlgo})? encKeyFor(String kid) {
for (final held in _encKeys) {
if (held.kid == kid) {
return (secretKey: held.secretKey, keyAlgo: held.keyAlgo);
}
}
return null;
}