@enspirit/emb
Version:
A replacement for our Makefile-for-monorepos
40 lines (39 loc) • 1.2 kB
TypeScript
/**
* Options for the OIDC login flow.
*/
export interface OidcLoginOptions {
/** Vault namespace (optional) */
namespace?: string;
/** Local port for the callback server (default: 8250) */
port?: number;
/** OIDC role to authenticate as (optional, uses default role if omitted) */
role?: string;
/** Timeout in milliseconds for the login flow (default: 120000 = 2 minutes) */
timeout?: number;
/** Vault server address */
vaultAddress: string;
}
/**
* Result of an OIDC login.
*/
export interface OidcLoginResult {
/** The Vault client token */
token: string;
/** Token TTL in seconds */
ttlSeconds: number;
}
/**
* Perform an interactive OIDC login with Vault.
*
* This function:
* 1. Starts a local HTTP server to receive the callback
* 2. Requests an OIDC auth URL from Vault
* 3. Opens the user's browser to the auth URL
* 4. Waits for the callback with the Vault token
* 5. Returns the token and TTL
*
* @param options - OIDC login options
* @returns The Vault client token and TTL
* @throws VaultError if the login fails
*/
export declare function performOidcLogin(options: OidcLoginOptions): Promise<OidcLoginResult>;