export interface TokenContext {
    platform: string;
    channelId: string;
    threadId: string;
    userId: string;
}
/**
 * Optional metadata the issuer may attach.
 *
 *  - `what`   : label shown on the H5 page and used as the new memo's
 *               `what` field if the token's flow CREATES a memo.
 *  - `memoId` : when set, the H5 callback UPDATES an existing memo's
 *               where_lat / where_lng instead of creating a new one.
 *               Used when agent already created the memo via save_memo
 *               and is now augmenting it with GPS.
 *
 * Server-side only — clients (the H5 page) can READ what/memoId via
 * /api/loc/info but never inject them.
 */
export interface TokenMeta {
    what?: string;
    memoId?: number;
}
export declare function issueToken(ctx: TokenContext, meta?: TokenMeta): {
    token: string;
    expiresAt: number;
    ttlSeconds: number;
};
/** Read-only peek — used by GET /api/loc/info so the H5 page can render
 *  "正在记录: <what>" without consuming the token. Returns null when the
 *  token is unknown or expired (auto-evicts expired). */
export declare function peekToken(token: string): {
    ctx: TokenContext;
    what: string;
    memoId: number | null;
    expiresAt: number;
} | null;
export type ConsumeResult = {
    ok: true;
    ctx: TokenContext;
    what: string;
    memoId: number | null;
} | {
    ok: false;
    reason: 'unknown' | 'expired';
};
/**
 * Consume a token — single-shot. After this call, the token is removed
 * from the store regardless of outcome (`expired` tokens are also dropped
 * to prevent retry brute-force scanning).
 */
export declare function consumeToken(token: string): ConsumeResult;
/** Test/diagnostic helper. */
export declare function _pendingCount(): number;
export declare function _clearAll(): void;
export declare function _stopSweep(): void;
//# sourceMappingURL=location-token.d.ts.map