import "../../types/Global"; import { Token } from "../../model/security/token"; /** * Maintains a list of valid tokens used by connected protocols. * * When a token expires, this module cleans up the corresponding connection's * subscriptions if any, and notify the user */ export declare class TokenManager { private tokens; private anonymousUserId; /** * Map */ private tokensByConnection; private timer; private readonly logger; constructor(); init(): Promise; runTimer(): void; /** * Link a connection and a token. * If one or another expires, associated subscriptions are cleaned up * @param token * @param connectionId */ link(token: Token, connectionId: string): void; /** * Unlink a connection from its associated token * * @param token * @param connectionId */ unlink(token: Token, connectionId: string): void; /** * Remove token associated with a connection. */ removeConnection(connectionId: string): Promise; /** * Called when a token expires before its time (e.g. following a * auth:logout action) * This method removes all maintained links and cleans up the * hotel clerk * * @param token */ expire(token: Token): Promise; /** * Refresh an existing token with a new one * * @param oldToken * @param newToken */ refresh(oldToken: Token, newToken: Token): void; checkTokensValidity(): Promise; /** * Gets the token matching user & connection if any */ getConnectedUserToken(userId: string, connectionId: string): Token | null; /** * Returns the kuid associated to a connection */ getKuidFromConnection(connectionId: string): string | null; /** * Adds token to internal collections * * @param token * @param connectionId */ private add; private removeConnectionLinkedToToken; private deleteByIndex; }