UNPKG

@nbn23/secret-manager

Version:
39 lines (38 loc) 1.24 kB
import { SecretManagerServiceClient } from "@google-cloud/secret-manager"; /** * Options type. * @type * @public */ export type Options = { projectId?: string; }; /** * SecretManager is responsible of obtain secret values related to a `projectId` * @class * @constructor * @public */ export declare class SecretManager { protected options: Options; protected manager: SecretManagerServiceClient; constructor(options?: Options); private getName; private getEnvVarSecrets; private _get; /** * Obtains the secret values associated to one or multiple `keys`. * If one or more secrets not exists returns undefined for each one. * * @param {string[]} keys The keys to identify the secrets. * * @returns {string[]} The values associated to the `keys` or if one or more secrets not exists undefined for each one. */ get(...keys: string[]): Promise<Array<string | undefined>>; /** * Manage the secrets from environment values. If one or more env vars has is value equal to `@secret`, * * @returns {boolean} Returns true if secrets are resolved from Google, false if secrets are returned from cache. */ manageSecrets(): Promise<boolean>; }