Note: For Learning Purpose.
All credits to Gophercises.
MiniVault is a package that can be used to store/retrieve secrets to/from a file. It encrypts the file contents using the key that you provide.
MiniVault uses AES for encryption and crypto/cipher package's cipher.Stream to create DecryptReader and EncryptWriter which can decrypt while reading from a file and encrypt while writing to a file respectively.
The repo also contains a command line tool (in cmd/) written using the minivault package.
minivault [command]
Available Commands:
get Gets a secret from your secret storage
ls Lists all keys stored
passwd Change current key of your secret storage
rm Removes a key and it's value from secret storage
set Sets a secret in your secret storage
Flags:
-f, --file string the path to file where secrets are stored
If -f is not provided, it stores secrets to $HOME/.secrets on Unix and %USERPROFILE%\\.secrets on Windows.
$> minivault set github_api_key 0imfnc8mVLWwsAawjYr4Rx-Af50DDqtlx
encoding key :
Value set successfully!
$> minivault get github_api_key
encoding key :
0imfnc8mVLWwsAawjYr4Rx-Af50DDqtlx
git clone https://github.com/opxyc/minivault && cd minivault
go install cmd/cli.goNow, ideally, it should generate a new executable cli in $GOPATH/bin. It can be renamed accordingly (Go does not currently provide an option to give a custom name for the binary generated during installation - as of 1.7).