mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2026-02-06 14:06:52 +00:00
feat: only delete if the secret is present in the keychain
This commit is contained in:
parent
e50d1d01da
commit
5380edeeb9
@ -102,10 +102,19 @@ func (kc *Keychain) List() ([]string, error) {
|
||||
return userIDs, nil
|
||||
}
|
||||
|
||||
func (kc *Keychain) Delete(userID string) (err error) {
|
||||
func (kc *Keychain) Delete(userID string) error {
|
||||
kc.locker.Lock()
|
||||
defer kc.locker.Unlock()
|
||||
|
||||
userIDsByURL, err := kc.helper.List()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, ok := userIDsByURL[kc.secretURL(userID)]; !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
return kc.helper.Delete(kc.secretURL(userID))
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user