@tidecloak/js 0.13.14 → 0.13.15

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.
@@ -136,6 +136,7 @@ declare class IAMService {
136
136
  _nativeRequestEnclave: RequestEnclave | null;
137
137
  _nativeEncryptionCallbackUnsubscribe: any;
138
138
  _pendingEncryptionRequests: Map<any, any>;
139
+ _dpopProvider: import("../lib/tidecloak-dpop.js").DPoPSignatureProvider | null;
139
140
  /**
140
141
  * Register an event listener.
141
142
  * @param {'ready'|'initError'|'authSuccess'|'authError'|'authRefreshSuccess'|'authRefreshError'|'logout'|'tokenExpired'} event
@@ -280,6 +281,36 @@ declare class IAMService {
280
281
  encrypted: string | Uint8Array;
281
282
  tags: string[];
282
283
  }[]): Promise<(string | Uint8Array)[]>;
284
+ /**
285
+ * Drop-in replacement for fetch that automatically handles DPoP authentication.
286
+ * If the request includes a Bearer token matching the TideCloak-managed token,
287
+ * it's replaced with DPoP authorization and proof. Also manages resource server
288
+ * nonces automatically. Otherwise, behaves like regular fetch.
289
+ *
290
+ * @param {string|URL|RequestInfo} url - The resource URL to fetch
291
+ * @param {RequestInit} [init] - Optional fetch init options (same as standard fetch)
292
+ * @returns {Promise<Response>} A promise that resolves to the fetch Response
293
+ * @throws {Error} In hybrid mode (tokens are server-side)
294
+ *
295
+ * @example
296
+ * ```js
297
+ * const token = await IAMService.getToken();
298
+ * const response = await IAMService.secureFetch('https://api.example.com/data', {
299
+ * method: 'POST',
300
+ * headers: {
301
+ * 'Authorization': `Bearer ${token}`,
302
+ * 'Content-Type': 'application/json',
303
+ * },
304
+ * body: JSON.stringify({ key: 'value' }),
305
+ * });
306
+ * ```
307
+ */
308
+ secureFetch(url: string | URL | RequestInfo, init?: RequestInit): Promise<Response>;
309
+ /**
310
+ * Native mode secure fetch with DPoP support.
311
+ * @private
312
+ */
313
+ private _nativeSecureFetch;
283
314
  /**
284
315
  * Logout, clear cookie/session, then redirect.
285
316
  * In hybrid mode, clears local state and emits logout event.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidecloak/js",
3
- "version": "0.13.14",
3
+ "version": "0.13.15",
4
4
  "type": "module",
5
5
  "main": "dist/cjs/src/index.js",
6
6
  "module": "dist/esm/src/index.js",
@@ -32,6 +32,6 @@
32
32
  "silent-check-sso.html"
33
33
  ],
34
34
  "dependencies": {
35
- "heimdall-tide": "^0.13.14"
35
+ "heimdall-tide": "^0.13.15"
36
36
  }
37
37
  }