clarify public vs private keys + make prvate key IDs available
This commit is contained in:
parent
4e19d9e714
commit
5a92b6fda7
11 changed files with 56 additions and 30 deletions
|
|
@ -128,7 +128,7 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
|
|||
// alert: cancel or try again
|
||||
let alert = UIAlertController(title: "CannotShowPassword".localize(), message: AppError.pgpPrivateKeyNotFound(keyID: key).localizedDescription, preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction.cancelAndPopView(controller: self))
|
||||
let selectKey = UIAlertAction.selectKey(controller: self) { action in
|
||||
let selectKey = UIAlertAction.selectKey(type: .PRIVATE, controller: self) { action in
|
||||
self.decryptThenShowPasswordLocalKey(keyID: action.title)
|
||||
}
|
||||
alert.addAction(selectKey)
|
||||
|
|
@ -223,7 +223,7 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
|
|||
SVProgressHUD.dismiss()
|
||||
let alert = UIAlertController(title: "Cannot Edit Password", message: AppError.pgpPublicKeyNotFound(keyID: key).localizedDescription, preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction.cancelAndPopView(controller: self))
|
||||
let selectKey = UIAlertAction.selectKey(controller: self) { action in
|
||||
let selectKey = UIAlertAction.selectKey(type: .PUBLIC, controller: self) { action in
|
||||
self.saveEditPassword(password: password, keyID: action.title)
|
||||
}
|
||||
alert.addAction(selectKey)
|
||||
|
|
|
|||
|
|
@ -89,10 +89,12 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
|
|||
private func setPGPKeyTableViewCellDetailText() {
|
||||
var label = "NotSet".localize()
|
||||
|
||||
let keyID = (try? PGPAgent.shared.getShortKeyID()) ?? []
|
||||
if keyID.count == 1 {
|
||||
label = keyID.first ?? ""
|
||||
} else if keyID.count > 1 {
|
||||
var keyIDs = Set<String>((try? PGPAgent.shared.getShortKeyIDs(type: .PRIVATE)) ?? [])
|
||||
keyIDs.formUnion((try? PGPAgent.shared.getShortKeyIDs(type: .PUBLIC)) ?? [])
|
||||
|
||||
if keyIDs.count == 1 {
|
||||
label = keyIDs.first ?? ""
|
||||
} else if keyIDs.count > 1 {
|
||||
label = "Multiple"
|
||||
}
|
||||
if Defaults.isYubiKeyEnabled {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ func decryptPassword(
|
|||
DispatchQueue.main.async {
|
||||
let alert = UIAlertController(title: "CannotShowPassword".localize(), message: AppError.pgpPrivateKeyNotFound(keyID: key).localizedDescription, preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction.cancelAndPopView(controller: controller))
|
||||
let selectKey = UIAlertAction.selectKey(controller: controller) { action in
|
||||
let selectKey = UIAlertAction.selectKey(type: PGPKey.PRIVATE, controller: controller) { action in
|
||||
decryptPassword(in: controller, with: passwordPath, using: action.title, completion: completion)
|
||||
}
|
||||
alert.addAction(selectKey)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ func encryptPassword(in controller: UIViewController, with password: Password, k
|
|||
DispatchQueue.main.async {
|
||||
let alert = UIAlertController(title: "Cannot Encrypt Password", message: AppError.pgpPublicKeyNotFound(keyID: key).localizedDescription, preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction.cancelAndPopView(controller: controller))
|
||||
let selectKey = UIAlertAction.selectKey(controller: controller) { action in
|
||||
let selectKey = UIAlertAction.selectKey(type: .PUBLIC, controller: controller) { action in
|
||||
encryptPassword(in: controller, with: password, keyID: action.title, completion: completion)
|
||||
}
|
||||
alert.addAction(selectKey)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue