Cleanup and fix the erase logic
Explicitly uninit PGP agent during erasing all data.
This commit is contained in:
parent
230b421a90
commit
e0c32003e3
2 changed files with 15 additions and 8 deletions
|
|
@ -630,22 +630,28 @@ public class PasswordStore {
|
|||
}
|
||||
}
|
||||
|
||||
public func erase() {try? fm.removeItem(at: storeURL)
|
||||
public func erase() {
|
||||
// Delete files.
|
||||
try? fm.removeItem(at: storeURL)
|
||||
try? fm.removeItem(at: tempStoreURL)
|
||||
|
||||
try? fm.removeItem(atPath: Globals.gitSSHPrivateKeyPath)
|
||||
|
||||
AppKeychain.shared.removeContent(for: PgpKey.PUBLIC.getKeychainKey())
|
||||
AppKeychain.shared.removeContent(for: PgpKey.PRIVATE.getKeychainKey())
|
||||
|
||||
// Delete PGP key, SSH key and other secrets from the keychain.
|
||||
AppKeychain.shared.removeAllContent()
|
||||
|
||||
// Delete core data.
|
||||
deleteCoreData(entityName: "PasswordEntity")
|
||||
|
||||
// Delete default settings.
|
||||
SharedDefaults.removeAll()
|
||||
storeRepository = nil
|
||||
PasscodeLock.shared.delete() // delete the passcode cache
|
||||
|
||||
// Clean up variables inside PasswordStore.
|
||||
storeRepository = nil
|
||||
|
||||
// Delete cache explicitly.
|
||||
PasscodeLock.shared.delete()
|
||||
PGPAgent.shared.uninitKeys()
|
||||
|
||||
// Broadcast.
|
||||
NotificationCenter.default.post(name: .passwordStoreUpdated, object: nil)
|
||||
NotificationCenter.default.post(name: .passwordStoreErased, object: nil)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue