@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/clients.cjs CHANGED
@@ -197,6 +197,89 @@ var _onUnauthorized = null;
197
197
  var _refreshHandler = null;
198
198
  var _refreshInflight = null;
199
199
  var RETRY_MARKER = "X-Auth-Retry";
200
+ function jwtExpMs(token) {
201
+ try {
202
+ const payload = token.split(".")[1];
203
+ if (!payload) return null;
204
+ const json = JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/")));
205
+ return typeof json.exp === "number" ? json.exp * 1e3 : null;
206
+ } catch {
207
+ return null;
208
+ }
209
+ }
210
+ __name(jwtExpMs, "jwtExpMs");
211
+ function computeSnapshot() {
212
+ const access = _storage.get(ACCESS_KEY);
213
+ const refresh = _storage.get(REFRESH_KEY);
214
+ const now = Date.now();
215
+ const accessExp = access ? jwtExpMs(access) : null;
216
+ const accessAlive = access !== null && (accessExp === null || accessExp > now);
217
+ const refreshExp = refresh ? jwtExpMs(refresh) : null;
218
+ const refreshAlive = refresh !== null && (refreshExp === null || refreshExp > now);
219
+ return {
220
+ status: accessAlive || refreshAlive ? "authenticated" : "anonymous",
221
+ accessExpiresAt: accessExp
222
+ };
223
+ }
224
+ __name(computeSnapshot, "computeSnapshot");
225
+ var SERVER_SNAPSHOT = { status: "anonymous", accessExpiresAt: null };
226
+ var SESSION_SYNC_EVENT = `cfg-auth:changed:${ACCESS_KEY}`;
227
+ var _snapshot = computeSnapshot();
228
+ var _sessionListeners = /* @__PURE__ */ new Set();
229
+ var _expiryTimer = null;
230
+ var _storageListenerInstalled = false;
231
+ function scheduleExpiryFlip() {
232
+ if (!isBrowser) return;
233
+ if (_expiryTimer !== null) {
234
+ clearTimeout(_expiryTimer);
235
+ _expiryTimer = null;
236
+ }
237
+ if (_sessionListeners.size === 0) return;
238
+ const now = Date.now();
239
+ const exps = [];
240
+ const access = _storage.get(ACCESS_KEY);
241
+ const refresh = _storage.get(REFRESH_KEY);
242
+ const accessExp = access ? jwtExpMs(access) : null;
243
+ const refreshExp = refresh ? jwtExpMs(refresh) : null;
244
+ if (accessExp !== null && accessExp > now) exps.push(accessExp);
245
+ if (refreshExp !== null && refreshExp > now) exps.push(refreshExp);
246
+ if (!exps.length) return;
247
+ const delay = Math.min(Math.min(...exps) - now + 250, 2147483647);
248
+ _expiryTimer = setTimeout(notifySessionChanged, delay);
249
+ }
250
+ __name(scheduleExpiryFlip, "scheduleExpiryFlip");
251
+ function notifySessionChanged() {
252
+ const next = computeSnapshot();
253
+ const changed = next.status !== _snapshot.status || next.accessExpiresAt !== _snapshot.accessExpiresAt;
254
+ if (changed) _snapshot = next;
255
+ scheduleExpiryFlip();
256
+ if (!changed) return;
257
+ for (const listener of Array.from(_sessionListeners)) {
258
+ try {
259
+ listener();
260
+ } catch {
261
+ }
262
+ }
263
+ if (isBrowser) {
264
+ try {
265
+ window.dispatchEvent(new Event(SESSION_SYNC_EVENT));
266
+ } catch {
267
+ }
268
+ }
269
+ }
270
+ __name(notifySessionChanged, "notifySessionChanged");
271
+ function ensureStorageSync() {
272
+ if (!isBrowser || _storageListenerInstalled) return;
273
+ _storageListenerInstalled = true;
274
+ window.addEventListener("storage", (e) => {
275
+ if (e.key === null || e.key === ACCESS_KEY || e.key === REFRESH_KEY) {
276
+ notifySessionChanged();
277
+ }
278
+ });
279
+ window.addEventListener(SESSION_SYNC_EVENT, () => notifySessionChanged());
280
+ }
281
+ __name(ensureStorageSync, "ensureStorageSync");
282
+ var _sessionExpiredHandlers = /* @__PURE__ */ new Set();
200
283
  var _client = null;
