Delete key files after migrating them to Keychain
This commit is contained in:
parent
441a7f1e9b
commit
f0003227d5
1 changed files with 12 additions and 5 deletions
|
|
@ -191,11 +191,18 @@ public class PasswordStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func importExistingKeysIntoKeychain() {
|
private func importExistingKeysIntoKeychain() {
|
||||||
|
do {
|
||||||
if let publicKey = fm.contents(atPath: Globals.pgpPublicKeyPath) {
|
if let publicKey = fm.contents(atPath: Globals.pgpPublicKeyPath) {
|
||||||
AppKeychain.add(data: publicKey, for: PGPKeyType.PUBLIC.rawValue)
|
AppKeychain.add(data: publicKey, for: PGPKeyType.PUBLIC.rawValue)
|
||||||
|
try fm.removeItem(atPath: Globals.pgpPublicKeyPath)
|
||||||
}
|
}
|
||||||
if let privateKey = fm.contents(atPath: Globals.pgpPrivateKeyPath) {
|
if let privateKey = fm.contents(atPath: Globals.pgpPrivateKeyPath) {
|
||||||
AppKeychain.add(data: privateKey, for: PGPKeyType.PRIVATE.rawValue)
|
AppKeychain.add(data: privateKey, for: PGPKeyType.PRIVATE.rawValue)
|
||||||
|
try fm.removeItem(atPath: Globals.pgpPrivateKeyPath)
|
||||||
|
}
|
||||||
|
SharedDefaults[.pgpKeySource] = "file"
|
||||||
|
} catch {
|
||||||
|
print("MigrationError".localize(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue