1- // Configuración principal
1+ // Tipos genéricos sin dependencia de Express
2+ export interface TokenlyResponse {
3+ raw : string ;
4+ payload : {
5+ userId : string ;
6+ [ key : string ] : any ;
7+ } ;
8+ cookieConfig ?: {
9+ name : string ;
10+ value : string ;
11+ options : CookieConfig ;
12+ } ;
13+ }
14+
15+ export interface TokenRotationResponse {
16+ accessToken : TokenlyResponse ;
17+ refreshToken : TokenlyResponse ;
18+ }
19+
20+ // Tipos base sin Express
21+ export interface TokenlyContext {
22+ userAgent : string ;
23+ ip : string ;
24+ }
25+
26+ export interface TokenlyPayload {
27+ userId : string ;
28+ [ key : string ] : any ;
29+ }
30+
31+ // Configuraciones
232export interface TokenlyConfig {
3- accessTokenExpiry ?: string ;
4- refreshTokenExpiry ?: string ;
5- securityConfig ?: SecurityConfig ;
6- rotationConfig ?: RotationConfig ;
7- cookieConfig ?: CookieConfig ;
33+ accessTokenExpiry ?: string ;
34+ refreshTokenExpiry ?: string ;
35+ securityConfig ?: SecurityConfig ;
36+ rotationConfig ?: RotationConfig ;
37+ cookieConfig ?: CookieConfig ;
838}
939
1040// Configuraciones específicas
@@ -30,20 +60,6 @@ export interface CookieConfig {
3060 maxAge ?: number ;
3161}
3262
33- // Respuesta de token
34- export interface TokenlyResponse {
35- raw : string ;
36- payload : {
37- userId : string ;
38- [ key : string ] : any ;
39- } ;
40- cookieConfig ?: {
41- name : string ;
42- value : string ;
43- options : CookieConfig ;
44- } ;
45- }
46-
4763// Eventos
4864export interface TokenRevokedEvent {
4965 token : string ;
@@ -92,4 +108,27 @@ interface TokenSecurityAnalysis {
92108 issuedAt : Date ;
93109 timeUntilExpiry : number ;
94110 strength : 'weak' | 'medium' | 'strong' ;
111+ }
112+
113+ // Nuevos tipos para endpoints
114+ export interface TokenlyLoginResponse {
115+ token : string ;
116+ }
117+
118+ export interface TokenlyRefreshResponse {
119+ token : string ;
120+ }
121+
122+ // Tipos para handlers
123+ export interface TokenlyRequestHandlers {
124+ LoginHandler : RequestHandler <
125+ { } ,
126+ TokenlyLoginResponse ,
127+ { username : string ; password : string }
128+ > ;
129+
130+ RefreshHandler : RequestHandler <
131+ { } ,
132+ TokenlyRefreshResponse
133+ > ;
95134}
0 commit comments