mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 20:56:51 +00:00
feat: only delete if the secret is present in the keychain
This commit is contained in:
@ -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))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user