bestKeyFor method
The first active key in supportedAlgos order (strongest first) that
this key package advertises for use. Returns null if the package and
supportedAlgos have no algorithm in common, or if every key they do have
in common is retired.
A holder deciding whether it can open a given envelope asks keys instead, which carries retired entries too.
Implementation
PackageKey? bestKeyFor(List<String> supportedAlgos,
{String use = SecretSharingAlgos.useEnc}) {
for (final alg in supportedAlgos) {
for (final key in keys) {
if (key.alg == alg && key.use == use && key.offeredForNewOperations) {
return key;
}
}
}
return null;
}