use keychain to store pgp passphrase and git password

This commit is contained in:
Bob Sun 2017-02-19 22:10:36 +08:00
parent ceb52a5b33
commit 90709675a3
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
10 changed files with 86 additions and 19 deletions

View file

@ -27,7 +27,7 @@ class SettingsTableViewController: UITableViewController {
if let controller = segue.source as? PGPKeySettingTableViewController {
Defaults[.pgpPrivateKeyURL] = URL(string: controller.pgpPrivateKeyURLTextField.text!)
Defaults[.pgpPublicKeyURL] = URL(string: controller.pgpPublicKeyURLTextField.text!)
Defaults[.pgpKeyPassphrase] = controller.pgpPassphrase
PasswordStore.shared.pgpKeyPassphrase = controller.pgpPassphrase
Defaults[.pgpKeySource] = "url"
SVProgressHUD.setDefaultMaskType(.black)
@ -57,7 +57,9 @@ class SettingsTableViewController: UITableViewController {
} else if let controller = segue.source as? PGPKeyArmorSettingTableViewController {
Defaults[.pgpKeySource] = "armor"
Defaults[.pgpKeyPassphrase] = controller.pgpPassphrase
PasswordStore.shared.pgpKeyPassphrase = controller.pgpPassphrase
Utils.addPasswrodToKeychain(name: "pgpKeyPassphrase", password: controller.pgpPassphrase!)
Defaults[.pgpPublicKeyArmor] = controller.armorPublicKeyTextView.text!
Defaults[.pgpPrivateKeyArmor] = controller.armorPrivateKeyTextView.text!