Using OS specific stores for storing CLI credentials for golang apps
This post is to show a simple way of using Docker’s credential helper package to utilize the system’s native credential store as storage for your Golang-based CLI applications’ login credentials. This means Keychain for OSX, wincred
for Windows, and pass
for Linux. We use pass
here since secretservice
, although supported, doesn’t work out of the box in headless servers.
Here’s a simple implementation of our Set
, Get
, and Del
functions.
Then we create our _darwin.go
, _linux.go
, and _windows.go
files for OS specific implementations.
Here’s a quickstart guide to setup pass
in Ubuntu systems.
Here’s an example on how to use our nativestore functions.
Finally, you can refer to the whole package here.
---If you have any questions or feedback, please reach out @flowerinthenyt.