UNPKG

@enspirit/emb

Version:

A replacement for our Makefile-for-monorepos

46 lines (45 loc) 1.42 kB
/** * Reference to a secret in a provider. */ export interface SecretReference { /** Optional field within the secret */ key?: string; /** Path to the secret, e.g., "secret/data/myapp/db" */ path: string; /** Optional version of the secret */ version?: string; } /** * Abstract base class for secret providers. * Implementations should handle specific secret management systems * (e.g., HashiCorp Vault, 1Password). */ export declare abstract class AbstractSecretProvider<C = unknown> { protected config: C; protected cache: Map<string, Record<string, unknown>>; constructor(config: C); /** * Connect to the secret provider and authenticate. */ abstract connect(): Promise<void>; /** * Disconnect from the secret provider and clean up resources. */ abstract disconnect(): Promise<void>; /** * Fetch a secret from the provider. * @param ref Reference to the secret * @returns The secret data as a key-value record */ abstract fetchSecret(ref: SecretReference): Promise<Record<string, unknown>>; /** * Get a secret value, using cache if available. * @param ref Reference to the secret * @returns The secret value (entire record if no key specified, or specific field value) */ get(ref: SecretReference): Promise<unknown>; /** * Clear the cache. */ clearCache(): void; }