@dotenvx/next-env 2.5.6 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,131 +1,105 @@
1
- # @dotenvx/next-env
1
+ [![dotenvx](https://dotenvx.com/banner.png?v2)](https://dotenvx.com)
2
2
 
3
- `@dotenvx/next-env` is a drop-in replacement for Next.js' `@next/env` package.
3
+ *A secure dotenv*–from the creator of [`dotenv`](https://github.com/motdotla/dotenv).
4
4
 
5
- Use it when you want Next.js to load encrypted dotenvx files during Next's own environment-loading step. This lets decrypted values exist before Next.js evaluates server modules.
5
+ * Encrypt
6
+ * Commit
7
+ * Ship
8
+
9
+ [Install](https://dotenvx.com/docs/install) · [Quickstart](https://dotenvx.com/docs/nextjs/)
10
+
11
+ ## Quickstart
12
+
13
+ `@dotenvx/next-env` replaces Next.js’ `@next/env` loader. In your existing Next.js app, install it.
14
+
15
+ ```sh
16
+ npm install @dotenvx/next-env@^3.0.0
17
+ ```
18
+
19
+ Add the override to your app’s `package.json`.
6
20
 
7
21
  ```json
8
22
  {
9
- "dependencies": {
10
- "@dotenvx/next-env": "^2.5.3",
11
- "next": "^16.0.0"
12
- },
13
23
  "overrides": {
14
- "@next/env": "npm:@dotenvx/next-env"
24
+ "@next/env": "npm:@dotenvx/next-env@^3.0.0"
15
25
  }
16
26
  }
17
27
  ```
18
28
 
19
- After installing, run Next.js normally:
29
+ Run `npm install` again to apply the override.
20
30
 
21
- ```sh
22
- npm run dev
23
- npm run build
24
- ```
31
+ `.env`
25
32
 
26
- ## Third Party Notices
27
-
28
- This package bundles portions of `@dotenvx/primitives`, which bundles portions of the following MIT-licensed packages:
33
+ ```dotenv
34
+ HELLO=World
35
+ ```
29
36
 
30
- - `eciesjs`
31
- - `@ecies/ciphers`
32
- - `@noble/curves`
33
- - `@noble/hashes`
34
- - `@noble/ciphers`
37
+ `app/api/hello/route.js`
35
38
 
36
- ### eciesjs
39
+ ```js
40
+ export function GET() {
41
+ return new Response(`Hello ${process.env.HELLO}`)
42
+ }
43
+ ```
37
44
 
38
- MIT License
45
+ Run `npm run dev` and open `http://localhost:3000/api/hello` to see `Hello World`.
39
46
 
40
- Copyright (c) 2019-2026 Weiliang Li
47
+ - Prebuilt Node addons are included for macOS arm64/x64, Linux glibc arm64/x64,
48
+ and Windows x64.
49
+ - Stored key lookup requires a compatible `dotenvx` CLI on `PATH`. Keys in
50
+ `process.env` and `.env.keys` work without the CLI.
51
+ - Armor Enclave server-side decryption is unavailable in v3.
41
52
 
42
- Permission is hereby granted, free of charge, to any person obtaining a copy
43
- of this software and associated documentation files (the "Software"), to deal
44
- in the Software without restriction, including without limitation the rights
45
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46
- copies of the Software, and to permit persons to whom the Software is
47
- furnished to do so, subject to the following conditions:
53
+  
48
54
 
49
- The above copyright notice and this permission notice shall be included in all
50
- copies or substantial portions of the Software.
55
+ ## Usage
51
56
 
52
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
58
- SOFTWARE.
57
+ *Install* dotenvx.
59
58
 
60
- ### @ecies/ciphers
59
+ ```sh
60
+ $ curl -sfS https://dotenvx.sh | sh
61
+ ◈ installed (2.38.2:/usr/local/bin/dotenvx)
62
+ ```
61
63
 
62
- MIT License
64
+ *Encrypt* your secrets in `.env` files. The values become ciphertext and only your private key can unlock them.
63
65
 
64
- Copyright (c) 2019-2026 Weiliang Li
66
+ ```sh
67
+ $ dotenvx encrypt
68
+ ◈ encrypted .env (039 BCA) via .env.keys ⛉
69
+ ```
65
70
 
66
- Permission is hereby granted, free of charge, to any person obtaining a copy
67
- of this software and associated documentation files (the "Software"), to deal
68
- in the Software without restriction, including without limitation the rights
69
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
70
- copies of the Software, and to permit persons to whom the Software is
71
- furnished to do so, subject to the following conditions:
71
+ *Commit* your encrypted `.env` files with your code. Keep `.env.keys` out of git. The `-f` flag adds the encrypted file when your Next.js project ignores it.
72
72
 
73
- The above copyright notice and this permission notice shall be included in all
74
- copies or substantial portions of the Software.
73
+ ```sh
74
+ $ git add -f .env
75
+ $ git commit -m "encrypt .env"
76
+ ```
75
77
 
76
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
77
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
78
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
79
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
80
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
81
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
82
- SOFTWARE.
78
+ *Ship* your code and secrets together. Dotenvx uses your private key to decrypt and inject your secrets just-in-time to your code.
83
79
 
84
- ### @noble/curves and @noble/hashes
80
+ ```sh
81
+ $ npm run dev
82
+ ⟐ injected env (2) from .env (039 BCA) via .env.keys ⛉
83
+ ```
85
84
 
86
- The MIT License (MIT)
85
+ Set the matching private key, such as `DOTENV_PRIVATE_KEY`, in your deployment environment.
87
86
 
88
- Copyright (c) 2022 Paul Miller (https://paulmillr.com)
87
+  
89
88
 
90
- Permission is hereby granted, free of charge, to any person obtaining a copy
91
- of this software and associated documentation files (the “Software”), to deal
92
- in the Software without restriction, including without limitation the rights
93
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
94
- copies of the Software, and to permit persons to whom the Software is
95
- furnished to do so, subject to the following conditions:
89
+ ## Design
96
90
 
97
- The above copyright notice and this permission notice shall be included in
98
- all copies or substantial portions of the Software.
91
+ Three widely used and proven primitives make up Dotenvx's design. Git, .env, and secp256k1.
99
92
 
100
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
101
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
102
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
103
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
104
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
105
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
106
- THE SOFTWARE.
93
+ We chose git because it is the best way to deliver digital goods. It is the container ship of the digital world. All code travels on its ships. Why not secrets? Why invent an inferior secrets delivery mechanism when the world class one is right there at your fingertips.
107
94
 
108
- ### @noble/ciphers
95
+ We chose .env because it is the open standard for loading secrets into code. It represents environment variables, the core primitive that all secrets end up injected into at runtime of code.
109
96
 
110
- The MIT License (MIT)
97
+ Lastly, we needed to choose an encryption algorithm. Encryption of the values inside the .env file would allow us to place those values with code, leveraging git's distribution advantages while still following the twelve-factor config – by separating the decryption key from the code (environment).
111
98
 
112
- Copyright (c) 2022 Paul Miller (https://paulmillr.com)
113
- Copyright (c) 2016 Thomas Pornin <pornin@bolet.org>
99
+ It was important that we choose a proven, simple, asymmetric standard with small keys. We chose secp256k1, battle-tested by Bitcoin for more than seventeen years. We made cryptography an opinionated choice so developers wouldn't have to. Encryption just worked.
114
100
 
115
- Permission is hereby granted, free of charge, to any person obtaining a copy
116
- of this software and associated documentation files (the “Software”), to deal
117
- in the Software without restriction, including without limitation the rights
118
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
119
- copies of the Software, and to permit persons to whom the Software is
120
- furnished to do so, subject to the following conditions:
101
+ The result is a system built entirely from primitives, developers already understand, and infrastructure they already use. Secrets can travel with code without becoming part of the code. Git distributes them, .env defines how apps consume them, and secp256k1 keeps their values unreadable. The kicker, all this works by setting a single private key on your infrastructure - no more risky async coordination of secrets, no more centralized downtime risk. Your secrets are always just there with your code, ready to be unlocked at runtime.
121
102
 
122
- The above copyright notice and this permission notice shall be included in
123
- all copies or substantial portions of the Software.
103
+ [Read the whitepaper →](https://dotenvx.com/dotenvx.pdf?v=README)
124
104
 
125
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
126
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
127
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
128
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
129
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
130
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
131
- THE SOFTWARE.
105
+ &nbsp;
Binary file
Binary file
Binary file
Binary file
Binary file