UNPKG

@updating-secrets/infisical-adapter

Version:

Infisical adapter for the updating-secrets package.

71 lines (70 loc) 2.71 kB
import { type JsonCompatibleValue } from '@augment-vir/common'; import { type InfisicalSDK, type ListSecretsOptions, type Secret } from '@infisical/sdk'; import { type RequireExactlyOne } from 'type-fest'; /** * Mock secrets setup for {@link MockInfisicalSdk}. * * @category Internal */ export type MockInfisicalSecrets = { projectId: string; /** `'dev'`, `'staging'`, `'prod'`, etc. */ env: string; secrets: { [SecretKey in string]: { folderPath?: string | undefined; } & RequireExactlyOne<{ /** * A value that will be JSON stringified for the `.SecretString` output of AWS Secrets * Manager. */ preJson: JsonCompatibleValue; /** Set the raw `.SecretString` output of AWS Secrets Manager directly. */ rawString: string; }>; }; }[]; /** * A mock implementation of `InfisicalSDK` from the * [@infisical/sdk](https://www.npmjs.com/package/@infisical/sdk) package. This only mocks what is * necessary for the infisical adapter to work. * * @category Mocks */ export declare class MockInfisicalSdk { /** Mock secrets that will be used in `secrets().listSecrets()` */ readonly mockSecrets: Readonly<MockInfisicalSecrets>; /** Keeps track of whether this SDK has been authorized or not. */ protected isAuthorized: boolean; constructor( /** Mock secrets that will be used in `secrets().listSecrets()` */ mockSecrets: Readonly<MockInfisicalSecrets>); /** Mock of `InfisicalSDK.auth()` */ auth(): { /** Mock of `InfisicalSDK.auth().universalAuth` */ universalAuth: { /** Mock of `InfisicalSDK.auth().universalAuth.login()` */ login: (options: import("@infisical/sdk").UniversalAuthLoginRequest) => Promise<InfisicalSDK>; /** Mock of `InfisicalSDK.auth().universalAuth.renew()` */ renew(): never; }; /** Mock of `InfisicalSDK.auth().accessToken` */ accessToken: (token: string) => InfisicalSDK; /** Mock of `InfisicalSDK.auth().awsIamAuth` */ awsIamAuth: { /** Mock of `InfisicalSDK.auth().awsIamAuth.login()` */ login: (options?: { identityId?: string; } | undefined) => Promise<InfisicalSDK>; /** Mock of `InfisicalSDK.auth().awsIamAuth.renew()` */ renew(): never; }; }; /** Mock of `InfisicalSDK.secrets()` */ secrets(): { /** Mock of `InfisicalSDK.secrets().listSecrets()` */ listSecrets: ({ projectId, environment }: ListSecretsOptions) => Promise<{ secrets: Partial<Secret>[]; }>; }; }