zalando / go-keyring

Cross-platform keyring interface for Go
MIT License
881 stars 86 forks source link

[FEATURE REQUEST] Delete all keys for a service name #111

Open avallete opened 2 months ago

avallete commented 2 months ago

Use case

In our usage of the package, we register different secrets for different projects all over the same "service name" but with distincts username (each one matching the secret project id).

Issue is that when we want to "logout" an user it's hard to make sure all the secrets set by our app are deleted from the keychain.

Proposal

Exposing a DeleteAllKeys(servicename: string) method would fix that. Since we could ensure that all the user secrets are cleaned up after disconnecting.

Depending of the underlying keyring system it could be implemented by different means. I know that for osx, we could just call the "delete" without the "account" mentioned in a loop until we have nothing left to delete. I'm not sure for the other systems so I'm open to feedbacks.