/** * This file is part of the NocoBase (R) project. * Copyright (c) 2020-2024 NocoBase Co., Ltd. * Authors: NocoBase Team. * * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. * For more information, please refer to: https://www.nocobase.com/agreement. */ export interface TokenPolicyConfig { tokenExpirationTime: string; sessionExpirationTime: string; expiredTokenRenewLimit: string; } type millisecond = number; export type NumericTokenPolicyConfig = { [K in keyof TokenPolicyConfig]: millisecond; }; export type TokenInfo = { jti: string; userId: number; authenticator?: string; issuedTime: EpochTimeStamp; signInTime: EpochTimeStamp; renewed: boolean; }; export type JTIStatus = 'valid' | 'inactive' | 'blocked' | 'missing' | 'renewed' | 'expired'; export interface ITokenControlService { getConfig(): Promise; setConfig(config: TokenPolicyConfig): Promise; renew(jti: string): Promise<{ jti: string; issuedTime: EpochTimeStamp; }>; add({ userId, authenticator }: { userId: number; authenticator?: string; }): Promise; removeSessionExpiredTokens(userId: number): Promise; } export {};