{"id":13467338,"url":"https://github.com/zalando/go-keyring","last_synced_at":"2025-03-26T01:30:46.035Z","repository":{"id":41297265,"uuid":"63615252","full_name":"zalando/go-keyring","owner":"zalando","description":"Cross-platform keyring interface for Go","archived":false,"fork":false,"pushed_at":"2024-10-25T07:41:36.000Z","size":121,"stargazers_count":862,"open_issues_count":25,"forks_count":87,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-10-29T20:36:45.991Z","etag":null,"topics":["authentication","dbus","golang","keyring","secret","utilities"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zalando.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-18T15:33:54.000Z","updated_at":"2024-10-29T10:17:02.000Z","dependencies_parsed_at":"2024-03-18T09:59:28.673Z","dependency_job_id":"dda41a95-8011-4db0-80a9-9b8be4324622","html_url":"https://github.com/zalando/go-keyring","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalando%2Fgo-keyring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalando%2Fgo-keyring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalando%2Fgo-keyring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalando%2Fgo-keyring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zalando","download_url":"https://codeload.github.com/zalando/go-keyring/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245571714,"owners_count":20637383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","dbus","golang","keyring","secret","utilities"],"created_at":"2024-07-31T15:00:55.214Z","updated_at":"2025-03-26T01:30:45.706Z","avatar_url":"https://github.com/zalando.png","language":"Go","funding_links":[],"categories":["Go","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Go Keyring library\n[![Go Report Card](https://goreportcard.com/badge/github.com/zalando/go-keyring)](https://goreportcard.com/report/github.com/zalando/go-keyring)\n[![GoDoc](https://godoc.org/github.com/zalando/go-keyring?status.svg)](https://godoc.org/github.com/zalando/go-keyring)\n\n`go-keyring` is an OS-agnostic library for *setting*, *getting* and *deleting*\nsecrets from the system keyring. It supports **OS X**, **Linux/BSD (dbus)** and\n**Windows**.\n\ngo-keyring was created after its authors searched for, but couldn't find, a better alternative. It aims to simplify\nusing statically linked binaries, which is cumbersome when relying on C bindings (as other keyring libraries do).\n\n#### Potential Uses\n\nIf you're working with an application that needs to store user credentials\nlocally on the user's machine, go-keyring might come in handy. For instance, if you are writing a CLI for an API\nthat requires a username and password, you can store this information in the\nkeyring instead of having the user type it on every invocation.\n\n## Dependencies\n\n#### OS X\n\nThe OS X implementation depends on the `/usr/bin/security` binary for\ninterfacing with the OS X keychain. It should be available by default.\n\n#### Linux and *BSD\n\nThe Linux and *BSD implementation depends on the [Secret Service][SecretService] dbus\ninterface, which is provided by [GNOME Keyring](https://wiki.gnome.org/Projects/GnomeKeyring).\n\nIt's expected that the default collection `login` exists in the keyring, because\nit's the default in most distros. If it doesn't exist, you can create it through the\nkeyring frontend program [Seahorse](https://wiki.gnome.org/Apps/Seahorse):\n\n * Open `seahorse`\n * Go to **File \u003e New \u003e Password Keyring**\n * Click **Continue**\n * When asked for a name, use: **login**\n\n## Example Usage\n\nHow to *set* and *get* a secret from the keyring:\n\n```go\npackage main\n\nimport (\n    \"log\"\n\n    \"github.com/zalando/go-keyring\"\n)\n\nfunc main() {\n    service := \"my-app\"\n    user := \"anon\"\n    password := \"secret\"\n\n    // set password\n    err := keyring.Set(service, user, password)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // get password\n    secret, err := keyring.Get(service, user)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    log.Println(secret)\n}\n\n```\n\n## Tests\n### Running tests\nRunning the tests is simple:\n\n```\ngo test\n```\n\nWhich OS you use *does* matter. If you're using **Linux** or **BSD**, it will\ntest the implementation in `keyring_unix.go`. If running the tests\non **OS X**, it will test the implementation in `keyring_darwin.go`.\n\n### Mocking\nIf you need to mock the keyring behavior for testing on systems without a keyring implementation you can call `MockInit()` which will replace the OS defined provider with an in-memory one.\n\n```go\npackage implementation\n\nimport (\n    \"testing\"\n\n    \"github.com/zalando/go-keyring\"\n)\n\nfunc TestMockedSetGet(t *testing.T) {\n    keyring.MockInit()\n    err := keyring.Set(\"service\", \"user\", \"password\")\n    if err != nil {\n        t.Fatal(err)\n    }\n\n    p, err := keyring.Get(\"service\", \"user\")\n    if err != nil {\n        t.Fatal(err)\n    }\n\n    if p != \"password\" {\n        t.Error(\"password was not the expected string\")\n    }\n\n}\n\n```\n\n## Contributing/TODO\n\nWe welcome contributions from the community; please use [CONTRIBUTING.md](CONTRIBUTING.md) as your guidelines for getting started. Here are some items that we'd love help with:\n\n- The code base\n- Better test coverage\n\nPlease use GitHub issues as the starting point for contributions, new ideas and/or bug reports.\n\n## Contact\n\n* E-Mail: team-teapot@zalando.de\n* Security issues: Please send an email to the [maintainers](MAINTAINERS), and we'll try to get back to you within two workdays. If you don't hear back, send an email to team-teapot@zalando.de and someone will respond within five days max.\n\n## Contributors\n\nThanks to:\n\n- [your name here]\n\n## License\n\nSee [LICENSE](LICENSE) file.\n\n\n[SecretService]: https://specifications.freedesktop.org/secret-service/latest/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzalando%2Fgo-keyring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzalando%2Fgo-keyring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzalando%2Fgo-keyring/lists"}