pnv 2.0.0
pnv: ^2.0.0 copied to clipboard
A package to help with safely storing environment variables publicly
Change Log #
2.0.0 | 08.13.26 #
A major version because several changes are breaking for automation: commands that used to exit 0 on input they mishandled now exit non-zero, the generated .env format changed, and generate dart refuses input it previously accepted. Existing secrets keep decrypting.
Breaking Changes #
- Commands that cannot do what was asked now exit non-zero and name the input they could not handle. Several previously printed a success line and exited
0, so a pipeline that passed before may now fail — where it was already producing the wrong result generate envrefuses an unrecognised--flavorinstead of treating it as "no filter". A typo used to generate every environment on disk, production includedgenerate dartfails on an env key that cannot become a valid Dart identifier, instead of emitting a file that does not compilegenerate dartrefuses an output directory holding files it did not generate, rather than deleting them- Values written to
.envare escaped, so a value containing a quote or a newline survives intact. Anything parsing the generated.envshould expect\"and\n - Generated
.envfiles no longer carry# ./# .pathbreadcrumb comments before each nested block. The key prefix already carried the full path, and they collided with the# typeconvention - New secrets are written as
SECRET;v1:and cannot be read by pnv 1.7.x, so upgrade the whole team together. ExistingSECRET;secrets keep decrypting, and theSECRET;prefix is unchanged, so scripts that globSECRET;*or grep for it keep working pnv create keygenerates 32 random bytes instead of 12. Existing 12-byte keys keep working and existing secrets are unaffected- Errors are reported through the logger rather than
print, so they go to stderr and respect--quiet
Features #
pnv set/pnv get— encrypt a value straight into a.yamlfile, and read one back. No more copying a token out of the terminal and finding the right nesting level by hand. Comments, key order and indentation are preserved; missing groups are createdpnv verify— checks that a secrets file is actually safe to commit. Every secret decrypts under the flavor its file name implies, no value that looks like a secret sits in plaintext, and the key storage directory is not inside the project. Read-only, non-zero on failure, meant for CI and pre-commit hookspnv rotate— re-encrypt a file or directory under a different key.--tomoves to an existing flavor,--new-keymints a fresh one and keeps the old at<flavor>.key.previous. All-or-nothing, and it never deletes the old keypnv import— build an encrypted.yamlfrom an existing.env, so adopting pnv is one command rather than oneencryptper valuepnv show— print a file with its secrets decrypted, for use as a git textconv driver sogit diffon a secrets file is readablepnv initis scriptable —--storage, repeatable--flavor,--yesand--gitignore. It was the only command that could not run without a terminal- Add
--per-linetoto-dart-define, for values containing whitespace, which cannot survive$(...) - Secrets carry a version and a four-byte key fingerprint, so a secret encrypted under the wrong flavor is reported as exactly that rather than as a possible key problem
- Key files are created with
0600permissions pnv initwarns when the key storage directory is inside the project
Fixes #
to-dart-defineno longer drops values containing=, such as base64, and no longer leaks trailing# typecomments into the argumentgenerate envrenders the whole batch before writing any of it, so a failure part way leaves nothing behind instead of a half-populated output directorygenerate dart --directorygenerates every file rather than only the first- A type comment attaches only to its own key. A nested
db.port: # intused to type an unrelated top-levelport: create flavor --forceoverwrites without prompting, so it works where there is no terminaldelete flavorfails on a flavor that does not exist instead of reporting success- Keys that are not valid base64, or are too short, are rejected by name. Key validation measured the hash, which is always 32 bytes, so it accepted everything
- Decryption failures distinguish a corrupt value from a wrong key, and name the file and key that failed
- The CLI reports its own name as
pnvrather thansecrets create keyterminates its output with a newline- A secret is 12 bytes smaller: the version made it possible to drop the auth tag that was written twice
Chore #
- An end-to-end suite (
dart test -t e2e) drives the real executable against a real project, pinning the contract shell scripts depend on — theSECRET;prefix, plaintext on the last line of stdout, errors on stderr, and exit codes llms.txtships with the package: a complete, verified reference for AI coding agents
1.7.2 | 12.18.25 #
Fixes #
- Fix issue where base64 encoded secrets were not being properly decoded when generating Dart files from
.envfiles
1.7.1 | 10.15.25 #
Features #
- Disable dart format when generating Dart files from
.envfiles - Ignore lines longer than 80 characters when generating Dart files from
.envfiles
1.6.0 | 6.7.25 #
1.5.0 | 5.08.25 #
1.4.2 | 5.02.25 #
Features #
- Add ability to create flavors during the
initcommand - Create new key when flavor exists within the config but the key does not
- Add
delete flavorcommand to delete a flavor and the key associated with it
Enhancements #
- Add error handling to the
generate envcommand when no input or directory is provided
Chore #
- Update README.md
1.3.0 | 3.13.25 #
Features #
- Add
generate dartcommand to generate Dart files from env files
Fixes #
- Fix issue where a flavor that was included in the list of additional extensions would cause an error to be thrown
Deprecations #
generate-envcommand has been deprecated in favor of thegenerate envcommand- Functionality remains the same
1.2.0 | 2.5.25 #
Features #
- Create a
.pnvrcconfig file to handle multiple flavors and storage location to easily manage secrets- Add
pnv initcommand to create a.pnvrcfile - Point to the directory where the encryption keys are stored and the flavors will be imported automatically
- Add
- Encrypt, decrypt, and generate env files with the new
--flavorflag - Create a new flavor with the
create flavorcommand- Creates a new encryption key and flavor within the configuration file
Deprecations #
These deprecations will be removed in the next major release
create-keycommand has been deprecated in favor of thecreate keycommand
1.1.0 | 11.29.24 #
Enhancements #
- Instead of separated commas,
to-dart-defineformats the output space separated using the-Dflag
1.0.0 | 11.15.24 #
- Initial release