@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.mjs CHANGED
@@ -179,6 +179,89 @@ var _onUnauthorized = null;
179
179
  var _refreshHandler = null;
180
180
  var _refreshInflight = null;
181
181
  var RETRY_MARKER = "X-Auth-Retry";
182
+ function jwtExpMs(token) {
183
+ try {
184
+ const payload = token.split(".")[1];
185
+ if (!payload) return null;
186
+ const json = JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/")));
187
+ return typeof json.exp === "number" ? json.exp * 1e3 : null;
188
+ } catch {
189
+ return null;
190
+ }
191
+ }
192
+ __name(jwtExpMs, "jwtExpMs");
193
+ function computeSnapshot() {
194
+ const access = _storage.get(ACCESS_KEY);
195
+ const refresh = _storage.get(REFRESH_KEY);
196
+ const now = Date.now();
197
+ const accessExp = access ? jwtExpMs(access) : null;
198
+ const accessAlive = access !== null && (accessExp === null || accessExp > now);
199
+ const refreshExp = refresh ? jwtExpMs(refresh) : null;
200
+ const refreshAlive = refresh !== null && (refreshExp === null || refreshExp > now);
201
+ return {
202
+ status: accessAlive || refreshAlive ? "authenticated" : "anonymous",
203
+ accessExpiresAt: accessExp
204
+ };
205
+ }
206
+ __name(computeSnapshot, "computeSnapshot");
207
+ var SERVER_SNAPSHOT = { status: "anonymous", accessExpiresAt: null };
208
+ var SESSION_SYNC_EVENT = `cfg-auth:changed:${ACCESS_KEY}`;
209
+ var _snapshot = computeSnapshot();
210
+ var _sessionListeners = /* @__PURE__ */ new Set();
211
+ var _expiryTimer = null;
212
+ var _storageListenerInstalled = false;
213
+ function scheduleExpiryFlip() {
214
+ if (!isBrowser) return;
215
+ if (_expiryTimer !== null) {
216
+ clearTimeout(_expiryTimer);
217
+ _expiryTimer = null;
218
+ }
219
+ if (_sessionListeners.size === 0) return;
220
+ const now = Date.now();
221
+ const exps = [];
222
+ const access = _storage.get(ACCESS_KEY);
223
+ const refresh = _storage.get(REFRESH_KEY);
224
+ const accessExp = access ? jwtExpMs(access) : null;
225
+ const refreshExp = refresh ? jwtExpMs(refresh) : null;
226
+ if (accessExp !== null && accessExp > now) exps.push(accessExp);
227
+ if (refreshExp !== null && refreshExp > now) exps.push(refreshExp);
228
+ if (!exps.length) return;
229
+ const delay = Math.min(Math.min(...exps) - now + 250, 2147483647);
230
+ _expiryTimer = setTimeout(notifySessionChanged, delay);
231
+ }
232
+ __name(scheduleExpiryFlip, "scheduleExpiryFlip");
233
+ function notifySessionChanged() {
234
+ const next = computeSnapshot();
235
+ const changed = next.status !== _snapshot.status || next.accessExpiresAt !== _snapshot.accessExpiresAt;
236
+ if (changed) _snapshot = next;
237
+ scheduleExpiryFlip();
238
+ if (!changed) return;
239
+ for (const listener of Array.from(_sessionListeners)) {
240
+ try {
241
+ listener();
242
+ } catch {
243
+ }
244
+ }
245
+ if (isBrowser) {
246
+ try {
247
+ window.dispatchEvent(new Event(SESSION_SYNC_EVENT));
248
+ } catch {
249
+ }
250
+ }
251
+ }
252
+ __name(notifySessionChanged, "notifySessionChanged");
253
+ function ensureStorageSync() {
254
+ if (!isBrowser || _storageListenerInstalled) return;
255
+ _storageListenerInstalled = true;
256
+ window.addEventListener("storage", (e) => {
257
+ if (e.key === null || e.key === ACCESS_KEY || e.key === REFRESH_KEY) {
258
+ notifySessionChanged();
259
+ }
260
+ });
261
+ window.addEventListener(SESSION_SYNC_EVENT, () => notifySessionChanged());
262
+ }
263
+ __name(ensureStorageSync, "ensureStorageSync");
264
+ var _sessionExpiredHandlers = /* @__PURE__ */ new Set();
182
265
  var _client = null;
