@djangocfg/api 2.1.455 → 2.1.457

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.
Files changed (89) hide show
  1. package/dist/auth.cjs +1611 -2148
  2. package/dist/auth.cjs.map +1 -1
  3. package/dist/auth.d.cts +37 -82
  4. package/dist/auth.d.ts +37 -82
  5. package/dist/auth.mjs +1581 -2118
  6. package/dist/auth.mjs.map +1 -1
  7. package/dist/chunk-2G67QRNU.mjs +2096 -0
  8. package/dist/chunk-2G67QRNU.mjs.map +1 -0
  9. package/dist/chunk-32SRQGAC.mjs +2109 -0
  10. package/dist/chunk-32SRQGAC.mjs.map +1 -0
  11. package/dist/chunk-4BPRCONN.mjs +2098 -0
  12. package/dist/chunk-4BPRCONN.mjs.map +1 -0
  13. package/dist/chunk-5UZ2Z323.mjs +2021 -0
  14. package/dist/chunk-5UZ2Z323.mjs.map +1 -0
  15. package/dist/chunk-7KFTJXNM.mjs +2097 -0
  16. package/dist/chunk-7KFTJXNM.mjs.map +1 -0
  17. package/dist/chunk-BK4K5CVT.mjs +2019 -0
  18. package/dist/chunk-BK4K5CVT.mjs.map +1 -0
  19. package/dist/chunk-JLPJZ6WB.mjs +2020 -0
  20. package/dist/chunk-JLPJZ6WB.mjs.map +1 -0
  21. package/dist/chunk-TVU6PYJH.mjs +2032 -0
  22. package/dist/chunk-TVU6PYJH.mjs.map +1 -0
  23. package/dist/clients.cjs +292 -47
  24. package/dist/clients.cjs.map +1 -1
  25. package/dist/clients.d.cts +23 -0
  26. package/dist/clients.d.ts +23 -0
  27. package/dist/clients.mjs +292 -47
  28. package/dist/clients.mjs.map +1 -1
  29. package/dist/hooks.cjs +200 -32
  30. package/dist/hooks.cjs.map +1 -1
  31. package/dist/hooks.mjs +200 -32
  32. package/dist/hooks.mjs.map +1 -1
  33. package/dist/index.cjs +292 -47
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +81 -4
  36. package/dist/index.d.ts +81 -4
  37. package/dist/index.mjs +292 -47
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/sdk.gen-2SQOPTWJ.mjs +26 -0
  40. package/dist/sdk.gen-2SQOPTWJ.mjs.map +1 -0
  41. package/dist/sdk.gen-HSGK4C5S.mjs +26 -0
  42. package/dist/sdk.gen-HSGK4C5S.mjs.map +1 -0
  43. package/dist/sdk.gen-NUK2VGHO.mjs +25 -0
  44. package/dist/sdk.gen-NUK2VGHO.mjs.map +1 -0
  45. package/dist/sdk.gen-O4KAQUZB.mjs +26 -0
  46. package/dist/sdk.gen-O4KAQUZB.mjs.map +1 -0
  47. package/dist/sdk.gen-PPAVSBNT.mjs +26 -0
  48. package/dist/sdk.gen-PPAVSBNT.mjs.map +1 -0
  49. package/dist/sdk.gen-XLHLOCJ2.mjs +25 -0
  50. package/dist/sdk.gen-XLHLOCJ2.mjs.map +1 -0
  51. package/dist/sdk.gen-ZOE6NQAL.mjs +26 -0
  52. package/dist/sdk.gen-ZOE6NQAL.mjs.map +1 -0
  53. package/dist/sdk.gen-ZT7LGJVO.mjs +26 -0
  54. package/dist/sdk.gen-ZT7LGJVO.mjs.map +1 -0
  55. package/package.json +2 -2
  56. package/src/_api/generated/_cfg_accounts/hooks/index.ts +1 -0
  57. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenBlacklistCreate.ts +28 -0
  58. package/src/_api/generated/_cfg_accounts/openapi.json +99 -0
  59. package/src/_api/generated/_cfg_accounts/schemas/TokenBlacklistRequest.ts +11 -0
  60. package/src/_api/generated/_cfg_accounts/schemas/index.ts +1 -0
  61. package/src/_api/generated/_cfg_centrifugo/openapi.json +9 -0
  62. package/src/_api/generated/_cfg_totp/openapi.json +33 -0
  63. package/src/_api/generated/helpers/auth.ts +288 -31
  64. package/src/_api/generated/openapi.json +129 -0
  65. package/src/_api/generated/sdk.gen.ts +94 -16
  66. package/src/_api/generated/types.gen.ts +18 -0
  67. package/src/auth/__tests__/guard.test.ts +0 -31
  68. package/src/auth/constants.ts +6 -0
  69. package/src/auth/context/AccountsContext.tsx +14 -24
  70. package/src/auth/context/AuthContext.tsx +263 -607
  71. package/src/auth/context/types.ts +13 -0
  72. package/src/auth/hooks/index.ts +8 -5
  73. package/src/auth/hooks/useAuthRedirect.ts +17 -0
  74. package/src/auth/hooks/useGithubAuth.ts +3 -3
  75. package/src/auth/hooks/useSession.ts +22 -0
  76. package/src/auth/hooks/useTwoFactor.ts +8 -6
  77. package/src/auth/middlewares/index.ts +5 -6
  78. package/src/auth/utils/guard.ts +0 -22
  79. package/src/auth/utils/index.ts +0 -2
  80. package/src/_api/generated/_cfg_accounts/events.ts +0 -198
  81. package/src/_api/generated/_cfg_centrifugo/events.ts +0 -198
  82. package/src/_api/generated/_cfg_totp/events.ts +0 -198
  83. package/src/auth/__tests__/jwt.test.ts +0 -119
  84. package/src/auth/__tests__/sessionBootstrap.test.ts +0 -111
  85. package/src/auth/__tests__/useTokenRefresh.dom.test.tsx +0 -167
  86. package/src/auth/hooks/useAuthGuard.ts +0 -35
  87. package/src/auth/hooks/useTokenRefresh.ts +0 -131
  88. package/src/auth/refreshHandler.ts +0 -79
  89. package/src/auth/utils/jwt.ts +0 -66
