@ahoo-wang/fetcher-cosec 3.16.8 → 3.16.10
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/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/jwtToken.d.ts +7 -7
- package/dist/jwts.d.ts.map +1 -1
- package/dist/tokenStorage.d.ts +2 -2
- package/package.json +1 -1
package/dist/jwtToken.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface IJwtToken<Payload extends JwtPayload> extends EarlyPeriodCapabl
|
|
|
48
48
|
*
|
|
49
49
|
* @example
|
|
50
50
|
* ```typescript
|
|
51
|
-
* const token = new JwtToken<CoSecJwtPayload>('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
|
|
51
|
+
* const token = new JwtToken<CoSecJwtPayload>('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...', 300); // 5 min early period
|
|
52
52
|
* console.log(token.isExpired); // false if not expired
|
|
53
53
|
* console.log(token.payload?.sub); // user ID from payload
|
|
54
54
|
* ```
|
|
@@ -67,8 +67,8 @@ export declare class JwtToken<Payload extends JwtPayload> implements IJwtToken<P
|
|
|
67
67
|
* for expiration checks.
|
|
68
68
|
*
|
|
69
69
|
* @param token The raw JWT token string to parse
|
|
70
|
-
* @param earlyPeriod The early expiration period in
|
|
71
|
-
* Tokens are considered expired this many
|
|
70
|
+
* @param earlyPeriod The early expiration period in seconds (default: 0).
|
|
71
|
+
* Tokens are considered expired this many seconds before their actual expiration time.
|
|
72
72
|
*
|
|
73
73
|
* @throws Will not throw but payload will be null if token parsing fails
|
|
74
74
|
*/
|
|
@@ -114,7 +114,7 @@ export interface RefreshTokenStatusCapable {
|
|
|
114
114
|
* const compositeToken = new JwtCompositeToken({
|
|
115
115
|
* accessToken: 'access.jwt.here',
|
|
116
116
|
* refreshToken: 'refresh.jwt.here'
|
|
117
|
-
* },
|
|
117
|
+
* }, 300); // 5 min early period
|
|
118
118
|
*
|
|
119
119
|
* if (compositeToken.authenticated) {
|
|
120
120
|
* console.log(compositeToken.currentUser?.sub);
|
|
@@ -142,7 +142,7 @@ export declare class JwtCompositeToken implements EarlyPeriodCapable, RefreshTok
|
|
|
142
142
|
* Initializes both access and refresh token instances with the provided early period.
|
|
143
143
|
*
|
|
144
144
|
* @param token The composite token containing access and refresh token strings
|
|
145
|
-
* @param earlyPeriod The early expiration period in
|
|
145
|
+
* @param earlyPeriod The early expiration period in seconds (default: 0)
|
|
146
146
|
*/
|
|
147
147
|
constructor(token: CompositeToken, earlyPeriod?: number);
|
|
148
148
|
/**
|
|
@@ -172,7 +172,7 @@ export declare class JwtCompositeToken implements EarlyPeriodCapable, RefreshTok
|
|
|
172
172
|
*
|
|
173
173
|
* @example
|
|
174
174
|
* ```typescript
|
|
175
|
-
* const serializer = new JwtCompositeTokenSerializer(
|
|
175
|
+
* const serializer = new JwtCompositeTokenSerializer(300);
|
|
176
176
|
* const token = new JwtCompositeToken({ accessToken: '...', refreshToken: '...' });
|
|
177
177
|
*
|
|
178
178
|
* const serialized = serializer.serialize(token);
|
|
@@ -184,7 +184,7 @@ export declare class JwtCompositeTokenSerializer implements Serializer<string, J
|
|
|
184
184
|
/**
|
|
185
185
|
* Creates a new JwtCompositeTokenSerializer instance.
|
|
186
186
|
*
|
|
187
|
-
* @param earlyPeriod The early expiration period in
|
|
187
|
+
* @param earlyPeriod The early expiration period in seconds to use for deserialized tokens (default: 0)
|
|
188
188
|
*/
|
|
189
189
|
constructor(earlyPeriod?: number);
|
|
190
190
|
/**
|
package/dist/jwts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwts.d.ts","sourceRoot":"","sources":["../src/jwts.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;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AGG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CA6B7E;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,GAAG,eAAe,EAC/B,WAAW,GAAE,MAAU,GACtB,OAAO,CAiBT"}
|
package/dist/tokenStorage.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface TokenStorageOptions extends Partial<Omit<KeyStorageOptions<JwtC
|
|
|
19
19
|
*/
|
|
20
20
|
export declare class TokenStorage extends KeyStorage<JwtCompositeToken> implements EarlyPeriodCapable {
|
|
21
21
|
/**
|
|
22
|
-
* The early period in
|
|
22
|
+
* The early period in seconds for token refresh timing.
|
|
23
23
|
*/
|
|
24
24
|
readonly earlyPeriod: number;
|
|
25
25
|
/**
|
|
@@ -27,7 +27,7 @@ export declare class TokenStorage extends KeyStorage<JwtCompositeToken> implemen
|
|
|
27
27
|
* @param options - Configuration options for the token storage.
|
|
28
28
|
* @param options.key - The storage key for tokens. Defaults to DEFAULT_COSEC_TOKEN_KEY.
|
|
29
29
|
* @param options.eventBus - Event bus for token change notifications. Defaults to a BroadcastTypedEventBus with SerialTypedEventBus delegate.
|
|
30
|
-
* @param options.earlyPeriod - Early period for token refresh in
|
|
30
|
+
* @param options.earlyPeriod - Early period for token refresh in seconds. Defaults to 0.
|
|
31
31
|
* @param reset - Additional options passed to KeyStorage.
|
|
32
32
|
*/
|
|
33
33
|
constructor({ key, eventBus, earlyPeriod, ...reset }?: TokenStorageOptions);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahoo-wang/fetcher-cosec",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.10",
|
|
4
4
|
"description": "Enterprise-grade CoSec authentication integration for the Fetcher HTTP client with comprehensive security features including automatic token management, device tracking, and request attribution.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fetch",
|