Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Integrate EnvKey with your Node.js projects to keep api keys, credentials, and other configuration securely and automatically in sync for developers and servers.
npm install 'envkey' --save
Then at the entry point of your application:
// main.js
require('envkey')
Or if you prefer ES6+ imports:
// main.js
import 'envkey'
Generate an ENVKEY
in the EnvKey App. Then set ENVKEY=...
, either in a gitignored .env
file in the root of your project (in development) or in an environment variable (on servers).
Now all your EnvKey variables will be available on process.env
.
The package will throw an error if an ENVKEY
is missing or invalid.
Assume you have STRIPE_SECRET_KEY
set to sk_test_2a33b045e998d2ef60c7861d2ac22ea8
for the development
environment in the EnvKey App. You generate a local development ENVKEY
.
In your project's gitignored .env
file:
# .env
ENVKEY=GsL8zC74DWchdpvssa9z-nk7humd7hJmAqNoA
In lib/stripe.js
:
var stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
Now STRIPE_SECRET_KEY
will stay automatically in sync for all the developers on your team.
For a server, generate a server ENVKEY
in the EnvKey App, then set the ENVKEY
as an environment variable instead of putting it in a .env
file.
Now your servers will stay in sync as well. If you need to rotate your STRIPE_SECRET_KEY
, you can do it in a few seconds in the EnvKey App, restart your servers, and you're good to go. All your team's developers and all your servers will have the new value.
The envkey package will not overwrite existing environment variables or additional variables set in a .env
file. This can be convenient for customizing environments that otherwise share the same configuration. You can also use sub-environments in the EnvKey App for this purpose.
The envkey package caches your encrypted config in development so that you can still use it while offline. Your config will still be available (though possibly not up-to-date) the next time you lose your internet connection. If you do have a connection available, envkey will always load the latest config. Your cached encrypted config is stored in $HOME/.envkey/cache
Since EnvKey is for configuration in addition to secrets, it can be convenient to inject a portion of your EnvKey config into your client-side code. This should be done by whitelisting variables that are safe for the client (i.e. can be made public) and injecting them during your build process. EnvKey has a webpack plugin to help you do it right.
If you look in the ext
directory of this package, you'll find a number of envkey-fetch
binaries for various platforms and architectures. These are output by the envkey-fetch Go library. It contains EnvKey's core cross-platform fetching, decryption, verification, web of trust, redundancy, and caching logic. It is completely open source.
For more on EnvKey in general:
Read the docs.
Read the integration quickstart.
Read the security and cryptography overview.
Post an issue or email us: support@envkey.com.
FAQs
EnvKey secures and simplifies configuration and secrets management.
The npm package envkey receives a total of 4,918 weekly downloads. As such, envkey popularity was classified as popular.
We found that envkey demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.