package/dist/index.cjs CHANGED
@@ -238,6 +238,89 @@ var _onUnauthorized = null;
238
238
  var _refreshHandler = null;
239
239
  var _refreshInflight = null;
240
240
  var RETRY_MARKER = "X-Auth-Retry";
241
+ function jwtExpMs(token) {
242
+ try {
243
+ const payload = token.split(".")[1];
244
+ if (!payload) return null;
245
+ const json = JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/")));
246
+ return typeof json.exp === "number" ? json.exp * 1e3 : null;
247
+ } catch {
248
+ return null;
249
+ }
250
+ }
251
+ __name(jwtExpMs, "jwtExpMs");
252
+ function computeSnapshot() {
253
+ const access = _storage.get(ACCESS_KEY);
254
+ const refresh = _storage.get(REFRESH_KEY);
255
+ const now = Date.now();
256
+ const accessExp = access ? jwtExpMs(access) : null;
257
+ const accessAlive = access !== null && (accessExp === null || accessExp > now);
258
+ const refreshExp = refresh ? jwtExpMs(refresh) : null;
259
+ const refreshAlive = refresh !== null && (refreshExp === null || refreshExp > now);
260
+ return {
261
+ status: accessAlive || refreshAlive ? "authenticated" : "anonymous",
262
+ accessExpiresAt: accessExp
263
+ };
264
+ }
265
+ __name(computeSnapshot, "computeSnapshot");
266
+ var SERVER_SNAPSHOT = { status: "anonymous", accessExpiresAt: null };
267
+ var SESSION_SYNC_EVENT = `cfg-auth:changed:${ACCESS_KEY}`;
268
+ var _snapshot = computeSnapshot();
269
+ var _sessionListeners = /* @__PURE__ */ new Set();
270
+ var _expiryTimer = null;
271
+ var _storageListenerInstalled = false;
272
+ function scheduleExpiryFlip() {
273
+ if (!isBrowser) return;
274
+ if (_expiryTimer !== null) {
275
+ clearTimeout(_expiryTimer);
276
+ _expiryTimer = null;
277
+ }
278
+ if (_sessionListeners.size === 0) return;
279
+ const now = Date.now();
280
+ const exps = [];
281
+ const access = _storage.get(ACCESS_KEY);
282
+ const refresh = _storage.get(REFRESH_KEY);
283
+ const accessExp = access ? jwtExpMs(access) : null;
284
+ const refreshExp = refresh ? jwtExpMs(refresh) : null;
285
+ if (accessExp !== null && accessExp > now) exps.push(accessExp);
286
+ if (refreshExp !== null && refreshExp > now) exps.push(refreshExp);
287
+ if (!exps.length) return;
288
+ const delay = Math.min(Math.min(...exps) - now + 250, 2147483647);
289
+ _expiryTimer = setTimeout(notifySessionChanged, delay);
290
+ }
291
+ __name(scheduleExpiryFlip, "scheduleExpiryFlip");
292
+ function notifySessionChanged() {
293
+ const next = computeSnapshot();
294
+ const changed = next.status !== _snapshot.status || next.accessExpiresAt !== _snapshot.accessExpiresAt;
295
+ if (changed) _snapshot = next;
296
+ scheduleExpiryFlip();
297
+ if (!changed) return;
298
+ for (const listener of Array.from(_sessionListeners)) {
299
+ try {
300
+ listener();
301
+ } catch {
302
+ }
303
+ }
304
+ if (isBrowser) {
305
+ try {
306
+ window.dispatchEvent(new Event(SESSION_SYNC_EVENT));
307
+ } catch {
308
+ }
309
+ }
310
+ }
311
+ __name(notifySessionChanged, "notifySessionChanged");
312
+ function ensureStorageSync() {
313
+ if (!isBrowser || _storageListenerInstalled) return;
314
+ _storageListenerInstalled = true;
315
+ window.addEventListener("storage", (e) => {
316
+ if (e.key === null || e.key === ACCESS_KEY || e.key === REFRESH_KEY) {
317
+ notifySessionChanged();
318
+ }
319
+ });
320
+ window.addEventListener(SESSION_SYNC_EVENT, () => notifySessionChanged());
321
+ }
322
+ __name(ensureStorageSync, "ensureStorageSync");
323
+ var _sessionExpiredHandlers = /* @__PURE__ */ new Set();
241
324
  var _client = null;