183
266
  function pushClientConfig() {
184
267
  if (!_client) return;
@@ -196,6 +279,7 @@ var auth = {
196
279
  setStorageMode(mode) {
197
280
  _storageMode = mode;
198
281
  _storage = mode === "cookie" ? cookieBackend : localStorageBackend;
282
+ notifySessionChanged();
199
283
  },
200
284
  // ── Bearer token ──────────────────────────────────────────────────
201
285
  getToken() {
@@ -203,19 +287,79 @@ var auth = {
203
287
  },
204
288
  setToken(token) {
205
289
  _storage.set(ACCESS_KEY, token);
290
+ notifySessionChanged();
206
291
  },
207
292
  getRefreshToken() {
208
293
  return _storage.get(REFRESH_KEY);
209
294
  },
210
295
  setRefreshToken(token) {
211
296
  _storage.set(REFRESH_KEY, token);
297
+ notifySessionChanged();
212
298
  },
213
299
  clearTokens() {
214
300
  _storage.set(ACCESS_KEY, null);
215
301
  _storage.set(REFRESH_KEY, null);
302
+ notifySessionChanged();
216
303
  },
304
+ /** Session-aware: token PRESENT and not past its `exp` (or a live refresh
305
+ * token exists that can mint one). Prefer `getSnapshot().status` in React. */
217
306
  isAuthenticated() {
218
- return _storage.get(ACCESS_KEY) !== null;
307
+ return computeSnapshot().status === "authenticated";
308
+ },
309
+ // ── Session (the ONE write path for login/logout flows) ──────────
310
+ /**
311
+ * Persist a token pair atomically. Every login flow (OTP verify, 2FA,
312
+ * OAuth callback) and the refresh handler should end here — do NOT
313
+ * scatter `setToken`/`setRefreshToken` pairs through app code.
314
+ * `refresh: undefined` keeps the current refresh token (access-only
315
+ * rotation); `refresh: null` explicitly drops it.
316
+ */
317
+ setSession(tokens) {
318
+ _storage.set(ACCESS_KEY, tokens.access);
319
+ if (tokens.refresh !== void 0) _storage.set(REFRESH_KEY, tokens.refresh);
320
+ notifySessionChanged();
321
+ },
322
+ clearSession() {
323
+ auth.clearTokens();
324
+ },
325
+ // ── Reactive snapshot (for useSyncExternalStore) ──────────────────
326
+ /**
327
+ * @example React:
328
+ * const session = useSyncExternalStore(
329
+ * auth.subscribe, auth.getSnapshot, auth.getServerSnapshot,
330
+ * );
331
+ * const isAuthenticated = session.status === 'authenticated';
332
+ */
333
+ getSnapshot() {
334
+ return _snapshot;
335
+ },
336
+ getServerSnapshot() {
337
+ return SERVER_SNAPSHOT;
338
+ },
339
+ subscribe(listener) {
340
+ ensureStorageSync();
341
+ _sessionListeners.add(listener);
342
+ notifySessionChanged();
343
+ return () => {
344
+ _sessionListeners.delete(listener);
345
+ if (_sessionListeners.size === 0 && _expiryTimer !== null) {
346
+ clearTimeout(_expiryTimer);
347
+ _expiryTimer = null;
348
+ }
349
+ };
350
+ },
351
+ /**
352
+ * Fired on TERMINAL 401 — after the refresh+retry path is exhausted.
353
+ * The store has already cleared the session before calling back, so
354
+ * handlers only need to route to login (no clear-then-redirect
355
+ * ordering to get wrong). Returns an unsubscribe function; multiple
356
+ * handlers compose (unlike the legacy single-slot `onUnauthorized`).
357
+ */
358
+ onSessionExpired(cb) {
359
+ _sessionExpiredHandlers.add(cb);
360
+ return () => {
361
+ _sessionExpiredHandlers.delete(cb);
362
+ };
219
363
  },
220
364
  // ── API key ───────────────────────────────────────────────────────
221
365
  getApiKey() {
@@ -297,15 +441,22 @@ var auth = {
297
441
  async function tryRefresh() {
298
442
  if (_refreshInflight) return _refreshInflight;
299
443
  if (!_refreshHandler) return null;
300
- const refresh = auth.getRefreshToken();
301
- if (!refresh) return null;
444
+ const runRefresh = /* @__PURE__ */ __name(async () => {
445
+ const refresh = auth.getRefreshToken();
446
+ if (!refresh) return null;
447
+ const result = await _refreshHandler(refresh);
448
+ if (!result?.access) return null;
449
+ auth.setToken(result.access);
450
+ if (result.refresh) auth.setRefreshToken(result.refresh);
451
+ return result.access;
452
+ }, "runRefresh");
302
453
  _refreshInflight = (async () => {
303
454
  try {
304
- const result = await _refreshHandler(refresh);
305
- if (!result?.access) return null;
306
- auth.setToken(result.access);
307
- if (result.refresh) auth.setRefreshToken(result.refresh);
308
- return result.access;
455
+ const locks = typeof navigator !== "undefined" ? navigator.locks : void 0;
456
+ if (locks?.request) {
457
+ return await locks.request(`${REFRESH_KEY}:refresh`, runRefresh);
458
+ }
459
+ return await runRefresh();
309
460
  } catch {
310
461
  return null;
311
462
  } finally {
@@ -315,6 +466,22 @@ async function tryRefresh() {
315
466
  return _refreshInflight;
316
467
  }
317
468
  __name(tryRefresh, "tryRefresh");
469
+ function expireSession(response) {
470
+ auth.clearTokens();
471
+ for (const cb of Array.from(_sessionExpiredHandlers)) {
472
+ try {
473
+ cb(response);
474
+ } catch {
475
+ }
476
+ }
477
+ if (_onUnauthorized) {
478
+ try {
479
+ _onUnauthorized(response);
480
+ } catch {
481
+ }
482
+ }
483
+ }
484
+ __name(expireSession, "expireSession");
318
485
  function dpopEnabled() {
319
486
  try {
320
487
  return typeof process !== "undefined" && process.env?.NEXT_PUBLIC_DPOP_ENABLED === "true";
@@ -444,22 +611,12 @@ function installAuthOnClient(client2) {
444
611
  client2.interceptors.response.use(async (response, request) => {
445
612
  if (response.status !== 401) return response;
446
613
  if (request.headers.get(RETRY_MARKER)) {
447
- if (_onUnauthorized) {
448
- try {
449
- _onUnauthorized(response);
450
- } catch {
451
- }
452
- }
614
+ expireSession(response);
453
615
  return response;
454
616
  }
455
617
  const newToken = await tryRefresh();
456
618
  if (!newToken) {
457
- if (_onUnauthorized) {
458
- try {
459
- _onUnauthorized(response);
460
- } catch {
461
- }
462
- }
619
+ expireSession(response);
463
620
  return response;
464
621
  }
465
622
  const retry = request.clone();
@@ -471,25 +628,36 @@ function installAuthOnClient(client2) {
471
628
  }
472
629
  try {
473
630
  const retried = await fetch(retry);
474
- if (retried.status === 401 && _onUnauthorized) {
475
- try {
476
- _onUnauthorized(retried);
477
- } catch {
478
- }
479
- }
631
+ if (retried.status === 401) expireSession(retried);
480
632
  return retried;
481
633
  } catch {
482
- if (_onUnauthorized) {
483
- try {
484
- _onUnauthorized(response);
485
- } catch {
486
- }
487
- }
488
634
  return response;
489
635
  }
490
636
  });
491
637
  }
492
638
  __name(installAuthOnClient, "installAuthOnClient");
639
+ var REFRESH_ENDPOINT = "/cfg/accounts/token/refresh/";
640
+ auth.setRefreshHandler(async (refresh) => {
641
+ try {
642
+ const url = `${auth.getBaseUrl()}${REFRESH_ENDPOINT}`;
643
+ const headers = { "Content-Type": "application/json" };
644
+ if (dpopEnabled() && typeof window !== "undefined") {
645
+ const proof = await _makeDpopProof("POST", url);
646
+ if (proof) headers["DPoP"] = proof;
647
+ }
648
+ const res = await fetch(url, {
649
+ method: "POST",
650
+ headers,
651
+ credentials: auth.getWithCredentials() ? "include" : "same-origin",
652
+ body: JSON.stringify({ refresh })
653
+ });
654
+ if (!res.ok) return null;
655
+ const data = await res.json();
656
+ return data?.access ? { access: data.access, refresh: data.refresh ?? refresh } : null;
657
+ } catch {
658
+ return null;
659
+ }
660
+ });
493
661
 
494
662
  // src/_api/generated/helpers/logger.ts
495
663
  import { createConsola } from "consola";
@@ -1514,7 +1682,11 @@ var CfgAccountsOauth = class {
1514
1682
  */
1515
1683
  static cfgAccountsOauthConnectionsList(options) {
1516
1684
  return (options?.client ?? client).get({
1517
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1685
+ security: [
1686
+ { name: "X-API-Key", type: "apiKey" },
1687
+ { scheme: "bearer", type: "http" },
1688
+ { name: "Authorization", type: "apiKey" }
1689
+ ],
1518
1690
  url: "/cfg/accounts/oauth/connections/",
1519
1691
  ...options
1520
1692
  });
@@ -1526,7 +1698,11 @@ var CfgAccountsOauth = class {
1526
1698
  */
1527
1699
  static cfgAccountsOauthDisconnectCreate(options) {
1528
1700
  return (options.client ?? client).post({
1529
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1701
+ security: [
1702
+ { name: "X-API-Key", type: "apiKey" },
1703
+ { scheme: "bearer", type: "http" },
1704
+ { name: "Authorization", type: "apiKey" }
1705
+ ],
1530
1706
  url: "/cfg/accounts/oauth/disconnect/",
1531
1707
  ...options,
1532
1708
  headers: {
@@ -1583,7 +1759,11 @@ var CfgAccounts = class {
1583
1759
  */
1584
1760
  static cfgAccountsOtpRequestCreate(options) {
1585
1761
  return (options.client ?? client).post({
1586
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1762
+ security: [
1763
+ { name: "X-API-Key", type: "apiKey" },
1764
+ { scheme: "bearer", type: "http" },
1765
+ { name: "Authorization", type: "apiKey" }
1766
+ ],
1587
1767
  url: "/cfg/accounts/otp/request/",
1588
1768
  ...options,
1589
1769
  headers: {
@@ -1604,7 +1784,11 @@ var CfgAccounts = class {
1604
1784
  */
1605
1785
  static cfgAccountsOtpVerifyCreate(options) {
1606
1786
  return (options.client ?? client).post({
1607
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1787
+ security: [
1788
+ { name: "X-API-Key", type: "apiKey" },
1789
+ { scheme: "bearer", type: "http" },
1790
+ { name: "Authorization", type: "apiKey" }
1791
+ ],
1608
1792
  url: "/cfg/accounts/otp/verify/",
1609
1793
  ...options,
1610
1794
  headers: {
@@ -1642,7 +1826,11 @@ var CfgAccountsProfile = class {
1642
1826
  static cfgAccountsProfileAvatarCreate(options) {
1643
1827
  return (options?.client ?? client).post({
1644
1828
  ...formDataBodySerializer,
1645
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1829
+ security: [
1830
+ { name: "X-API-Key", type: "apiKey" },
1831
+ { scheme: "bearer", type: "http" },
1832
+ { name: "Authorization", type: "apiKey" }
1833
+ ],
1646
1834
  url: "/cfg/accounts/profile/avatar/",
1647
1835
  ...options,
1648
1836
  headers: {
@@ -1762,6 +1950,23 @@ var CfgAccountsAuth = class {
1762
1950
  static {
1763
1951
  __name(this, "CfgAccountsAuth");
1764
1952
  }
1953
+ /**
1954
+ * Revoke a refresh token (logout).
1955
+ *
1956
+ * Blacklists the posted refresh token so it can never mint another access
1957
+ * token. Called best-effort by the client's logout — without it, "logout"
1958
+ * is purely client-side and a stolen refresh token survives until expiry.
1959
+ */
1960
+ static cfgAccountsTokenBlacklistCreate(options) {
1961
+ return (options.client ?? client).post({
1962
+ url: "/cfg/accounts/token/blacklist/",
1963
+ ...options,
1964
+ headers: {
1965
+ "Content-Type": "application/json",
1966
+ ...options.headers
1967
+ }
1968
+ });
1969
+ }
1765
1970
  /**
1766
1971
  * Refresh JWT token.
1767
1972
  *
@@ -1793,7 +1998,11 @@ var CfgCentrifugo = class {
1793
1998
  */
1794
1999
  static cfgCentrifugoAuthTokenRetrieve(options) {
1795
2000
  return (options?.client ?? client).get({
1796
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2001
+ security: [
2002
+ { name: "X-API-Key", type: "apiKey" },
2003
+ { scheme: "bearer", type: "http" },
2004
+ { name: "Authorization", type: "apiKey" }
2005
+ ],
1797
2006
  url: "/cfg/centrifugo/auth/token/",
1798
2007
  ...options
1799
2008
  });
@@ -1808,7 +2017,11 @@ var CfgTotpBackupCodes = class {
1808
2017
  */
1809
2018
  static cfgTotpBackupCodesRetrieve(options) {
1810
2019
  return (options?.client ?? client).get({
1811
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2020
+ security: [
2021
+ { name: "X-API-Key", type: "apiKey" },
2022
+ { scheme: "bearer", type: "http" },
2023
+ { name: "Authorization", type: "apiKey" }
2024
+ ],
1812
2025
  url: "/cfg/totp/backup-codes/",
1813
2026
  ...options
1814
2027
  });
@@ -1821,7 +2034,11 @@ var CfgTotpBackupCodes = class {
1821
2034
  */
1822
2035
  static cfgTotpBackupCodesRegenerateCreate(options) {
1823
2036
  return (options.client ?? client).post({
1824
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2037
+ security: [
2038
+ { name: "X-API-Key", type: "apiKey" },
2039
+ { scheme: "bearer", type: "http" },
2040
+ { name: "Authorization", type: "apiKey" }
2041
+ ],
1825
2042
  url: "/cfg/totp/backup-codes/regenerate/",
1826
2043
  ...options,
1827
2044
  headers: {
@@ -1840,7 +2057,11 @@ var CfgTotp = class {
1840
2057
  */
1841
2058
  static cfgTotpDevicesRetrieve(options) {
1842
2059
  return (options?.client ?? client).get({
1843
- 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
+ ],
1844
2065
  url: "/cfg/totp/devices/",
1845
2066
  ...options
1846
2067
  });
@@ -1852,7 +2073,11 @@ var CfgTotp = class {
1852
2073
  */
1853
2074
  static cfgTotpDevicesDestroy(options) {
1854
2075
  return (options.client ?? client).delete({
1855
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2076
+ security: [
2077
+ { name: "X-API-Key", type: "apiKey" },
2078
+ { scheme: "bearer", type: "http" },
2079
+ { name: "Authorization", type: "apiKey" }
2080
+ ],
1856
2081
  url: "/cfg/totp/devices/{id}/",
1857
2082
  ...options
1858
2083
  });
@@ -1864,7 +2089,11 @@ var CfgTotp = class {
1864
2089
  */
1865
2090
  static cfgTotpDisableCreate(options) {
1866
2091
  return (options.client ?? client).post({
1867
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2092
+ security: [
2093
+ { name: "X-API-Key", type: "apiKey" },
2094
+ { scheme: "bearer", type: "http" },
2095
+ { name: "Authorization", type: "apiKey" }
2096
+ ],
1868
2097
  url: "/cfg/totp/disable/",
1869
2098
  ...options,
1870
2099
  headers: {
@@ -1885,7 +2114,11 @@ var CfgTotpSetup = class {
1885
2114
  */
1886
2115
  static cfgTotpSetupCreate(options) {
1887
2116
  return (options?.client ?? client).post({
1888
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2117
+ security: [
2118
+ { name: "X-API-Key", type: "apiKey" },
2119
+ { scheme: "bearer", type: "http" },
2120
+ { name: "Authorization", type: "apiKey" }
2121
+ ],
1889
2122
  url: "/cfg/totp/setup/",
1890
2123
  ...options,
1891
2124
  headers: {
@@ -1901,7 +2134,11 @@ var CfgTotpSetup = class {
1901
2134
  */
1902
2135
  static cfgTotpSetupConfirmCreate(options) {
1903
2136
  return (options.client ?? client).post({
1904
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2137
+ security: [
2138
+ { name: "X-API-Key", type: "apiKey" },
2139
+ { scheme: "bearer", type: "http" },
2140
+ { name: "Authorization", type: "apiKey" }
2141
+ ],
1905
2142
  url: "/cfg/totp/setup/confirm/",
1906
2143
  ...options,
1907
2144
  headers: {
@@ -1922,7 +2159,11 @@ var CfgTotpVerify = class {
1922
2159
  */
1923
2160
  static cfgTotpVerifyCreate(options) {
1924
2161
  return (options.client ?? client).post({
1925
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2162
+ security: [
2163
+ { name: "X-API-Key", type: "apiKey" },
2164
+ { scheme: "bearer", type: "http" },
2165
+ { name: "Authorization", type: "apiKey" }
2166
+ ],
1926
2167
  url: "/cfg/totp/verify/",
1927
2168
  ...options,
1928
2169
  headers: {
@@ -1938,7 +2179,11 @@ var CfgTotpVerify = class {
1938
2179
  */
1939
2180
  static cfgTotpVerifyBackupCreate(options) {
1940
2181
  return (options.client ?? client).post({
1941
- security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2182
+ security: [
2183
+ { name: "X-API-Key", type: "apiKey" },
2184
+ { scheme: "bearer", type: "http" },
2185
+ { name: "Authorization", type: "apiKey" }
2186
+ ],
1942
2187
  url: "/cfg/totp/verify/backup/",
1943
2188
  ...options,
1944
2189
  headers: {