import type { Logger } from '@aztec/foundation/log'; /** * Result of resolving the admin API key. * Contains the SHA-256 hex hash of the API key to be used by the auth middleware, * and optionally the raw key when newly generated (so the caller can display it). */ export interface AdminApiKeyResolution { /** The SHA-256 hash of the API key. */ apiKeyHash: Buffer; /** * The raw API key, only present when a new key was generated during this call. * The caller MUST display this to the operator — it will not be stored or returned again. */ rawKey?: string; } export interface ResolveAdminApiKeyOptions { /** SHA-256 hex hash of a pre-generated API key. When set, the node uses this hash directly. */ adminApiKeyHash?: string; /** If true, disable admin API key auth entirely. */ disableAdminApiKey?: boolean; /** If true, force-generate a new key even if one is already persisted. */ resetAdminApiKey?: boolean; /** Root data directory for persistent storage. */ dataDirectory?: string; } /** * Resolves the admin API key for the admin RPC endpoint. * * Strategy: * 1. If opt-out flag is set (`disableAdminApiKey`), return undefined (no auth). * 2. If a pre-generated hash is provided (`adminApiKeyHash`), use it directly. * 3. If a data directory exists, look for a persisted hash file * at `/admin/api_key_hash`: * - If `resetAdminApiKey` is set, skip loading and force-generate a new key. * - Found: use the stored hash (operator already saved the key from first run). * - Not found: auto-generate a random key, display it once, persist the hash. * 3. If no data directory: generate a random key * each run and display it (cannot persist). * * @param options - The options for resolving the admin API key. * @param log - Logger for outputting the key and status messages. * @returns The resolved API key hash, or undefined if auth is disabled. */ export declare function resolveAdminApiKey(options: ResolveAdminApiKeyOptions, log: Logger): Promise; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRtaW5fYXBpX2tleV9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS9hZG1pbl9hcGlfa2V5X3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBU3BEOzs7O0dBSUc7QUFDSCxNQUFNLFdBQVcscUJBQXFCO0lBQ3BDLHVDQUF1QztJQUN2QyxVQUFVLEVBQUUsTUFBTSxDQUFDO0lBQ25COzs7T0FHRztJQUNILE1BQU0sQ0FBQyxFQUFFLE1BQU0sQ0FBQztDQUNqQjtBQUVELE1BQU0sV0FBVyx5QkFBeUI7SUFDeEMsK0ZBQStGO0lBQy9GLGVBQWUsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUN6QixvREFBb0Q7SUFDcEQsa0JBQWtCLENBQUMsRUFBRSxPQUFPLENBQUM7SUFDN0IsMEVBQTBFO0lBQzFFLGdCQUFnQixDQUFDLEVBQUUsT0FBTyxDQUFDO0lBQzNCLGtEQUFrRDtJQUNsRCxhQUFhLENBQUMsRUFBRSxNQUFNLENBQUM7Q0FDeEI7QUFFRDs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FpQkc7QUFDSCx3QkFBc0Isa0JBQWtCLENBQ3RDLE9BQU8sRUFBRSx5QkFBeUIsRUFDbEMsR0FBRyxFQUFFLE1BQU0sR0FDVixPQUFPLENBQUMscUJBQXFCLEdBQUcsU0FBUyxDQUFDLENBMkQ1QyJ9