Hi everyone!
I’d like to introduce PassStores.jl, an interface to the unix pass command. This package provides the PassStore struct, a read-only mapping from keys to passwords.
Installation & Usage
If you already use pass at the command line, you should find that PassStores.jl works with the standard installation and import process.
If you are new to pass, I’ve outlined some basic setup, but I would really recommend the manual (i.e.: man pass) and website. Once you are able to pass show example/password at the command line, you are ready to source these same passwords in Julia.
Install the package from the General registry:
pkg> add PassStores
Import the package and instantiate a PassStore:
using PassStores # exports only `PassStore`
store = PassStore() # default `pass` location
api_key = store["service/api_key"]
Non-default directories are supported with PassStore(path), and any custom PASSWORD_STORE_DIR in your environment is respected as the default.
For simplicity and security, PassStore instances are read-only, retrieving data directly from the pass command. There is no caching; all requests are on-demand.
Motivation
I have collected various passwords and tokens while working on other projects. Organizing these with pass is simple and avoids plaintext storage. The most noticeable drawback was accessibility: retrieving these secrets was much less convenient than ENV[...]. A PassStore provides that convenience.
In my startup.jl, I have the following lines:
using PassStores
const PASS = PassStore()
Later, at the REPL or in scripts:
password = PASS["example/password"];
Feedback
I hope that you find this as useful and convenient as I do. Give it a try, and let me know if you should encounter any issues—or if you find the documentation unclear or ambiguous.