UNPKG

dotencr

Version:

Encrypt and decrypt individual lines inside a .env file. Supports multiple encryption keys. Keys and dotenv files can be read text file or read from the environment.

53 lines (52 loc) 2.26 kB
/// <reference types="node" /> import { Feedback } from "./feedback"; import { CryptoKeyManager } from "./crypto_key_manager"; import { MatchingDotenvVariable } from "./dotenv_variable"; import { CryptoWrapperResult, CryptoWrapperInterface } from "./crypto_wrapper"; import { DotenvParserBase } from "./dotenv_parser"; /** * This class read/writes/encrypts/decrypts the a dotenv file. * It can also test a dotenv file for errors. */ export declare class DotenvProcessor { plainTextParser: DotenvParserBase; cipheredTextParser: DotenvParserBase; matchingDotenvVariables: MatchingDotenvVariable[]; nonMatchingDotenvVariables: MatchingDotenvVariable[]; dotenvPath?: string; dotenvAsBuffer?: Buffer; cryptoKeyMgr: CryptoKeyManager; cryptoWrapper: CryptoWrapperInterface; /** * Used exclusively for testing to force the IV to be the same value, so encrypted * always match the expected value. If TRUE, this weakens the strength of the encryption. */ private forceIvToFixedValue; constructor(ckm: CryptoKeyManager, pathOrBuffer?: string | Buffer, forceIvToFixedValue?: boolean); defaultBackupPath(): string; createFileNameForBackupFile(backupFolder?: string): string; createBackupFile(backupFolder?: string): string; private determineMatchingCipheredAndPlainTextVariables; private feedbackPlainTextVariables; private feedbackErrorDecryptingVariables; private feedbackErrorEncryptingVariables; private feedbackErrorValuesDoNotMatch; private feedbackInfoMatchingValues; private feedbackSuccessfullyDecrypted; private feedbackSuccessfullyEncrypted; private feedbackEncryptionKeyErrors; private feedbackCipheredVariableErrors; private feedbackPlainTextVariableErrors; private feedbackMissingEncryptionKeys; private feedbackCipheredVariables; private feedbackEncryptionKeys; private feedbackInvalidVariableFormats; private testImplementation; test(): Feedback; decrypt(): CryptoWrapperResult[]; encrypt(): CryptoWrapperResult[]; private decryptImplementation; decryptToProcessEnvironment(): Feedback; decryptToFile(destinationFile: string): Feedback; encryptToFile(destinationFile: string): Feedback; }