@samveys/env-crypt
svs env:encrypt and env:decrypt
This list was read from version 1.0.2; run pnpm sync to refresh it.
import { decryptEnv, encryptEnv, envCrypt, generateEnvKey, ENV_KEY_NAME, envDecryptCommand, … } from '@samveys/env-crypt'
Function (4)
decryptEnv
Function
Reverses {@link encryptEnv}. Any change to the file, or the wrong key, is SVS_E118.
function decryptEnv(text: string, key: string | undefined): string;
Exported from packages/env-crypt/src/crypt.ts
encryptEnv
Function
Encrypts env file text. - Whole-file mode (default): the entire file becomes one authenticated blob behind a marker line. - `readable: true`: every `NAME=value` keeps its `NAME=` and the value (everything after `=`, quotes and trailing comments included) becomes `enc:v1:<base64>`. Comments, blank lines and line endings stay as they were. `decryptEnv` returns the original text byte for byte.
function encryptEnv(text: string, key: string | undefined, options?: {
Exported from packages/env-crypt/src/crypt.ts
envCrypt
Function
The `@samveys/env-crypt` plugin: adds `svs env:encrypt` and `svs env:decrypt`.
function envCrypt(): import("@samveys/core").Plugin<undefined>;
Exported from packages/env-crypt/src/plugin.ts
generateEnvKey
Function
A fresh key in the format `SAMVEYS_ENV_KEY` expects.
function generateEnvKey(): string;
Exported from packages/env-crypt/src/crypt.ts
Value (5)
ENV_KEY_NAME
Value
No documentation comment.
const ENV_KEY_NAME = "SAMVEYS_ENV_KEY";
Exported from packages/env-crypt/src/commands.ts
envDecryptCommand
Value
The `svs env:decrypt` command.
const envDecryptCommand: Command<typeof decryptFlags>;
Exported from packages/env-crypt/src/commands.ts
envEncryptCommand
Value
The `svs env:encrypt` command. The key comes from `SAMVEYS_ENV_KEY`; when it is missing one is generated and printed once.
const envEncryptCommand: Command<typeof encryptFlags>;
Exported from packages/env-crypt/src/commands.ts
VALUE_PREFIX
Value
Prefix of an encrypted value in readable mode: `NAME=enc:v1:<base64>`.
const VALUE_PREFIX = "enc:v1:";
Exported from packages/env-crypt/src/crypt.ts
WHOLE_FILE_MARKER
Value
First line of a whole-file encrypted env file.
const WHOLE_FILE_MARKER = "# svs-env v1 whole-file\n";
Exported from packages/env-crypt/src/crypt.ts