import { ITokenStorage } from './credential.type'; export interface ITokenManagerOptions { /** Called after every (re)set with the new token — e.g. to sync realtime socket. */ onRefreshed?: (token: string) => void; /** Header name carrying the token. Default `Authorization`. */ headerName?: string; /** Prefix prepended to the header value. Default `Bearer `. Pass `''` for raw. */ prefix?: string; } /** * Single source of truth for the access token. * * The HTTP layer (createApi) reads via `getHeader()` in its `onRequest` hook * and refreshes via `set()` in `onResponse` (sliding-session pattern). Pinia * stores MUST NOT store the token — they read `currentToken` (a reactive Vue * ref) for reactive access (e.g. `isLoggedIn`), or call `has()` for a * one-shot check. */ export declare class TokenManager { readonly headerName: string; readonly prefix: string; private readonly onRefreshed?; private storage; /** Reactive mirror of the stored token — the only reactive way to observe it. */ private readonly tokenRef; constructor(storage: ITokenStorage, opts?: ITokenManagerOptions); /** Reactive current token. Read this inside `computed` to track changes. */ get currentToken(): string | null; get(): string | null; /** Full header value ready to drop into a request (prefix + token). */ getHeader(): string | null; has(): boolean; set(token: string): void; clear(): void; /** Replace the underlying storage (e.g. upgrade memory → cookie after first login). */ swapStorage(storage: ITokenStorage): void; } //# sourceMappingURL=TokenManager.d.ts.map