@enspirit/emb
Version:
A replacement for our Makefile-for-monorepos
47 lines (46 loc) • 1.6 kB
TypeScript
/**
* Location where a secret reference was found.
*/
export interface SecretLocation {
/** Component name (if applicable) */
component?: string;
/** Field path within the config (e.g., "env.DB_PASSWORD") */
field: string;
/** File path where the reference was found */
file?: string;
}
/**
* A discovered secret reference in the configuration.
*/
export interface DiscoveredSecret {
/** Key within the secret (e.g., "password") */
key?: string;
/** Where this reference was found */
location: SecretLocation;
/** Original template string (e.g., "${vault:secret/myapp#password}") */
original: string;
/** Path to the secret (e.g., "secret/myapp/db") */
path: string;
/** Provider name (e.g., "vault") */
provider: string;
}
/**
* Discover all secret references in a configuration object.
*
* @param config - The configuration object to scan
* @param location - Base location information
* @param secretProviders - Set of registered secret provider names to look for
* @returns Array of discovered secret references
*/
export declare function discoverSecrets(config: Record<string, unknown>, location?: Omit<SecretLocation, 'field'>, secretProviders?: Set<string>): DiscoveredSecret[];
/**
* Deduplicate secret references by provider+path+key.
* Keeps track of all locations where each secret is used.
*/
export interface AggregatedSecret {
key?: string;
locations: SecretLocation[];
path: string;
provider: string;
}
export declare function aggregateSecrets(secrets: DiscoveredSecret[]): AggregatedSecret[];