UNPKG

1.09 kBTypeScriptView Raw
1import { StringMap } from '@naturalcycles/js-lib';
2/**
3 * Loads plaintext secrets from process.env, removes them, stores locally.
4 * Make sure to call this function early on server startup, so secrets are removed from process.env
5 *
6 * Does NOT delete previous secrets from secretMap.
7 */
8export declare function loadSecretsFromEnv(): void;
9/**
10 * Removes process.env.SECRET_*
11 */
12export declare function removeSecretsFromEnv(): void;
13/**
14 * Does NOT delete previous secrets from secretMap.
15 *
16 * If SECRET_ENCRYPTION_KEY argument is passed - will decrypt the contents of the file first, before parsing it as JSON.
17 */
18export declare function loadSecretsFromJsonFile(filePath: string, SECRET_ENCRYPTION_KEY?: string): void;
19/**
20 * json secrets are always base64'd
21 */
22export declare function secret<T = string>(k: string, json?: boolean): T;
23export declare function secretOptional<T = string>(k: string, json?: boolean): T | undefined;
24export declare function getSecretMap(): StringMap;
25/**
26 * REPLACES secretMap with new map.
27 */
28export declare function setSecretMap(map: StringMap): void;