support ASCII armor encrypted PGP keys
This commit is contained in:
parent
b5313b1dfc
commit
a5f13a1e8a
7 changed files with 377 additions and 66 deletions
|
|
@ -11,10 +11,16 @@ import SwiftyUserDefaults
|
|||
|
||||
extension DefaultsKeys {
|
||||
// static let pgpKeyURL = DefaultsKey<URL?>("pgpKeyURL")
|
||||
static let pgpKeySource = DefaultsKey<String?>("pgpKeySource")
|
||||
static let pgpPublicKeyURL = DefaultsKey<URL?>("pgpPublicKeyURL")
|
||||
static let pgpPrivateKeyURL = DefaultsKey<URL?>("pgpPrivateKeyURL")
|
||||
|
||||
|
||||
static let pgpPublicKeyArmor = DefaultsKey<String?>("pgpPublicKeyArmor")
|
||||
static let pgpPrivateKeyArmor = DefaultsKey<String?>("pgpPrivateKeyArmor")
|
||||
|
||||
static let pgpKeyPassphrase = DefaultsKey<String?>("pgpKeyPassphrase")
|
||||
static let pgpPrivateKeyURLPassphrase = DefaultsKey<String?>("pgpPrivateKeyURLPassphrase")
|
||||
static let pgpPrivateKeyArmorPassphrase = DefaultsKey<String?>("pgpPrivateKeyArmorPassphrase")
|
||||
static let pgpKeyID = DefaultsKey<String?>("pgpKeyID")
|
||||
static let pgpKeyUserID = DefaultsKey<String?>("pgpKeyUserID")
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,18 @@ class Utils {
|
|||
controller.present(alert, animated: true, completion: completion)
|
||||
|
||||
}
|
||||
|
||||
static func removePGPKeys() {
|
||||
removeFileIfExists(atPath: Globals.pgpPublicKeyPath)
|
||||
removeFileIfExists(atPath: Globals.pgpPrivateKeyPath)
|
||||
Defaults.remove(.pgpKeySource)
|
||||
Defaults.remove(.pgpKeyPassphrase)
|
||||
Defaults.remove(.pgpPublicKeyArmor)
|
||||
Defaults.remove(.pgpPrivateKeyArmor)
|
||||
Defaults.remove(.pgpPrivateKeyURL)
|
||||
Defaults.remove(.pgpPublicKeyURL)
|
||||
Defaults.remove(.pgpKeyID)
|
||||
}
|
||||
}
|
||||
|
||||
// https://gist.github.com/NikolaiRuhe/eeb135d20c84a7097516
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue