Delete authentication credentials from Keychain upon logout

Fixes #1181
This commit is contained in:
Marcus Kida 2023-11-24 14:16:54 +01:00 committed by Nathan Mattes
parent ab75f08e8f
commit 1a1eecac64
2 changed files with 8 additions and 3 deletions

View File

@ -30,7 +30,8 @@ public class AuthenticationServiceProvider: ObservableObject {
}
}
func delete(authentication: MastodonAuthentication) {
func delete(authentication: MastodonAuthentication) throws {
try Self.keychain.remove(authentication.persistenceIdentifier)
authentications.removeAll(where: { $0 == authentication })
}

View File

@ -150,8 +150,12 @@ extension AuthenticationService {
for feed in feeds {
managedObjectContext.delete(feed)
}
AuthenticationServiceProvider.shared.delete(authentication: authenticationBox.authentication)
}
do {
try AuthenticationServiceProvider.shared.delete(authentication: authenticationBox.authentication)
} catch {
assertionFailure("Failed to delete Authentication: \(error)")
}
// cancel push notification subscription