finish simple "add password function"

This commit is contained in:
Bob Sun 2017-02-10 22:15:01 +08:00
parent cbbb631e08
commit b954a4dcab
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
13 changed files with 314 additions and 26 deletions

View file

@ -10,7 +10,9 @@ import Foundation
import SwiftyUserDefaults
extension DefaultsKeys {
static let pgpKeyURL = DefaultsKey<URL?>("pgpKeyURL")
// static let pgpKeyURL = DefaultsKey<URL?>("pgpKeyURL")
static let pgpPublicKeyURL = DefaultsKey<URL?>("pgpPublicKeyURL")
static let pgpPrivateKeyURL = DefaultsKey<URL?>("pgpPrivateKeyURL")
static let pgpKeyPassphrase = DefaultsKey<String>("pgpKeyPassphrase")
static let pgpKeyID = DefaultsKey<String>("pgpKeyID")
@ -31,7 +33,8 @@ extension DefaultsKeys {
extension Utils {
static func eraseAllUserDefaults() {
Defaults.remove(.pgpKeyURL)
Defaults.remove(.pgpPublicKeyURL)
Defaults.remove(.pgpPrivateKeyURL)
Defaults.remove(.pgpKeyPassphrase)
Defaults.remove(.pgpKeyID)

View file

@ -10,9 +10,13 @@ import Foundation
class Globals {
static let documentPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0];
static let secringPath = "\(documentPath)/secring.gpg"
static let pgpPublicKeyPath = "\(documentPath)/gpg_key.pub"
static let pgpPrivateKeyPath = "\(documentPath)/gpg_key"
static let sshPublicKeyURL = URL(fileURLWithPath: "\(documentPath)/ssh_key.pub")
static let sshPrivateKeyURL = URL(fileURLWithPath: "\(documentPath)/ssh_key")
static let repositoryPath = "\(documentPath)/password-store"
static var passcodeConfiguration = PasscodeLockConfiguration()
static let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
private init() { }