201
284
  function pushClientConfig() {
202
285
  if (!_client) return;
@@ -214,6 +297,7 @@ var auth = {
214
297
  setStorageMode(mode) {
215
298
  _storageMode = mode;
216
299
  _storage = mode === "cookie" ? cookieBackend : localStorageBackend;
300
+ notifySessionChanged();
217
301
  },
218
302
  // ── Bearer token ──────────────────────────────────────────────────
219
303
  getToken() {
@@ -221,19 +305,79 @@ var auth = {
221
305
  },
222
306
  setToken(token) {
223
307
  _storage.set(ACCESS_KEY, token);
308
+ notifySessionChanged();
224
309
  },
225
310
  getRefreshToken() {
226
311
  return _storage.get(REFRESH_KEY);
227
312
  },
228
313
  setRefreshToken(token) {
229
314
  _storage.set(REFRESH_KEY, token);
315
+ notifySessionChanged();
230
316
  },
231
317
  clearTokens() {
232
318
  _storage.set(ACCESS_KEY, null);
233
319
  _storage.set(REFRESH_KEY, null);
320
+ notifySessionChanged();
234
321
  },
322
+ /** Session-aware: token PRESENT and not past its `exp` (or a live refresh
323
+ * token exists that can mint one). Prefer `getSnapshot().status` in React. */
235
324
  isAuthenticated() {
236
- return _storage.get(ACCESS_KEY) !== null;
325
+ return computeSnapshot().status === "authenticated";
326
+ },
327
+ // ── Session (the ONE write path for login/logout flows) ──────────
328
+ /**
329
+ * Persist a token pair atomically. Every login flow (OTP verify, 2FA,
330
+ * OAuth callback) and the refresh handler should end here — do NOT
331
+ * scatter `setToken`/`setRefreshToken` pairs through app code.
332
+ * `refresh: undefined` keeps the current refresh token (access-only
333
+ * rotation); `refresh: null` explicitly drops it.
334
+ */
335
+ setSession(tokens) {
336
+ _storage.set(ACCESS_KEY, tokens.access);
337
+ if (tokens.refresh !== void 0) _storage.set(REFRESH_KEY, tokens.refresh);
338
+ notifySessionChanged();
339
+ },
340
+ clearSession() {
341
+ auth.clearTokens();
342
+ },
343
+ // ── Reactive snapshot (for useSyncExternalStore) ──────────────────
344
+ /**
345
+ * @example React:
346
+ * const session = useSyncExternalStore(
347
+ * auth.subscribe, auth.getSnapshot, auth.getServerSnapshot,
348
+ * );
349
+ * const isAuthenticated = session.status === 'authenticated';
350
+ */
351
+ getSnapshot() {
352
+ return _snapshot;
353
+ },
354
+ getServerSnapshot() {
355
+ return SERVER_SNAPSHOT;
356
+ },
357
+ subscribe(listener) {
358
+ ensureStorageSync();
359
+ _sessionListeners.add(listener);
360
+ notifySessionChanged();
361
+ return () => {
362
+ _sessionListeners.delete(listener);
363
+ if (_sessionListeners.size === 0 && _expiryTimer !== null) {
364
+ clearTimeout(_expiryTimer);
365
+ _expiryTimer = null;
366
+ }
367
+ };
368
+ },
369
+ /**
370
+ * Fired on TERMINAL 401 — after the refresh+retry path is exhausted.
371
+ * The store has already cleared the session before calling back, so
372
+ * handlers only need to route to login (no clear-then-redirect
373
+ * ordering to get wrong). Returns an unsubscribe function; multiple
374
+ * handlers compose (unlike the legacy single-slot `onUnauthorized`).
375
+ */
376
+ onSessionExpired(cb) {
377
+ _sessionExpiredHandlers.add(cb);
378
+ return () => {
379
+ _sessionExpiredHandlers.delete(cb);
380
+ };
237
381
  },
238
382
  // ── API key ───────────────────────────────────────────────────────
239
383
  getApiKey() {
@@ -315,15 +459,22 @@ var auth = {
315
459
  async function tryRefresh() {
316
460
  if (_refreshInflight) return _refreshInflight;
317
461
  if (!_refreshHandler) return null;
318
- const refresh = auth.getRefreshToken();
319
- if (!refresh) return null;
462
+ const runRefresh = /* @__PURE__ */ __name(async () => {
463
+ const refresh = auth.getRefreshToken();
464
+ if (!refresh) return null;
465
+ const result = await _refreshHandler(refresh);
466
+ if (!result?.access) return null;
467
+ auth.setToken(result.access);
468
+ if (result.refresh) auth.setRefreshToken(result.refresh);
469
+ return result.access;
470
+ }, "runRefresh");
320
471
  _refreshInflight = (async () => {
321
472
  try {
322
- const result = await _refreshHandler(refresh);
323
- if (!result?.access) return null;
324
- auth.setToken(result.access);
325
- if (result.refresh) auth.setRefreshToken(result.refresh);
326
- return result.access;
473
+ const locks = typeof navigator !== "undefined" ? navigator.locks : void 0;
474
+ if (locks?.request) {
475
+ return await locks.request(`${REFRESH_KEY}:refresh`, runRefresh);
476
+ }
477
+ return await runRefresh();
327
478
  } catch {
328
479
  return null;
329
480
  } finally {
@@ -333,6 +484,22 @@ async function tryRefresh() {
333
484
  return _refreshInflight;
334
485
  }
335
486
  __name(tryRefresh, "tryRefresh");
487
+ function expireSession(response) {
488
+ auth.clearTokens();
489
+ for (const cb of Array.from(_sessionExpiredHandlers)) {
490
+ try {
491
+ cb(response);
492
+ } catch {
493
+ }
494
+ }
495
+ if (_onUnauthorized) {
496
+ try {
497
+ _onUnauthorized(response);
498
+ } catch {
499
+ }
500
+ }
501
+ }
502
+ __name(expireSession, "expireSession");
336
503
  function dpopEnabled() {
337
504
  try {
338
505
  return typeof process !== "undefined" && process.env?.NEXT_PUBLIC_DPOP_ENABLED === "true";
@@ -462,22 +629,12 @@ function installAuthOnClient(client2) {
462
629
  client2.interceptors.response.use(async (response, request) => {
463
630
  if (response.status !== 401) return response;
464
631
  if (request.headers.get(RETRY_MARKER)) {
465
- if (_onUnauthorized) {
466
- try {
467
- _onUnauthorized(response);
468
- } catch {
469
- }
470
- }
632
+ expireSession(response);
471
633
  return response;
472
634
  }
473
635
  const newToken = await tryRefresh();
474
636
  if (!newToken) {
475
- if (_onUnauthorized) {
476
- try {
477
- _onUnauthorized(response);
478
- } catch {
479
- }
480
- }
637
+ expireSession(response);
481
638
  return response;
482
639
  }
483
640
  const retry = request.clone();
@@ -489,25 +646,36 @@ function installAuthOnClient(client2) {
489
646
  }
490
647
  try {
491
648
  const retried = await fetch(retry);
492
- if (retried.status === 401 && _onUnauthorized) {
493
- try {
494
- _onUnauthorized(retried);
495
- } catch {
496
- }
497
- }
649
+ if (retried.status === 401) expireSession(retried);
498
650
  return retried;
499
651
  } catch {
500
- if (_onUnauthorized) {
501
- try {
502
- _onUnauthorized(response);
503
- } catch {
504
- }
505
- }
506
652
  return response;
507
653
  }
508
654
  });
509
655
  }
510
656
  __name(installAuthOnClient, "installAuthOnClient");
657
+ var REFRESH_ENDPOINT = "/cfg/accounts/token/refresh/";
658
+ auth.setRefreshHandler(async (refresh) => {
659
+ try {
660
+ const url = `${auth.getBaseUrl()}${REFRESH_ENDPOINT}`;
661
+ const headers = { "Content-Type": "application/json" };
662
+ if (dpopEnabled() && typeof window !== "undefined") {
663
+ const proof = await _makeDpopProof("POST", url);
664
+ if (proof) headers["DPoP"] = proof;
665
+ }
666
+ const res = await fetch(url, {
667
+ method: "POST",
668
+ headers,
669
+ credentials: auth.getWithCredentials() ? "include" : "same-origin",
670
+ body: JSON.stringify({ refresh })
671
+ });
672
+ if (!res.ok) return null;
673
+ const data = await res.json();
674
+ return data?.access ? { access: data.access, refresh: data.refresh ?? refresh } : null;
675
+ } catch {
676
+ return null;
677
+ }
678
+ });
511
679
 
512
680
  // src/_api/generated/helpers/logger.ts
513
681
  var import_consola = require("consola");
@@ -1532,7 +1700,11 @@ var CfgAccountsOauth = class {
1532
1700
  */
1533
1701
  static cfgAccountsOauthConnectionsList(options) {
1534
1702
  return (options?.client ?? client).get({
1535
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1703
+ security: [
1704
+ { name: "X-API-Key", type: "apiKey" },
1705
+ { scheme: "bearer", type: "http" },
1706
+ { name: "Authorization", type: "apiKey" }
1707
+ ],
1536
1708
  url: "/cfg/accounts/oauth/connections/",
1537
1709
  ...options
1538
1710
  });
@@ -1544,7 +1716,11 @@ var CfgAccountsOauth = class {
1544
1716
  */
1545
1717
  static cfgAccountsOauthDisconnectCreate(options) {
1546
1718
  return (options.client ?? client).post({
1547
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1719
+ security: [
1720
+ { name: "X-API-Key", type: "apiKey" },
1721
+ { scheme: "bearer", type: "http" },
1722
+ { name: "Authorization", type: "apiKey" }
1723
+ ],
1548
1724
  url: "/cfg/accounts/oauth/disconnect/",
1549
1725
  ...options,
1550
1726
  headers: {
@@ -1601,7 +1777,11 @@ var CfgAccounts = class {
1601
1777
  */
1602
1778
  static cfgAccountsOtpRequestCreate(options) {
1603
1779
  return (options.client ?? client).post({
1604
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1780
+ security: [
1781
+ { name: "X-API-Key", type: "apiKey" },
1782
+ { scheme: "bearer", type: "http" },
1783
+ { name: "Authorization", type: "apiKey" }
1784
+ ],
1605
1785
  url: "/cfg/accounts/otp/request/",
1606
1786
  ...options,
1607
1787
  headers: {
@@ -1622,7 +1802,11 @@ var CfgAccounts = class {
1622
1802
  */
1623
1803
  static cfgAccountsOtpVerifyCreate(options) {
1624
1804
  return (options.client ?? client).post({
1625
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1805
+ security: [
1806
+ { name: "X-API-Key", type: "apiKey" },
1807
+ { scheme: "bearer", type: "http" },
1808
+ { name: "Authorization", type: "apiKey" }
1809
+ ],
1626
1810
  url: "/cfg/accounts/otp/verify/",
1627
1811
  ...options,
1628
1812
  headers: {
@@ -1660,7 +1844,11 @@ var CfgAccountsProfile = class {
1660
1844
  static cfgAccountsProfileAvatarCreate(options) {
1661
1845
  return (options?.client ?? client).post({
1662
1846
  ...formDataBodySerializer,
1663
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1847
+ security: [
1848
+ { name: "X-API-Key", type: "apiKey" },
1849
+ { scheme: "bearer", type: "http" },
1850
+ { name: "Authorization", type: "apiKey" }
1851
+ ],
1664
1852
  url: "/cfg/accounts/profile/avatar/",
1665
1853
  ...options,
1666
1854
  headers: {
@@ -1780,6 +1968,23 @@ var CfgAccountsAuth = class {
1780
1968
  static {
1781
1969
  __name(this, "CfgAccountsAuth");
1782
1970
  }
1971
+ /**
1972
+ * Revoke a refresh token (logout).
1973
+ *
1974
+ * Blacklists the posted refresh token so it can never mint another access
1975
+ * token. Called best-effort by the client's logout — without it, "logout"
1976
+ * is purely client-side and a stolen refresh token survives until expiry.
1977
+ */
1978
+ static cfgAccountsTokenBlacklistCreate(options) {
1979
+ return (options.client ?? client).post({
1980
+ url: "/cfg/accounts/token/blacklist/",
1981
+ ...options,
1982
+ headers: {
1983
+ "Content-Type": "application/json",
1984
+ ...options.headers
1985
+ }
1986
+ });
1987
+ }
1783
1988
  /**
1784
1989
  * Refresh JWT token.
1785
1990
  *
@@ -1811,7 +2016,11 @@ var CfgCentrifugo = class {
1811
2016
  */
1812
2017
  static cfgCentrifugoAuthTokenRetrieve(options) {
1813
2018
  return (options?.client ?? client).get({
1814
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2019
+ security: [
2020
+ { name: "X-API-Key", type: "apiKey" },
2021
+ { scheme: "bearer", type: "http" },
2022
+ { name: "Authorization", type: "apiKey" }
2023
+ ],
1815
2024
  url: "/cfg/centrifugo/auth/token/",
1816
2025
  ...options
1817
2026
  });
@@ -1826,7 +2035,11 @@ var CfgTotpBackupCodes = class {
1826
2035
  */
1827
2036
  static cfgTotpBackupCodesRetrieve(options) {
1828
2037
  return (options?.client ?? client).get({
1829
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2038
+ security: [
2039
+ { name: "X-API-Key", type: "apiKey" },
2040
+ { scheme: "bearer", type: "http" },
2041
+ { name: "Authorization", type: "apiKey" }
2042
+ ],
1830
2043
  url: "/cfg/totp/backup-codes/",
1831
2044
  ...options
1832
2045
  });
@@ -1839,7 +2052,11 @@ var CfgTotpBackupCodes = class {
1839
2052
  */
1840
2053
  static cfgTotpBackupCodesRegenerateCreate(options) {
1841
2054
  return (options.client ?? client).post({
1842
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2055
+ security: [
2056
+ { name: "X-API-Key", type: "apiKey" },
2057
+ { scheme: "bearer", type: "http" },
2058
+ { name: "Authorization", type: "apiKey" }
2059
+ ],
1843
2060
  url: "/cfg/totp/backup-codes/regenerate/",
1844
2061
  ...options,
1845
2062
  headers: {
@@ -1858,7 +2075,11 @@ var CfgTotp = class {
1858
2075
  */
1859
2076
  static cfgTotpDevicesRetrieve(options) {
1860
2077
  return (options?.client ?? client).get({
1861
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2078
+ security: [
2079
+ { name: "X-API-Key", type: "apiKey" },
2080
+ { scheme: "bearer", type: "http" },
2081
+ { name: "Authorization", type: "apiKey" }
2082
+ ],
1862
2083
  url: "/cfg/totp/devices/",
1863
2084
  ...options
1864
2085
  });
@@ -1870,7 +2091,11 @@ var CfgTotp = class {
1870
2091
  */
1871
2092
  static cfgTotpDevicesDestroy(options) {
1872
2093
  return (options.client ?? client).delete({
1873
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2094
+ security: [
2095
+ { name: "X-API-Key", type: "apiKey" },
2096
+ { scheme: "bearer", type: "http" },
2097
+ { name: "Authorization", type: "apiKey" }
2098
+ ],
1874
2099
  url: "/cfg/totp/devices/{id}/",
1875
2100
  ...options
1876
2101
  });
@@ -1882,7 +2107,11 @@ var CfgTotp = class {
1882
2107
  */
1883
2108
  static cfgTotpDisableCreate(options) {
1884
2109
  return (options.client ?? client).post({
1885
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2110
+ security: [
2111
+ { name: "X-API-Key", type: "apiKey" },
2112
+ { scheme: "bearer", type: "http" },
2113
+ { name: "Authorization", type: "apiKey" }
2114
+ ],
1886
2115
  url: "/cfg/totp/disable/",
1887
2116
  ...options,
1888
2117
  headers: {
@@ -1903,7 +2132,11 @@ var CfgTotpSetup = class {
1903
2132
  */
1904
2133
  static cfgTotpSetupCreate(options) {
1905
2134
  return (options?.client ?? client).post({
1906
- 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
+ ],
1907
2140
  url: "/cfg/totp/setup/",
1908
2141
  ...options,
1909
2142
  headers: {
@@ -1919,7 +2152,11 @@ var CfgTotpSetup = class {
1919
2152
  */
1920
2153
  static cfgTotpSetupConfirmCreate(options) {
1921
2154
  return (options.client ?? client).post({
1922
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2155
+ security: [
2156
+ { name: "X-API-Key", type: "apiKey" },
2157
+ { scheme: "bearer", type: "http" },
2158
+ { name: "Authorization", type: "apiKey" }
2159
+ ],
1923
2160
  url: "/cfg/totp/setup/confirm/",
1924
2161
  ...options,
1925
2162
  headers: {
@@ -1940,7 +2177,11 @@ var CfgTotpVerify = class {
1940
2177
  */
1941
2178
  static cfgTotpVerifyCreate(options) {
1942
2179
  return (options.client ?? client).post({
1943
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2180
+ security: [
2181
+ { name: "X-API-Key", type: "apiKey" },
2182
+ { scheme: "bearer", type: "http" },
2183
+ { name: "Authorization", type: "apiKey" }
2184
+ ],
1944
2185
  url: "/cfg/totp/verify/",
1945
2186
  ...options,
1946
2187
  headers: {
@@ -1956,7 +2197,11 @@ var CfgTotpVerify = class {
1956
2197
  */
1957
2198
  static cfgTotpVerifyBackupCreate(options) {
1958
2199
  return (options.client ?? client).post({
1959
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2200
+ security: [
2201
+ { name: "X-API-Key", type: "apiKey" },
2202
+ { scheme: "bearer", type: "http" },
2203
+ { name: "Authorization", type: "apiKey" }
2204
+ ],
1960
2205
  url: "/cfg/totp/verify/backup/",
1961
2206
  ...options,
1962
2207
  headers: {