Conversation
|
@tomholub I made some change that seemed logical to me. |
Sounds ok, but only for private key. If it's public key, and it contains the necessary information to encrypt for it, but it's just expired, then it should say You could still -encrypt- for such -public- key if you pretend to encrypt at an older date. We have such mechanism where user can choose to do it, after they confirm a warning that it's not recommended.
Sure, maybe you want to verify old signatures made by corresponding private key. |
Ok then, I'll restore
|
good idea |
…utExpired with missing key detection for both expired encryption and signing keys
| const key = keyToUpdate || {} as Key; // if no key to update, use empty object, will get props assigned below | ||
| const encryptionKey = await Catch.undefinedOnException(opgpKey.getEncryptionKey()); | ||
| const getEncryptionKey = (keyid?: OpenPGP.Keyid | null, date?: Date, userId?: OpenPGP.UserId | null) => | ||
| opgpKey.getEncryptionKey(keyid, date, userId); |
| const encryptionKey = await Catch.undefinedOnException(opgpKey.getEncryptionKey()); | ||
| const getEncryptionKey = (keyid?: OpenPGP.Keyid | null, date?: Date, userId?: OpenPGP.UserId | null) => | ||
| opgpKey.getEncryptionKey(keyid, date, userId); | ||
| const encryptionKeyIgnoringExpiration = encryptionKey ? encryptionKey : await OpenPGPKey.getKeyIgnoringExpiration(getEncryptionKey, exp, expired); |
There was a problem hiding this comment.
You can use a ?? operator (or was it ?: ?) which typescript will transpile as what you wrote.
There was a problem hiding this comment.
I just forgot about this operator 😊
Fixes #2887