242
325
  function pushClientConfig() {
243
326
  if (!_client) return;
@@ -255,6 +338,7 @@ var auth = {
255
338
  setStorageMode(mode) {
256
339
  _storageMode = mode;
257
340
  _storage = mode === "cookie" ? cookieBackend : localStorageBackend;
341
+ notifySessionChanged();
258
342
  },
259
343
  // ── Bearer token ──────────────────────────────────────────────────
260
344
  getToken() {
@@ -262,19 +346,79 @@ var auth = {
262
346
  },
263
347
  setToken(token) {
264
348
  _storage.set(ACCESS_KEY, token);
349
+ notifySessionChanged();
265
350
  },
266
351
  getRefreshToken() {
267
352
  return _storage.get(REFRESH_KEY);
268
353
  },
269
354
  setRefreshToken(token) {
270
355
  _storage.set(REFRESH_KEY, token);
356
+ notifySessionChanged();
271
357
  },
272
358
  clearTokens() {
273
359
  _storage.set(ACCESS_KEY, null);
274
360
  _storage.set(REFRESH_KEY, null);
361
+ notifySessionChanged();
275
362
  },
363
+ /** Session-aware: token PRESENT and not past its `exp` (or a live refresh
364
+ * token exists that can mint one). Prefer `getSnapshot().status` in React. */
276
365
  isAuthenticated() {
277
- return _storage.get(ACCESS_KEY) !== null;
366
+ return computeSnapshot().status === "authenticated";
367
+ },
368
+ // ── Session (the ONE write path for login/logout flows) ──────────
369
+ /**
370
+ * Persist a token pair atomically. Every login flow (OTP verify, 2FA,
371
+ * OAuth callback) and the refresh handler should end here — do NOT
372
+ * scatter `setToken`/`setRefreshToken` pairs through app code.
373
+ * `refresh: undefined` keeps the current refresh token (access-only
374
+ * rotation); `refresh: null` explicitly drops it.
375
+ */
376
+ setSession(tokens) {
377
+ _storage.set(ACCESS_KEY, tokens.access);
378
+ if (tokens.refresh !== void 0) _storage.set(REFRESH_KEY, tokens.refresh);
379
+ notifySessionChanged();
380
+ },
381
+ clearSession() {
382
+ auth.clearTokens();
383
+ },
384
+ // ── Reactive snapshot (for useSyncExternalStore) ──────────────────
385
+ /**
386
+ * @example React:
387
+ * const session = useSyncExternalStore(
388
+ * auth.subscribe, auth.getSnapshot, auth.getServerSnapshot,
389
+ * );
390
+ * const isAuthenticated = session.status === 'authenticated';
391
+ */
392
+ getSnapshot() {
393
+ return _snapshot;
394
+ },
395
+ getServerSnapshot() {
396
+ return SERVER_SNAPSHOT;
397
+ },
398
+ subscribe(listener) {
399
+ ensureStorageSync();
400
+ _sessionListeners.add(listener);
401
+ notifySessionChanged();
402
+ return () => {
403
+ _sessionListeners.delete(listener);
404
+ if (_sessionListeners.size === 0 && _expiryTimer !== null) {
405
+ clearTimeout(_expiryTimer);
406
+ _expiryTimer = null;
407
+ }
408
+ };
409
+ },
410
+ /**
411
+ * Fired on TERMINAL 401 — after the refresh+retry path is exhausted.
412
+ * The store has already cleared the session before calling back, so
413
+ * handlers only need to route to login (no clear-then-redirect
414
+ * ordering to get wrong). Returns an unsubscribe function; multiple
415
+ * handlers compose (unlike the legacy single-slot `onUnauthorized`).
416
+ */
417
+ onSessionExpired(cb) {
418
+ _sessionExpiredHandlers.add(cb);
419
+ return () => {
420
+ _sessionExpiredHandlers.delete(cb);
421
+ };
278
422
  },
279
423
  // ── API key ───────────────────────────────────────────────────────
280
424
  getApiKey() {
@@ -356,15 +500,22 @@ var auth = {
356
500
  async function tryRefresh() {
357
501
  if (_refreshInflight) return _refreshInflight;
358
502
  if (!_refreshHandler) return null;
359
- const refresh = auth.getRefreshToken();
360
- if (!refresh) return null;
503
+ const runRefresh = /* @__PURE__ */ __name(async () => {
504
+ const refresh = auth.getRefreshToken();
505
+ if (!refresh) return null;
506
+ const result = await _refreshHandler(refresh);
507
+ if (!result?.access) return null;
508
+ auth.setToken(result.access);
509
+ if (result.refresh) auth.setRefreshToken(result.refresh);
510
+ return result.access;
511
+ }, "runRefresh");
361
512
  _refreshInflight = (async () => {
362
513
  try {
363
- const result = await _refreshHandler(refresh);
364
- if (!result?.access) return null;
365
- auth.setToken(result.access);
366
- if (result.refresh) auth.setRefreshToken(result.refresh);
367
- return result.access;
514
+ const locks = typeof navigator !== "undefined" ? navigator.locks : void 0;
515
+ if (locks?.request) {
516
+ return await locks.request(`${REFRESH_KEY}:refresh`, runRefresh);
517
+ }
518
+ return await runRefresh();
368
519
  } catch {
369
520
  return null;
370
521
  } finally {
@@ -374,6 +525,22 @@ async function tryRefresh() {
374
525
  return _refreshInflight;
375
526
  }
376
527
  __name(tryRefresh, "tryRefresh");
528
+ function expireSession(response) {
529
+ auth.clearTokens();
530
+ for (const cb of Array.from(_sessionExpiredHandlers)) {
531
+ try {
532
+ cb(response);
533
+ } catch {
534
+ }
535
+ }
536
+ if (_onUnauthorized) {
537
+ try {
538
+ _onUnauthorized(response);
539
+ } catch {
540
+ }
541
+ }
542
+ }
543
+ __name(expireSession, "expireSession");
377
544
  function dpopEnabled() {
378
545
  try {
379
546
  return typeof process !== "undefined" && process.env?.NEXT_PUBLIC_DPOP_ENABLED === "true";
@@ -503,22 +670,12 @@ function installAuthOnClient(client2) {
503
670
  client2.interceptors.response.use(async (response, request) => {
504
671
  if (response.status !== 401) return response;
505
672
  if (request.headers.get(RETRY_MARKER)) {
506
- if (_onUnauthorized) {
507
- try {
508
- _onUnauthorized(response);
509
- } catch {
510
- }
511
- }
673
+ expireSession(response);
512
674
  return response;
513
675
  }
514
676
  const newToken = await tryRefresh();
515
677
  if (!newToken) {
516
- if (_onUnauthorized) {
517
- try {
518
- _onUnauthorized(response);
519
- } catch {
520
- }
521
- }
678
+ expireSession(response);
522
679
  return response;
523
680
  }
524
681
  const retry = request.clone();
@@ -530,25 +687,36 @@ function installAuthOnClient(client2) {
530
687
  }
531
688
  try {
532
689
  const retried = await fetch(retry);
533
- if (retried.status === 401 && _onUnauthorized) {
534
- try {
535
- _onUnauthorized(retried);
536
- } catch {
537
- }
538
- }
690
+ if (retried.status === 401) expireSession(retried);
539
691
  return retried;
540
692
  } catch {
541
- if (_onUnauthorized) {
542
- try {
543
- _onUnauthorized(response);
544
- } catch {
545
- }
546
- }
547
693
  return response;
548
694
  }
549
695
  });
550
696
  }
551
697
  __name(installAuthOnClient, "installAuthOnClient");
698
+ var REFRESH_ENDPOINT = "/cfg/accounts/token/refresh/";
699
+ auth.setRefreshHandler(async (refresh) => {
700
+ try {
701
+ const url = `${auth.getBaseUrl()}${REFRESH_ENDPOINT}`;
702
+ const headers = { "Content-Type": "application/json" };
703
+ if (dpopEnabled() && typeof window !== "undefined") {
704
+ const proof = await _makeDpopProof("POST", url);
705
+ if (proof) headers["DPoP"] = proof;
706
+ }
707
+ const res = await fetch(url, {
708
+ method: "POST",
709
+ headers,
710
+ credentials: auth.getWithCredentials() ? "include" : "same-origin",
711
+ body: JSON.stringify({ refresh })
712
+ });
713
+ if (!res.ok) return null;
714
+ const data = await res.json();
715
+ return data?.access ? { access: data.access, refresh: data.refresh ?? refresh } : null;
716
+ } catch {
717
+ return null;
718
+ }
719
+ });
552
720
 
553
721
  // src/_api/generated/helpers/logger.ts
554
722
  var import_consola = require("consola");
@@ -1573,7 +1741,11 @@ var CfgAccountsOauth = class {
1573
1741
  */
1574
1742
  static cfgAccountsOauthConnectionsList(options) {
1575
1743
  return (options?.client ?? client).get({
1576
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1744
+ security: [
1745
+ { name: "X-API-Key", type: "apiKey" },
1746
+ { scheme: "bearer", type: "http" },
1747
+ { name: "Authorization", type: "apiKey" }
1748
+ ],
1577
1749
  url: "/cfg/accounts/oauth/connections/",
1578
1750
  ...options
1579
1751
  });
@@ -1585,7 +1757,11 @@ var CfgAccountsOauth = class {
1585
1757
  */
1586
1758
  static cfgAccountsOauthDisconnectCreate(options) {
1587
1759
  return (options.client ?? client).post({
1588
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1760
+ security: [
1761
+ { name: "X-API-Key", type: "apiKey" },
1762
+ { scheme: "bearer", type: "http" },
1763
+ { name: "Authorization", type: "apiKey" }
1764
+ ],
1589
1765
  url: "/cfg/accounts/oauth/disconnect/",
1590
1766
  ...options,
1591
1767
  headers: {
@@ -1642,7 +1818,11 @@ var CfgAccounts = class {
1642
1818
  */
1643
1819
  static cfgAccountsOtpRequestCreate(options) {
1644
1820
  return (options.client ?? client).post({
1645
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1821
+ security: [
1822
+ { name: "X-API-Key", type: "apiKey" },
1823
+ { scheme: "bearer", type: "http" },
1824
+ { name: "Authorization", type: "apiKey" }
1825
+ ],
1646
1826
  url: "/cfg/accounts/otp/request/",
1647
1827
  ...options,
1648
1828
  headers: {
@@ -1663,7 +1843,11 @@ var CfgAccounts = class {
1663
1843
  */
1664
1844
  static cfgAccountsOtpVerifyCreate(options) {
1665
1845
  return (options.client ?? client).post({
1666
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1846
+ security: [
1847
+ { name: "X-API-Key", type: "apiKey" },
1848
+ { scheme: "bearer", type: "http" },
1849
+ { name: "Authorization", type: "apiKey" }
1850
+ ],
1667
1851
  url: "/cfg/accounts/otp/verify/",
1668
1852
  ...options,
1669
1853
  headers: {
@@ -1701,7 +1885,11 @@ var CfgAccountsProfile = class {
1701
1885
  static cfgAccountsProfileAvatarCreate(options) {
1702
1886
  return (options?.client ?? client).post({
1703
1887
  ...formDataBodySerializer,
1704
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1888
+ security: [
1889
+ { name: "X-API-Key", type: "apiKey" },
1890
+ { scheme: "bearer", type: "http" },
1891
+ { name: "Authorization", type: "apiKey" }
1892
+ ],
1705
1893
  url: "/cfg/accounts/profile/avatar/",
1706
1894
  ...options,
1707
1895
  headers: {
@@ -1821,6 +2009,23 @@ var CfgAccountsAuth = class {
1821
2009
  static {
1822
2010
  __name(this, "CfgAccountsAuth");
1823
2011
  }
2012
+ /**
2013
+ * Revoke a refresh token (logout).
2014
+ *
2015
+ * Blacklists the posted refresh token so it can never mint another access
2016
+ * token. Called best-effort by the client's logout — without it, "logout"
2017
+ * is purely client-side and a stolen refresh token survives until expiry.
2018
+ */
2019
+ static cfgAccountsTokenBlacklistCreate(options) {
2020
+ return (options.client ?? client).post({
2021
+ url: "/cfg/accounts/token/blacklist/",
2022
+ ...options,
2023
+ headers: {
2024
+ "Content-Type": "application/json",
2025
+ ...options.headers
2026
+ }
2027
+ });
2028
+ }
1824
2029
  /**
1825
2030
  * Refresh JWT token.
1826
2031
  *
@@ -1852,7 +2057,11 @@ var CfgCentrifugo = class {
1852
2057
  */
1853
2058
  static cfgCentrifugoAuthTokenRetrieve(options) {
1854
2059
  return (options?.client ?? client).get({
1855
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2060
+ security: [
2061
+ { name: "X-API-Key", type: "apiKey" },
2062
+ { scheme: "bearer", type: "http" },
2063
+ { name: "Authorization", type: "apiKey" }
2064
+ ],
1856
2065
  url: "/cfg/centrifugo/auth/token/",
1857
2066
  ...options
1858
2067
  });
@@ -1867,7 +2076,11 @@ var CfgTotpBackupCodes = class {
1867
2076
  */
1868
2077
  static cfgTotpBackupCodesRetrieve(options) {
1869
2078
  return (options?.client ?? client).get({
1870
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2079
+ security: [
2080
+ { name: "X-API-Key", type: "apiKey" },
2081
+ { scheme: "bearer", type: "http" },
2082
+ { name: "Authorization", type: "apiKey" }
2083
+ ],
1871
2084
  url: "/cfg/totp/backup-codes/",
1872
2085
  ...options
1873
2086
  });
@@ -1880,7 +2093,11 @@ var CfgTotpBackupCodes = class {
1880
2093
  */
1881
2094
  static cfgTotpBackupCodesRegenerateCreate(options) {
1882
2095
  return (options.client ?? client).post({
1883
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2096
+ security: [
2097
+ { name: "X-API-Key", type: "apiKey" },
2098
+ { scheme: "bearer", type: "http" },
2099
+ { name: "Authorization", type: "apiKey" }
2100
+ ],
1884
2101
  url: "/cfg/totp/backup-codes/regenerate/",
1885
2102
  ...options,
1886
2103
  headers: {
@@ -1899,7 +2116,11 @@ var CfgTotp = class {
1899
2116
  */
1900
2117
  static cfgTotpDevicesRetrieve(options) {
1901
2118
  return (options?.client ?? client).get({
1902
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2119
+ security: [
2120
+ { name: "X-API-Key", type: "apiKey" },
2121
+ { scheme: "bearer", type: "http" },
2122
+ { name: "Authorization", type: "apiKey" }
2123
+ ],
1903
2124
  url: "/cfg/totp/devices/",
1904
2125
  ...options
1905
2126
  });
@@ -1911,7 +2132,11 @@ var CfgTotp = class {
1911
2132
  */
1912
2133
  static cfgTotpDevicesDestroy(options) {
1913
2134
  return (options.client ?? client).delete({
1914
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2135
+ security: [
2136
+ { name: "X-API-Key", type: "apiKey" },
2137
+ { scheme: "bearer", type: "http" },
2138
+ { name: "Authorization", type: "apiKey" }
2139
+ ],
1915
2140
  url: "/cfg/totp/devices/{id}/",
1916
2141
  ...options
1917
2142
  });
@@ -1923,7 +2148,11 @@ var CfgTotp = class {
1923
2148
  */
1924
2149
  static cfgTotpDisableCreate(options) {
1925
2150
  return (options.client ?? client).post({
1926
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2151
+ security: [
2152
+ { name: "X-API-Key", type: "apiKey" },
2153
+ { scheme: "bearer", type: "http" },
2154
+ { name: "Authorization", type: "apiKey" }
2155
+ ],
1927
2156
  url: "/cfg/totp/disable/",
1928
2157
  ...options,
1929
2158
  headers: {
@@ -1944,7 +2173,11 @@ var CfgTotpSetup = class {
1944
2173
  */
1945
2174
  static cfgTotpSetupCreate(options) {
1946
2175
  return (options?.client ?? client).post({
1947
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2176
+ security: [
2177
+ { name: "X-API-Key", type: "apiKey" },
2178
+ { scheme: "bearer", type: "http" },
2179
+ { name: "Authorization", type: "apiKey" }
2180
+ ],
1948
2181
  url: "/cfg/totp/setup/",
1949
2182
  ...options,
1950
2183
  headers: {
@@ -1960,7 +2193,11 @@ var CfgTotpSetup = class {
1960
2193
  */
1961
2194
  static cfgTotpSetupConfirmCreate(options) {
1962
2195
  return (options.client ?? client).post({
1963
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2196
+ security: [
2197
+ { name: "X-API-Key", type: "apiKey" },
2198
+ { scheme: "bearer", type: "http" },
2199
+ { name: "Authorization", type: "apiKey" }
2200
+ ],
1964
2201
  url: "/cfg/totp/setup/confirm/",
1965
2202
  ...options,
1966
2203
  headers: {
@@ -1981,7 +2218,11 @@ var CfgTotpVerify = class {
1981
2218
  */
1982
2219
  static cfgTotpVerifyCreate(options) {
1983
2220
  return (options.client ?? client).post({
1984
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2221
+ security: [
2222
+ { name: "X-API-Key", type: "apiKey" },
2223
+ { scheme: "bearer", type: "http" },
2224
+ { name: "Authorization", type: "apiKey" }
2225
+ ],
1985
2226
  url: "/cfg/totp/verify/",
1986
2227
  ...options,
1987
2228
  headers: {
@@ -1997,7 +2238,11 @@ var CfgTotpVerify = class {
1997
2238
  */
1998
2239
  static cfgTotpVerifyBackupCreate(options) {
1999
2240
  return (options.client ?? client).post({
2000
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2241
+ security: [
2242
+ { name: "X-API-Key", type: "apiKey" },
2243
+ { scheme: "bearer", type: "http" },
2244
+ { name: "Authorization", type: "apiKey" }
2245
+ ],
2001
2246
  url: "/cfg/totp/verify/backup/",
2002
2247
  ...options,
2003
2248
  headers: {