New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dotenvx/dotenvx

Package Overview
Dependencies
Maintainers
2
Versions
188
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotenvx/dotenvx - npm Package Compare versions

Comparing version 1.25.2 to 1.26.0

8

CHANGELOG.md

@@ -5,4 +5,10 @@ # Changelog

[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.25.2...main)
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.26.0...main)
## [1.26.0](https://github.com/dotenvx/dotenvx/compare/v1.25.2...v1.26.0)
### Added
* add `privateKey` option to `main.parse` method ([#474](https://github.com/dotenvx/dotenvx/pull/474))
## [1.25.2](https://github.com/dotenvx/dotenvx/compare/v1.25.1...v1.25.2)

@@ -9,0 +15,0 @@

2

package.json
{
"version": "1.25.2",
"version": "1.26.0",
"name": "@dotenvx/dotenvx",

@@ -4,0 +4,0 @@ "description": "a better dotenv–from the creator of `dotenv`",

@@ -1862,5 +1862,56 @@ [![dotenvx](https://dotenvx.com/better-banner.png)](https://dotenvx.com)

</details>
* <details><summary>`parse(src)`</summary><br>
Parse a `.env` string directly in node.js code.
```js
// index.js
const dotenvx = require('@dotenvx/dotenvx')
const src = 'HELLO=World'
const parsed = dotenvx.parse(src)
console.log(`Hello ${parsed.HELLO}`)
```
```sh
$ node index.js
Hello World
```
</details>
* <details><summary>`parse(src, {processEnv:})`</summary><br>
Sometimes, you want to run `parse` without it accessing `process.env`. (You can pass a fake processEnv this way as well - sometimes useful.)
```js
// index.js
const dotenvx = require('@dotenvx/dotenvx')
const src = 'USER=Me'
const parsed = dotenvx.parse(src, { processEnv: {} })
console.log(`Hello ${parsed.USER}`)
```
```sh
$ node index.js
Hello Me
```
</details>
* <details><summary>`parse(src, {privateKey:})`</summary><br>
Decrypt an encrypted `.env` string with `privateKey`.
```js
// index.js
const dotenvx = require('@dotenvx/dotenvx')
const src = 'HELLO="encrypted:BE9Y7LKANx77X1pv1HnEoil93fPa5c9rpL/1ps48uaRT9zM8VR6mHx9yM+HktKdsPGIZELuZ7rr2mn1gScsmWitppAgE/1lVprNYBCqiYeaTcKXjDUXU5LfsEsflnAsDhT/kWG1l"'
const parsed = dotenvx.parse(src, { privateKey: 'a4547dcd9d3429615a3649bb79e87edb62ee6a74b007075e9141ae44f5fb412c' })
console.log(`Hello ${parsed.HELLO}`)
```
```sh
$ node index.js
Hello World
```
</details>
&nbsp;

@@ -1867,0 +1918,0 @@

@@ -157,3 +157,3 @@ // @ts-check

// private decryption key
const privateKey = null // implement later
const privateKey = options.privateKey || null

@@ -163,4 +163,12 @@ // overload

const { parsed } = new Parse(src, privateKey, processEnv, overload).run()
const { parsed, errors } = new Parse(src, privateKey, processEnv, overload).run()
// display any errors
for (const error of errors) {
console.error(error.message)
if (error.help) {
console.error(error.help)
}
}
return parsed

@@ -167,0 +175,0 @@ }

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