secure-env-ts
Version:
Use ENVs securely with encryption
61 lines (60 loc) • 1.47 kB
TypeScript
/// <reference types="node" />
import crypto from 'crypto';
import fs from 'fs';
export interface IDecryptOptions {
/**
* The secret key needed to encrypt/decrypt the file.\
* `Required`
* */
secret: string;
/**
* The env file to encrypt.\
* Default: `.env`
* */
inputFile?: fs.PathLike;
/**
* The path and name of the generated file \
* Default: `${inputFile}.enc`
* */
outputFile?: fs.PathLike;
/**
* The decryption algorithm to use.\
* Default: `aes256`
* */
decryptionAlgo?: crypto.CipherGCMTypes;
/**
* IV length.\
* Default: `16`
* */
ivLength?: number;
}
export interface IEncryptOptions {
/**
* The secret key needed to encrypt/decrypt the file.\
* **Required**
* */
secret: string;
/**
* The env file to encrypt.\
* Default: `.env`
* */
inputFile?: fs.PathLike;
/**
* The path and name of the generated file \
* Default: `${inputFile}.enc`
* */
outputFile?: fs.PathLike;
/**
* The encryption algorithm to use.\
* Default: `aes256`
* */
encryptionAlgo: crypto.CipherGCMTypes;
/**
* IV length.\
* Default: `16`
* */
ivLength?: number;
isEdit?: boolean;
}
export declare const decrypt: (options: IDecryptOptions) => (Buffer & string) | undefined;
export declare const encrypt: (options: IEncryptOptions) => Promise<void> | undefined;