Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

encrypt-env

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

encrypt-env

Share encrypted environment files through Git

  • 0.2.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

encrypt-env

Share encrypted environment files through Git

  • Basic usage as CLI tool
  • In code usage

Basic usage as CLI tool

encrypt-env looks for a file named .encrypt-env.json which is a map of your different environments and their encryption.

{
	"PRODUCTION": {
		"aesKey": "~/.ssh/foo.prod.aes",
		"envFile": ".prod.env"
	},
	"DEVELOPMENT": {
		"aesKey": "~/.ssh/foo.dev.aes",
		"envFile": ".dev.env"
	},
	"STAGING": {
		"aesKey": "~/.ssh/foo.dev.aes",
		"envFile": ".staging.env"
	}
}

You can generate AES keys from the CLI

encrypt-env generate

You can now use the encrypt-env CLI to encrypt and decrypt you environment files:

# decrypt .dev.env.enc and write result to .dev.env
encrypt-env --decrypt --env DEVELOPMENT --write

# decrypt .dev.env.enc and print to console (don't write)
encrypt-env --decrypt --env DEVELOPMENT

# encrypt .dev.env and write result to .dev.env.enc
encrypt-env --env DEVELOPMENT --write

# encrypt .dev.env and print to console (don't write)
encrypt-env --env DEVELOPMENT

Add these commands to your package.json or CLI build tool to automatically decrypt your environment at teste / deploy time

In code usage

You can also use encrypt-env directly in code without having your AES keys on the filesystem.

var encryptEnv = require('encrypt-env')('DEVELOPMENT', {
  "DEVELOPMENT": '6MTPfGGW3GbiW1JG5F1lP9T723MMleRJU'
});

// where encryptedEnv is an encrypted string
var decryptedEnv = encryptEnv.decryptEnv(false, encryptedEnv);

Keywords

FAQs

Package last updated on 03 Mar 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc