import { TokenGenerator, TokenRepository, Token, TokenManager, StoredToken, AssociatedValueToToken } from '../../api'; export declare enum TokenState { UNUSED = "UNUSED", ALREADY_USED = "ALREADY_USED" } export declare class TokenWithState implements Token { original: Token; state: TokenState; /** * @param original The original token that has been generated * @param state The state to associate with the token */ constructor(original: Token, state: TokenState); readonly value: string; } /** * Generate or validate tokens */ export declare class TokenManagerImpl implements TokenManager { private tokenGenerator; private tokenStorage; constructor(tokenGenerator: TokenGenerator, tokenStorage: TokenRepository); /** * Validate the token in the specified storage * @param token Token to validate * @param matcher A function used to compare stored value with something */ validate(token: Token, matcher?: (associatedValue?: AssociatedValueToToken) => Promise): Promise; generate(): Promise; save(token: Token, associatedValue?: AssociatedValueToToken): Promise; }