Some cosmetic changes

This commit is contained in:
Danny Moesch 2020-02-09 14:06:08 +01:00 committed by Mingshen Sun
parent e447b1d9d3
commit 5f6723246b
7 changed files with 10 additions and 20 deletions

View file

@ -60,11 +60,7 @@ class GitSSHKeyArmorSettingTableViewController: AutoCellHeightUITableViewControl
} }
@IBAction func doneButtonTapped(_ sender: Any) { @IBAction func doneButtonTapped(_ sender: Any) {
do { AppKeychain.shared.add(string: armorPrivateKeyTextView.text, for: SshKey.PRIVATE.getKeychainKey())
try passwordStore.initGitSSHKey(with: armorPrivateKeyTextView.text)
} catch {
Utils.alert(title: "CannotSave".localize(), message: "CannotSaveSshKey".localize(), controller: self, completion: nil)
}
Defaults.gitSSHKeySource = .armor Defaults.gitSSHKeySource = .armor
Defaults.gitAuthenticationMethod = .key Defaults.gitAuthenticationMethod = .key
self.navigationController!.popViewController(animated: true) self.navigationController!.popViewController(animated: true)

View file

@ -13,11 +13,8 @@ import passKit
class SSHKeySettingTableViewController: AutoCellHeightUITableViewController { class SSHKeySettingTableViewController: AutoCellHeightUITableViewController {
@IBOutlet weak var privateKeyURLTextField: UITextField! @IBOutlet weak var privateKeyURLTextField: UITextField!
let passwordStore = PasswordStore.shared
override func viewDidLoad() { let passwordStore = PasswordStore.shared
super.viewDidLoad()
}
@IBAction func doneButtonTapped(_ sender: UIButton) { @IBAction func doneButtonTapped(_ sender: UIButton) {
guard let privateKeyURL = URL(string: privateKeyURLTextField.text!.trimmed) else { guard let privateKeyURL = URL(string: privateKeyURLTextField.text!.trimmed) else {

View file

@ -157,6 +157,7 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
self.keychain.removeContent(for: PgpKey.PRIVATE.getKeychainKey()) self.keychain.removeContent(for: PgpKey.PRIVATE.getKeychainKey())
PGPAgent.shared.uninitKeys() PGPAgent.shared.uninitKeys()
self.pgpKeyTableViewCell.detailTextLabel?.text = "NotSet".localize() self.pgpKeyTableViewCell.detailTextLabel?.text = "NotSet".localize()
Defaults.pgpKeySource = nil
} }
optionMenu.addAction(deleteAction) optionMenu.addAction(deleteAction)
} }

View file

@ -89,7 +89,6 @@
"Import" = "Importieren"; "Import" = "Importieren";
"Imported" = "Importiert"; "Imported" = "Importiert";
"Tips" = "Tipps"; "Tips" = "Tipps";
"PgpCopyPublicAndPrivateKeyToPass." = "Kopiere den öffentlichen und den privaten Schlüssel im ASCII-Format verschlüsselt mit den Namen \"gpg_key.pub\" bzw. \"gpg_key\" über iTunes zu Pass. Danach können die Schlüssel über \"Datenaustausch über iTunes\" importiert werden.";
"FillInGitAccountPassword." = "Bitte gib das Passwort deines Git-Accounts ein."; "FillInGitAccountPassword." = "Bitte gib das Passwort deines Git-Accounts ein.";
"NoPasswordStore." = "Es gibt im Moment keinen Passwort Store."; "NoPasswordStore." = "Es gibt im Moment keinen Passwort Store.";
"SyncingPasswordStore" = "Password Store wird synchronisiert"; "SyncingPasswordStore" = "Password Store wird synchronisiert";
@ -129,9 +128,10 @@
"CannotSavePgpKey" = "PGP-Schlüssel kann nicht gespeichert werden"; "CannotSavePgpKey" = "PGP-Schlüssel kann nicht gespeichert werden";
"SetPgpKeyUrlFirst." = "Bitte gib zuerst die URL des PGP-Schlüssels ein."; "SetPgpKeyUrlFirst." = "Bitte gib zuerst die URL des PGP-Schlüssels ein.";
"FetchingPgpKey" = "PGP-Schlüssel wird geladen"; "FetchingPgpKey" = "PGP-Schlüssel wird geladen";
"RememberToRemoveKey" = "Vergiss das Löschen des Schlüssels nicht"; "RememberToRemoveKey" = "Vergiss das Löschen der Schlüssel nicht";
"RememberToRemoveKeyFromServer." = "Vergiss nicht, den Schlüssel wieder vom Server zu entfernen."; "RememberToRemoveKeyFromServer." = "Vergiss nicht, die Schlüssel wieder vom Server zu entfernen.";
"RemovePgpKeys" = "PGP-Schlüssel entfernen"; "RemovePgpKeys" = "PGP-Schlüssel entfernen";
"PgpCopyPublicAndPrivateKeyToPass." = "Kopiere den öffentlichen und den privaten Schlüssel im ASCII-Format verschlüsselt mit den Namen \"gpg_key.pub\" bzw. \"gpg_key\" über iTunes zu Pass. Danach können die Schlüssel über \"Datenaustausch über iTunes\" importiert werden.";
"KeyExpiredOrIncompatibleError." = "Der öffentliche PGP-Schlüssel ist eventuell abgelaufen oder inkompatibel mit dem privaten Schlüssel."; "KeyExpiredOrIncompatibleError." = "Der öffentliche PGP-Schlüssel ist eventuell abgelaufen oder inkompatibel mit dem privaten Schlüssel.";
"WrongPassphraseError." = "Das Passwort für den privaten PGP-Schlüssel ist falsch."; "WrongPassphraseError." = "Das Passwort für den privaten PGP-Schlüssel ist falsch.";
@ -285,4 +285,4 @@ geben den öffentlichen und den privaten Schlüssel in diesem speziellen Format
$ gpg --export -a KEY_ID $ gpg --export -a KEY_ID
$ gpg --export-secret-keys -a KEY_ID $ gpg --export-secret-keys -a KEY_ID
geben den öffentlichen und den privaten Schlüssel in diesem speziellen Format aus. Kopiere ihn so zu einem Key-Server."; geben den öffentlichen und den privaten Schlüssel in diesem speziellen Format aus. Kopiere sie so zu einem Key-Server.";

View file

@ -128,8 +128,8 @@
"CannotSavePgpKey" = "Cannot Save PGP Key"; "CannotSavePgpKey" = "Cannot Save PGP Key";
"SetPgpKeyUrlFirst." = "Please set PGP key URL first."; "SetPgpKeyUrlFirst." = "Please set PGP key URL first.";
"FetchingPgpKey" = "Fetching PGP Key"; "FetchingPgpKey" = "Fetching PGP Key";
"RememberToRemoveKey" = "Remember to Remove the Key"; "RememberToRemoveKey" = "Remember to Remove the Keys";
"RememberToRemoveKeyFromServer." = "Remember to remove the key from the server."; "RememberToRemoveKeyFromServer." = "Remember to remove the keys from the server.";
"RemovePgpKeys" = "Remove PGP Keys"; "RemovePgpKeys" = "Remove PGP Keys";
"PgpCopyPublicAndPrivateKeyToPass." = "Copy your ASCII-armored public and private keys to Pass with names \"gpg_key.pub\" and \"gpg_key\" (without quotes) via iTunes. Then come back and click \"iTunes File Sharing\" to finish."; "PgpCopyPublicAndPrivateKeyToPass." = "Copy your ASCII-armored public and private keys to Pass with names \"gpg_key.pub\" and \"gpg_key\" (without quotes) via iTunes. Then come back and click \"iTunes File Sharing\" to finish.";
"KeyExpiredOrIncompatibleError." = "PGP public key may be expired or incompatible with the private key."; "KeyExpiredOrIncompatibleError." = "PGP public key may be expired or incompatible with the private key.";

View file

@ -9,7 +9,7 @@
import Foundation import Foundation
import UIKit import UIKit
public class Globals { public final class Globals {
public static let bundleIdentifier = "me.mssun.passforios" public static let bundleIdentifier = "me.mssun.passforios"
public static let groupIdentifier = "group." + bundleIdentifier public static let groupIdentifier = "group." + bundleIdentifier
public static let passKitBundleIdentifier = bundleIdentifier + ".passKit" public static let passKitBundleIdentifier = bundleIdentifier + ".passKit"

View file

@ -124,10 +124,6 @@ public class PasswordStore {
Defaults.remove(\.gitSSHPrivateKeyArmor) Defaults.remove(\.gitSSHPrivateKeyArmor)
} }
public func initGitSSHKey(with armorKey: String) throws {
AppKeychain.shared.add(string: armorKey, for: SshKey.PRIVATE.getKeychainKey())
}
public func repositoryExisted() -> Bool { public func repositoryExisted() -> Bool {
let fm = FileManager() let fm = FileManager()
return fm.fileExists(atPath: Globals.repositoryPath) return fm.fileExists(atPath: Globals.repositoryPath)