Implement migration of existing PGP keys into Keychain
This commit is contained in:
parent
a66a79abc6
commit
e4e4c6daff
1 changed files with 10 additions and 0 deletions
|
|
@ -126,6 +126,7 @@ public class PasswordStore {
|
|||
// File migration to group
|
||||
migrateIfNeeded()
|
||||
backwardCompatibility()
|
||||
importExistingKeysIntoKeychain()
|
||||
|
||||
do {
|
||||
if fm.fileExists(atPath: storeURL.path) {
|
||||
|
|
@ -183,6 +184,15 @@ public class PasswordStore {
|
|||
}
|
||||
}
|
||||
|
||||
private func importExistingKeysIntoKeychain() {
|
||||
if let publicKey = fm.contents(atPath: Globals.pgpPublicKeyPath) {
|
||||
Utils.addDataToKeychain(key: PGPKeyType.PUBLIC.rawValue, data: publicKey)
|
||||
}
|
||||
if let privateKey = fm.contents(atPath: Globals.pgpPrivateKeyPath) {
|
||||
Utils.addDataToKeychain(key: PGPKeyType.PRIVATE.rawValue, data: privateKey)
|
||||
}
|
||||
}
|
||||
|
||||
enum SSHKeyType {
|
||||
case `public`, secret
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue