Make keychain account accessible after first unlock

This commit is contained in:
Thomas Ricouard 2023-02-14 14:15:12 +01:00
parent 7bbe3cbc41
commit 79c9ef4153

View file

@ -16,7 +16,7 @@ public extension AppAccount {
func save() throws {
let encoder = JSONEncoder()
let data = try encoder.encode(self)
Self.keychain.set(data, forKey: key)
Self.keychain.set(data, forKey: key, withAccess: .accessibleAfterFirstUnlock)
}
func delete() {
@ -33,6 +33,7 @@ public extension AppAccount {
if let data = keychain.getData(key) {
if let account = try? decoder.decode(AppAccount.self, from: data) {
accounts.append(account)
account.save()
}
}
}