Skip to content

Commit

Permalink
Merge pull request #13 from johannes-schliephake/bugfix/clear-keychain
Browse files Browse the repository at this point in the history
Clear keychain only when launching app for the first time
  • Loading branch information
johannes-schliephake authored Feb 13, 2021
2 parents 01b3ab0 + f0ef11e commit c7863e4
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 c7863e4

Please sign in to comment.