@xbg.solutions/utils-token-handler 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/firebase-adapter.d.ts +46 -0
- package/lib/firebase-adapter.d.ts.map +1 -0
- package/lib/firebase-adapter.js +207 -0
- package/lib/firebase-adapter.js.map +1 -0
- package/lib/firestore-database-adapter.d.ts +46 -0
- package/lib/firestore-database-adapter.d.ts.map +1 -0
- package/lib/firestore-database-adapter.js +118 -0
- package/lib/firestore-database-adapter.js.map +1 -0
- package/lib/generic-token-handler.d.ts +68 -0
- package/lib/generic-token-handler.d.ts.map +1 -0
- package/lib/generic-token-handler.js +176 -0
- package/lib/generic-token-handler.js.map +1 -0
- package/lib/index.d.ts +71 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +109 -0
- package/lib/index.js.map +1 -0
- package/lib/token-blacklist-manager.d.ts +78 -0
- package/lib/token-blacklist-manager.d.ts.map +1 -0
- package/lib/token-blacklist-manager.js +174 -0
- package/lib/token-blacklist-manager.js.map +1 -0
- package/lib/token-types.d.ts +239 -0
- package/lib/token-types.d.ts.map +1 -0
- package/lib/token-types.js +20 -0
- package/lib/token-types.js.map +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Handler Types
|
|
3
|
+
* Platform-agnostic types for token handling utilities
|
|
4
|
+
*/
|
|
5
|
+
import { Logger } from '@xbg/utils-logger';
|
|
6
|
+
/**
|
|
7
|
+
* Normalized token payload - platform-agnostic structure
|
|
8
|
+
* This is what applications work with internally, regardless of auth provider
|
|
9
|
+
*/
|
|
10
|
+
export interface NormalizedToken<TCustomClaims = Record<string, any>> {
|
|
11
|
+
authUID: string;
|
|
12
|
+
userUID: string | null;
|
|
13
|
+
email: string | null;
|
|
14
|
+
emailVerified: boolean;
|
|
15
|
+
phoneNumber: string | null;
|
|
16
|
+
issuedAt: number;
|
|
17
|
+
expiresAt: number;
|
|
18
|
+
issuer: string;
|
|
19
|
+
customClaims: TCustomClaims;
|
|
20
|
+
rawClaims: Record<string, any>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Token verification result
|
|
24
|
+
*/
|
|
25
|
+
export interface TokenVerificationResult<TCustomClaims = Record<string, any>> {
|
|
26
|
+
isValid: boolean;
|
|
27
|
+
isBlacklisted: boolean;
|
|
28
|
+
token: NormalizedToken<TCustomClaims> | null;
|
|
29
|
+
error: TokenVerificationError | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Token verification errors
|
|
33
|
+
*/
|
|
34
|
+
export declare enum TokenVerificationError {
|
|
35
|
+
EXPIRED = "EXPIRED",
|
|
36
|
+
INVALID_SIGNATURE = "INVALID_SIGNATURE",
|
|
37
|
+
BLACKLISTED = "BLACKLISTED",
|
|
38
|
+
MALFORMED = "MALFORMED",
|
|
39
|
+
ISSUER_MISMATCH = "ISSUER_MISMATCH",
|
|
40
|
+
UNKNOWN = "UNKNOWN"
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Blacklist entry
|
|
44
|
+
*/
|
|
45
|
+
export interface TokenBlacklistEntry {
|
|
46
|
+
blacklistEntryUID: string;
|
|
47
|
+
tokenJTI: string;
|
|
48
|
+
authUID: string;
|
|
49
|
+
blacklistedAt: Date;
|
|
50
|
+
blacklistedBy: string | null;
|
|
51
|
+
reason: string;
|
|
52
|
+
expiresAt: Date;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Abstract token adapter interface
|
|
56
|
+
* All auth provider implementations must implement this
|
|
57
|
+
*/
|
|
58
|
+
export interface ITokenAdapter<TCustomClaims = Record<string, any>> {
|
|
59
|
+
/**
|
|
60
|
+
* Verify token with the auth provider
|
|
61
|
+
* Returns provider-specific decoded token or throws error
|
|
62
|
+
*/
|
|
63
|
+
verifyToken(rawToken: string, logger: Logger): Promise<any>;
|
|
64
|
+
/**
|
|
65
|
+
* Generate unique identifier for token (for blacklist lookup)
|
|
66
|
+
* Different providers may use jti claim or hash of token
|
|
67
|
+
*/
|
|
68
|
+
getTokenIdentifier(rawToken: string): Promise<string>;
|
|
69
|
+
/**
|
|
70
|
+
* Normalize provider-specific token to platform-agnostic structure
|
|
71
|
+
*/
|
|
72
|
+
normalizeToken(providerToken: any, customClaimsConfig: CustomClaimsConfig<TCustomClaims>): NormalizedToken<TCustomClaims>;
|
|
73
|
+
/**
|
|
74
|
+
* Sync custom claims to auth provider
|
|
75
|
+
* Updates provider's custom claims with app data
|
|
76
|
+
*/
|
|
77
|
+
syncCustomClaims(authUID: string, claims: TCustomClaims, logger: Logger): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Revoke all tokens for a user at provider level (if supported)
|
|
80
|
+
* Not all providers support this - return false if unsupported
|
|
81
|
+
*/
|
|
82
|
+
revokeUserTokens(authUID: string, logger: Logger): Promise<boolean>;
|
|
83
|
+
/**
|
|
84
|
+
* Map provider-specific errors to standard error types
|
|
85
|
+
*/
|
|
86
|
+
mapProviderError(error: any): TokenVerificationError;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Configuration for custom claims extraction and validation
|
|
90
|
+
*/
|
|
91
|
+
export interface CustomClaimsConfig<TCustomClaims> {
|
|
92
|
+
/**
|
|
93
|
+
* Extract custom claims from provider token
|
|
94
|
+
*/
|
|
95
|
+
extract: (providerToken: any) => TCustomClaims;
|
|
96
|
+
/**
|
|
97
|
+
* Validate custom claims structure (optional)
|
|
98
|
+
*/
|
|
99
|
+
validate?: (claims: TCustomClaims) => boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Default/fallback claims when none exist
|
|
102
|
+
*/
|
|
103
|
+
defaults: Partial<TCustomClaims>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Database connector interface for blacklist operations
|
|
107
|
+
*/
|
|
108
|
+
export interface ITokenDatabase {
|
|
109
|
+
/**
|
|
110
|
+
* Add entry to blacklist
|
|
111
|
+
*/
|
|
112
|
+
addBlacklistEntry(entry: TokenBlacklistEntry): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Check if token identifier is blacklisted
|
|
115
|
+
*/
|
|
116
|
+
isTokenBlacklisted(tokenIdentifier: string): Promise<boolean>;
|
|
117
|
+
/**
|
|
118
|
+
* Get user's global token revocation timestamp
|
|
119
|
+
*/
|
|
120
|
+
getUserRevocationTime(authUID: string): Promise<Date | null>;
|
|
121
|
+
/**
|
|
122
|
+
* Add global revocation entry for user
|
|
123
|
+
*/
|
|
124
|
+
addUserRevocation(authUID: string, reason: string, blacklistedBy: string | null, expiresAt: Date): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Remove expired blacklist entries
|
|
127
|
+
*/
|
|
128
|
+
cleanupExpiredEntries(): Promise<number>;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Blacklist configuration
|
|
132
|
+
*/
|
|
133
|
+
export interface BlacklistConfig {
|
|
134
|
+
/**
|
|
135
|
+
* Database/collection to store blacklist entries
|
|
136
|
+
*/
|
|
137
|
+
storage: {
|
|
138
|
+
database: string;
|
|
139
|
+
collection: string;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Cleanup and retention settings
|
|
143
|
+
*/
|
|
144
|
+
retention: {
|
|
145
|
+
cleanupRetentionDays: number;
|
|
146
|
+
globalRevocationRetentionDays: number;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Valid blacklist reasons for this project
|
|
150
|
+
*/
|
|
151
|
+
reasons: string[];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Provider-specific configuration
|
|
155
|
+
*/
|
|
156
|
+
export interface ProviderConfig {
|
|
157
|
+
type: 'firebase' | 'auth0' | 'clerk' | 'custom';
|
|
158
|
+
firebase?: {
|
|
159
|
+
projectId?: string;
|
|
160
|
+
};
|
|
161
|
+
auth0?: {
|
|
162
|
+
domain: string;
|
|
163
|
+
audience: string;
|
|
164
|
+
};
|
|
165
|
+
clerk?: {
|
|
166
|
+
secretKey: string;
|
|
167
|
+
};
|
|
168
|
+
custom?: {
|
|
169
|
+
[key: string]: any;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Complete token handler configuration
|
|
174
|
+
*/
|
|
175
|
+
export interface TokenHandlerConfig<TCustomClaims = Record<string, any>> {
|
|
176
|
+
/**
|
|
177
|
+
* Custom claims configuration
|
|
178
|
+
*/
|
|
179
|
+
customClaims: CustomClaimsConfig<TCustomClaims>;
|
|
180
|
+
/**
|
|
181
|
+
* Blacklist settings
|
|
182
|
+
*/
|
|
183
|
+
blacklist: BlacklistConfig;
|
|
184
|
+
/**
|
|
185
|
+
* Auth provider configuration
|
|
186
|
+
*/
|
|
187
|
+
provider: ProviderConfig;
|
|
188
|
+
/**
|
|
189
|
+
* Database connector for blacklist operations
|
|
190
|
+
*/
|
|
191
|
+
database: ITokenDatabase;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Factory function signature for creating configured token handlers
|
|
195
|
+
*/
|
|
196
|
+
export type TokenHandlerFactory<TCustomClaims = Record<string, any>> = (config: TokenHandlerConfig<TCustomClaims>) => ITokenHandler<TCustomClaims>;
|
|
197
|
+
/**
|
|
198
|
+
* Main token handler interface
|
|
199
|
+
*/
|
|
200
|
+
export interface ITokenHandler<TCustomClaims = Record<string, any>> {
|
|
201
|
+
/**
|
|
202
|
+
* Verify and unpack raw token string
|
|
203
|
+
* Returns normalized token if valid, or error details if invalid
|
|
204
|
+
*/
|
|
205
|
+
verifyAndUnpack(rawToken: string, logger: Logger): Promise<TokenVerificationResult<TCustomClaims>>;
|
|
206
|
+
/**
|
|
207
|
+
* Generate token identifier for blacklist lookup
|
|
208
|
+
*/
|
|
209
|
+
getTokenIdentifier(rawToken: string): Promise<string>;
|
|
210
|
+
/**
|
|
211
|
+
* Sync custom claims to auth provider
|
|
212
|
+
*/
|
|
213
|
+
syncCustomClaims(authUID: string, claims: TCustomClaims, logger: Logger): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Revoke all tokens for a user at provider level
|
|
216
|
+
*/
|
|
217
|
+
revokeUserTokens(authUID: string, logger: Logger): Promise<boolean>;
|
|
218
|
+
/**
|
|
219
|
+
* Blacklist individual token
|
|
220
|
+
*/
|
|
221
|
+
blacklistToken(tokenIdentifier: string, authUID: string, reason: string, tokenExpiresAt: Date, blacklistedBy: string | null, logger: Logger): Promise<TokenBlacklistEntry>;
|
|
222
|
+
/**
|
|
223
|
+
* Blacklist all tokens for a user (global revocation)
|
|
224
|
+
*/
|
|
225
|
+
blacklistAllUserTokens(authUID: string, reason: string, blacklistedBy: string | null, logger: Logger): Promise<void>;
|
|
226
|
+
/**
|
|
227
|
+
* Check if token is blacklisted
|
|
228
|
+
*/
|
|
229
|
+
isTokenBlacklisted(tokenIdentifier: string, logger: Logger): Promise<boolean>;
|
|
230
|
+
/**
|
|
231
|
+
* Get user's token revocation timestamp
|
|
232
|
+
*/
|
|
233
|
+
getUserTokenRevocationTime(authUID: string, logger: Logger): Promise<Date | null>;
|
|
234
|
+
/**
|
|
235
|
+
* Cleanup expired blacklist entries
|
|
236
|
+
*/
|
|
237
|
+
cleanupExpiredEntries(logger: Logger): Promise<number>;
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=token-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-types.d.ts","sourceRoot":"","sources":["../src/token-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;;GAGG;AACH,MAAM,WAAW,eAAe,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAElE,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAGvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,OAAO,CAA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G,OAAO,CAAC,MAAM,CAAC,CAAC;CACxD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Token Handler Types
|
|
4
|
+
* Platform-agnostic types for token handling utilities
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TokenVerificationError = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Token verification errors
|
|
10
|
+
*/
|
|
11
|
+
var TokenVerificationError;
|
|
12
|
+
(function (TokenVerificationError) {
|
|
13
|
+
TokenVerificationError["EXPIRED"] = "EXPIRED";
|
|
14
|
+
TokenVerificationError["INVALID_SIGNATURE"] = "INVALID_SIGNATURE";
|
|
15
|
+
TokenVerificationError["BLACKLISTED"] = "BLACKLISTED";
|
|
16
|
+
TokenVerificationError["MALFORMED"] = "MALFORMED";
|
|
17
|
+
TokenVerificationError["ISSUER_MISMATCH"] = "ISSUER_MISMATCH";
|
|
18
|
+
TokenVerificationError["UNKNOWN"] = "UNKNOWN";
|
|
19
|
+
})(TokenVerificationError || (exports.TokenVerificationError = TokenVerificationError = {}));
|
|
20
|
+
//# sourceMappingURL=token-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-types.js","sourceRoot":"","sources":["../src/token-types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwCH;;GAEG;AACH,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,6CAAmB,CAAA;IACnB,iEAAuC,CAAA;IACvC,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,6DAAmC,CAAA;IACnC,6CAAmB,CAAA;AACrB,CAAC,EAPW,sBAAsB,sCAAtB,sBAAsB,QAOjC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xbg.solutions/utils-token-handler",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "JWT generation, verification, and blacklist management",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"build:watch": "tsc --watch",
|
|
13
|
+
"clean": "rm -rf lib",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@xbg/utils-logger": "^1.0.0",
|
|
18
|
+
"firebase-admin": "^12.0.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^20.11.0",
|
|
22
|
+
"typescript": "^5.3.3"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": "22"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
}
|
|
30
|
+
}
|