Other languages
Python, Go, PHP, Java, Ruby, .NET: any program can read the vault through coffre run, with no code changes and no cryptography to write.
Run with the secrets in the environment
Install the coffre CLI, set COFFREBOX_URL and COFFREBOX_TOKEN, and put coffre run -- before the command that starts your app:
# Python
coffre run -- python app.py
# Go
coffre run -- ./server
# PHP (Laravel)
coffre run -- php artisan serve
# Java
coffre run -- java -jar app.jar
# Ruby
coffre run -- bundle exec puma
# .NET
coffre run -- dotnet MyApi.dllYour program reads the secrets like any other environment variable:
import os
db = os.environ["DATABASE_URL"] # came from the vaultcoffre run reads the vault once, at startup. To pick up a new value, restart the process. The token isn’t passed to the program: it receives only the secrets.
Avoid a .env on disk
coffre env prints the secrets in plaintext, as dotenv or JSON, for cases where you can’t use coffre run. A .env written to disk brings back the problem the vault solves. If you need one, write it to a folder only you can read, ideally in memory, with 0600 permissions, and delete it right after. On Linux, $XDG_RUNTIME_DIR is that folder; don’t use /dev/shm or /tmp, which every user on the machine can see.
# umask 077: the file is created 0600, readable only by your user
file="${XDG_RUNTIME_DIR:?no private in-memory folder}/my-api.env"
(umask 077; coffre env --format dotenv --reveal > "$file")
# ... use the file ...
rm "$file"The --reveal flag is required because the output goes to a file.
A native client
The cryptography core (coffrebox-core, in Rust) and both SDKs are open source and show every check a client needs to do. The routes they use aren’t a public API: they may change between versions. If you want an SDK for another language, open an issue on GitHub before you start.