fix(auth): make DeleteAPIKey resilient to keyring errors
Some checks failed
Security Scan / Security Analysis (push) Waiting to run
Security Scan / Native Library Security (push) Waiting to run
Checkout test / test (push) Successful in 4s
CI/CD Pipeline / Test (push) Has been cancelled
CI/CD Pipeline / Dev Compose Smoke Test (push) Has been cancelled
CI/CD Pipeline / Build (push) Has been cancelled
CI/CD Pipeline / Test Scripts (push) Has been cancelled
CI/CD Pipeline / Test Native Libraries (push) Has been cancelled
CI/CD Pipeline / Docker Build (push) Has been cancelled
Documentation / build-and-publish (push) Has been cancelled
Some checks failed
Security Scan / Security Analysis (push) Waiting to run
Security Scan / Native Library Security (push) Waiting to run
Checkout test / test (push) Successful in 4s
CI/CD Pipeline / Test (push) Has been cancelled
CI/CD Pipeline / Dev Compose Smoke Test (push) Has been cancelled
CI/CD Pipeline / Build (push) Has been cancelled
CI/CD Pipeline / Test Scripts (push) Has been cancelled
CI/CD Pipeline / Test Native Libraries (push) Has been cancelled
CI/CD Pipeline / Docker Build (push) Has been cancelled
Documentation / build-and-publish (push) Has been cancelled
DeleteAPIKey now ignores primary keyring errors (e.g., dbus unavailable) and always cleans up the fallback store
This commit is contained in:
parent
ec568b4c85
commit
1b0781dc68
1 changed files with 5 additions and 5 deletions
|
|
@ -92,11 +92,11 @@ func (km *KeychainManager) GetAPIKey(service, account string) (string, error) {
|
|||
|
||||
// DeleteAPIKey removes a key from both stores.
|
||||
func (km *KeychainManager) DeleteAPIKey(service, account string) error {
|
||||
if err := km.primary.Delete(service, account); err != nil &&
|
||||
!errors.Is(err, keyring.ErrNotFound) &&
|
||||
!errors.Is(err, keyring.ErrUnsupportedPlatform) {
|
||||
return fmt.Errorf("failed to delete API key: %w", err)
|
||||
}
|
||||
// Try to delete from primary keyring, but don't fail on keyring errors
|
||||
// (e.g., dbus unavailable, permission denied) - just clean up fallback
|
||||
_ = km.primary.Delete(service, account)
|
||||
|
||||
// Always clean up fallback
|
||||
if err := km.fallback.delete(service, account); err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue