Skip to content

Commit

Permalink
Clear keychain only when launching app for the first time
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-schliephake committed Feb 13, 2021
1 parent 01b3ab0 commit f0ef11e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Shared/Utilities/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ final class Keychain {
self.accessGroup = accessGroup

/// This section will be improved in a future version
if load(key: "clearKeychain") == nil {
if !Configuration.userDefaults.bool(forKey: "appDidLaunch") {
Configuration.userDefaults.set(true, forKey: "appDidLaunch")
store(key: "clearKeychain", value: "true")
}
else if !Configuration.userDefaults.bool(forKey: "appDidLaunch") {
remove(key: "server")
remove(key: "user")
remove(key: "password")
remove(key: "acceptedCertificateHash")
if load(key: "clearKeychain") == nil {
store(key: "clearKeychain", value: "true")
}
else {
remove(key: "server")
remove(key: "user")
remove(key: "password")
remove(key: "acceptedCertificateHash")
}
}
}

Expand Down

0 comments on commit f0ef11e

Please sign in to comment.