Other: Clear keychain entries on factory reset

This commit is contained in:
James Houlahan
2022-10-26 15:59:38 +02:00
parent 4a31017332
commit 7b7a2068ea
2 changed files with 29 additions and 0 deletions

View File

@ -125,6 +125,21 @@ func (kc *Keychain) Delete(userID string) error {
return kc.helper.Delete(kc.secretURL(userID))
}
func (kc *Keychain) Clear() error {
entries, err := kc.List()
if err != nil {
return err
}
for _, entry := range entries {
if err := kc.Delete(entry); err != nil {
return err
}
}
return nil
}
// Get returns the username and secret for the given userID.
func (kc *Keychain) Get(userID string) (string, string, error) {
kc.locker.Lock()