import { TenantUser, AuthTenant, Principal } from "toyhauler-common/security"; import { TokenPayload } from "./Token"; /** Non-generic interface for use with collections of IJwtPayloadMapper. */ export interface IJwtPayloadMapperForObject { } /** converts jwt payloads to user objects */ export interface IJwtPayloadMapper extends IJwtPayloadMapperForObject { read(payload: TokenPayload): T | undefined; write(entity: T, existing?: TokenPayload): TokenPayload; } export declare class BuiltInJwtPayloadMapper implements IJwtPayloadMapper { /** Reads and writes the token expiration (as "exp") to the jwt payload. */ constructor(); private expirationKey; read(payload: TokenPayload): number | undefined; write(expiration: number, existing?: TokenPayload): TokenPayload; } export declare class TenantJwtMapper implements IJwtPayloadMapper { /** Maps Tenant objects to Jwt token payloads. * // NOTE!! Tenant in token is sparsely populated (missing subscription) * NOTE: data loss will occur transferring from tenant to jwt bc not all properties are stored in the Jwt payload. */ constructor(); read(payload: TokenPayload): AuthTenant | undefined; write(tenant: AuthTenant, existing?: TokenPayload): TokenPayload; } export declare class PrincipalJwtMapper implements IJwtPayloadMapper { /** Maps User objects to Jwt token payloads. */ constructor(); read(payload: TokenPayload): Principal | undefined; write(principal: Principal, existing?: TokenPayload): TokenPayload; } export declare class UserJwtMapper implements IJwtPayloadMapper { read(payload: TokenPayload): TenantUser | undefined; write(user: TenantUser, existing?: TokenPayload): TokenPayload; }