Allow replacing existing keys from import UI
msfjarvis opened this issue · 0 comments
To implement a proper key management interface we'll require the ability to update and/or replace existing keys. This is partially implemented in PGPKeyManager#addKey via the replace flag but it requires the caller to check for a KeyAlreadyExistsException and re-launch the import flow with the replace flag set to true.
In a couple specific cases, PGPKeyManager should be able to internally handle these updates. Specifically:
- Importing the secret part of an existing public key
- Importing a new copy of an existing public key
Since #2000 we're able to correctly extract public keys from secret keys, so the solution for 1. is to simply overwrite the key we already have with this secret key.
For 2. we have the capability to merge two public keys which should also be allowed to happen automatically.
For all other use cases, we'll retain the existing behaviour of returning Err<KeyAlreadyExistsException> and having the caller handle it.
Since the current flow does not allow authorizing a replace, we'll add that UI as well.