zalando / go-keyring

Cross-platform keyring interface for Go
MIT License
815 stars 82 forks source link

[Question] Persistent Keyring #56

Closed hardikmodha closed 3 years ago

hardikmodha commented 3 years ago

Hi, First of all, thanks to the maintainer team for the wonderful library.

Does go-keyring provide a persistent mechanism? Is it cross-platform? e.g. I want to persist some secret which should remain across machine restarts for n number of days. I've observed that stored secrets were getting removed when restarting the machine. Is it possible to achieve this with this library?

mikkeloscar commented 3 years ago

It uses the OS native keychain so it depends on that whether the credentials are stored or not. I personally use Linux and there they are persisted via the SecretService keychain implementation.

If you observe something else maybe we need to investigate what's happening. What OS are you using?

pjcdawkins commented 3 years ago

Just to confirm for me - I use this on MacOS and Linux and the tokens are permanent / they persist after restarting

hardikmodha commented 3 years ago

Thanks for the confirmation guys. ATM I don't have all the necessary details as the issue was reported internally by someone else, I posted here to get inputs from the community. I'll get back with more details soon.

hardikmodha commented 3 years ago

@mikkeloscar

I personally use Linux and there they are persisted via the SecretService keychain implementation.

Does SecretService keychain implementation require any additional packages like libdbus on Linux OS for persistent keyring? Is it present by default on Ubuntu, Redhat Enterprise Linux (RHEL), and CentOS?

pjcdawkins commented 3 years ago

It needs libdbus.

AFAIK Secret Service was supposed to be a standard, but it is only really implemented by the Gnome keyring - https://wiki.gnome.org/Projects/GnomeKeyring/KeyringIntro It should be present wherever you have Gnome installed.

There's a PR #52 open for kwallet (KDE) support (that also needs dbus).