change sshPublicKeyPath to sshPublicKeyURL
This commit is contained in:
parent
b73605ee9e
commit
7effaa841a
4 changed files with 8 additions and 8 deletions
|
|
@ -11,8 +11,8 @@ import Foundation
|
|||
class Globals {
|
||||
static let documentPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0];
|
||||
static let secringPath = "\(documentPath)/secring.gpg"
|
||||
static let sshPublicKeyPath = URL(fileURLWithPath: "\(documentPath)/ssh_key.pub")
|
||||
static let sshPrivateKeyPath = URL(fileURLWithPath: "\(documentPath)/ssh_key")
|
||||
static let sshPublicKeyURL = URL(fileURLWithPath: "\(documentPath)/ssh_key.pub")
|
||||
static let sshPrivateKeyURL = URL(fileURLWithPath: "\(documentPath)/ssh_key")
|
||||
static var passcodeConfiguration = PasscodeLockConfiguration()
|
||||
private init() { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class PasswordStore {
|
|||
if Defaults[.gitRepositoryAuthenticationMethod] == "Password" {
|
||||
gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: Defaults[.gitRepositoryUsername], password: Defaults[.gitRepositoryPassword]))
|
||||
} else if Defaults[.gitRepositoryAuthenticationMethod] == "SSH Key"{
|
||||
gitCredential = GitCredential(credential: GitCredential.Credential.ssh(userName: Defaults[.gitRepositoryUsername], password: Defaults[.gitRepositorySSHPrivateKeyPassphrase]!, publicKeyFile: Globals.sshPublicKeyPath, privateKeyFile: Globals.sshPrivateKeyPath))
|
||||
gitCredential = GitCredential(credential: GitCredential.Credential.ssh(userName: Defaults[.gitRepositoryUsername], password: Defaults[.gitRepositorySSHPrivateKeyPassphrase]!, publicKeyFile: Globals.sshPublicKeyURL, privateKeyFile: Globals.sshPrivateKeyURL))
|
||||
} else {
|
||||
gitCredential = nil
|
||||
}
|
||||
|
|
@ -186,8 +186,8 @@ class PasswordStore {
|
|||
func erase() {
|
||||
Utils.removeFileIfExists(at: storeURL)
|
||||
Utils.removeFileIfExists(atPath: Globals.secringPath)
|
||||
Utils.removeFileIfExists(at: Globals.sshPrivateKeyPath)
|
||||
Utils.removeFileIfExists(at: Globals.sshPublicKeyPath)
|
||||
Utils.removeFileIfExists(at: Globals.sshPrivateKeyURL)
|
||||
Utils.removeFileIfExists(at: Globals.sshPublicKeyURL)
|
||||
|
||||
deleteCoreData(entityName: "PasswordEntity")
|
||||
deleteCoreData(entityName: "PasswordCategoryEntity")
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ class SSHKeySettingTableViewController: UITableViewController {
|
|||
Defaults[.gitRepositorySSHPrivateKeyPassphrase] = passphraseTextField.text!
|
||||
|
||||
do {
|
||||
try Data(contentsOf: Defaults[.gitRepositorySSHPublicKeyURL]!).write(to: Globals.sshPublicKeyPath, options: .atomic)
|
||||
try Data(contentsOf: Defaults[.gitRepositorySSHPrivateKeyURL]!).write(to: Globals.sshPrivateKeyPath, options: .atomic)
|
||||
try Data(contentsOf: Defaults[.gitRepositorySSHPublicKeyURL]!).write(to: Globals.sshPublicKeyURL, options: .atomic)
|
||||
try Data(contentsOf: Defaults[.gitRepositorySSHPrivateKeyURL]!).write(to: Globals.sshPrivateKeyURL, options: .atomic)
|
||||
} catch {
|
||||
print(error)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class SettingsTableViewController: UITableViewController {
|
|||
if auth == "Password" {
|
||||
gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: username, password: password))
|
||||
} else {
|
||||
gitCredential = GitCredential(credential: GitCredential.Credential.ssh(userName: username, password: Defaults[.gitRepositorySSHPrivateKeyPassphrase]!, publicKeyFile: Globals.sshPublicKeyPath, privateKeyFile: Globals.sshPrivateKeyPath))
|
||||
gitCredential = GitCredential(credential: GitCredential.Credential.ssh(userName: username, password: Defaults[.gitRepositorySSHPrivateKeyPassphrase]!, publicKeyFile: Globals.sshPublicKeyURL, privateKeyFile: Globals.sshPrivateKeyURL))
|
||||
}
|
||||
|
||||
DispatchQueue.global(qos: .userInitiated).async {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue