/**
 * Token management for Remnic multi-connector auth.
 *
 * Manages per-connector tokens in ~/.remnic/tokens.json.
 * Each connector gets a unique token with a recognizable prefix.
 */
interface TokenEntry {
    token: string;
    connector: string;
    createdAt: string;
}
interface TokenStore {
    tokens: TokenEntry[];
}
declare function loadTokenStore(tokensPath?: string): TokenStore;
declare function saveTokenStore(store: TokenStore, tokensPath?: string): void;
/**
 * Build a TokenEntry candidate WITHOUT saving it to the store.
 * Callers use this when they need to defer the save until after a
 * dependent write (e.g. Hermes config.yaml) succeeds — see
 * commitTokenEntry() to persist the candidate.
 */
declare function buildTokenEntry(connector: string): TokenEntry;
/**
 * Persist a pre-built TokenEntry into the store, replacing any existing
 * entry for the same connector. Used together with buildTokenEntry() when
 * the caller wants to defer the save until after a dependent write succeeds.
 *
 * For transactional rollback, callers should snapshot the full store via
 * loadTokenStore() BEFORE calling commitTokenEntry() and restore it with
 * saveTokenStore() on failure. A full-store snapshot handles partial writes
 * of tokens.json atomically — single-entry restore via the return value is
 * insufficient because if this function throws during saveTokenStore, the
 * return statement never executes (UXJI/UXJT fix).
 */
declare function commitTokenEntry(entry: TokenEntry, tokensPath?: string): void;
declare function generateToken(connector: string, tokensPath?: string): TokenEntry;
declare function listTokens(tokensPath?: string): TokenEntry[];
declare function revokeToken(connector: string, tokensPath?: string): boolean;
declare function getAllValidTokens(tokensPath?: string): string[];
declare function getAllValidTokensCached(tokensPath?: string): string[];
declare function resolveConnectorFromToken(token: string, tokensPath?: string): string | undefined;

export { type TokenEntry, type TokenStore, buildTokenEntry, commitTokenEntry, generateToken, getAllValidTokens, getAllValidTokensCached, listTokens, loadTokenStore, resolveConnectorFromToken, revokeToken, saveTokenStore };
