@djangocfg/api 2.1.262 → 2.1.264
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/auth-server.cjs +9 -0
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +9 -0
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +76 -72
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +76 -72
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +122 -80
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +129 -172
- package/dist/clients.d.ts +129 -172
- package/dist/clients.mjs +122 -80
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +47 -1
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +80 -57
- package/dist/hooks.d.ts +80 -57
- package/dist/hooks.mjs +47 -1
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +56 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -99
- package/dist/index.d.ts +99 -99
- package/dist/index.mjs +56 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts +46 -2
- package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts +3 -2
- package/src/_api/generated/cfg_accounts/accounts/models.ts +34 -34
- package/src/_api/generated/cfg_accounts/accounts__oauth/client.ts +1 -1
- package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +54 -54
- package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +14 -14
- package/src/_api/generated/cfg_accounts/client.ts +8 -0
- package/src/_api/generated/cfg_accounts/errors.ts +5 -0
- package/src/_api/generated/cfg_centrifugo/client.ts +8 -0
- package/src/_api/generated/cfg_centrifugo/errors.ts +5 -0
- package/src/_api/generated/cfg_totp/CLAUDE.md +3 -3
- package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +7 -7
- package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +5 -5
- package/src/_api/generated/cfg_totp/_utils/schemas/index.ts +0 -1
- package/src/_api/generated/cfg_totp/client.ts +8 -0
- package/src/_api/generated/cfg_totp/errors.ts +5 -0
- package/src/_api/generated/cfg_totp/schema.json +2 -103
- package/src/_api/generated/cfg_totp/totp__backup_codes/models.ts +10 -10
- package/src/_api/generated/cfg_totp/totp__totp_management/client.ts +2 -13
- package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +9 -34
- package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +12 -12
- package/src/_api/generated/cfg_totp/totp__totp_verification/models.ts +8 -8
- package/src/auth/hooks/useTwoFactorStatus.ts +5 -11
- package/src/_api/generated/cfg_totp/_utils/schemas/PaginatedDeviceListResponseList.schema.ts +0 -24
|
@@ -100,46 +100,8 @@
|
|
|
100
100
|
},
|
|
101
101
|
"/cfg/totp/devices/": {
|
|
102
102
|
"get": {
|
|
103
|
-
"operationId": "
|
|
103
|
+
"operationId": "cfg_totp_devices_retrieve",
|
|
104
104
|
"description": "List all TOTP devices for user.",
|
|
105
|
-
"parameters": [
|
|
106
|
-
{
|
|
107
|
-
"name": "ordering",
|
|
108
|
-
"required": false,
|
|
109
|
-
"in": "query",
|
|
110
|
-
"description": "Which field to use when ordering the results.",
|
|
111
|
-
"schema": {
|
|
112
|
-
"type": "string"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"name": "page",
|
|
117
|
-
"required": false,
|
|
118
|
-
"in": "query",
|
|
119
|
-
"description": "A page number within the paginated result set.",
|
|
120
|
-
"schema": {
|
|
121
|
-
"type": "integer"
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"name": "page_size",
|
|
126
|
-
"required": false,
|
|
127
|
-
"in": "query",
|
|
128
|
-
"description": "Number of results to return per page.",
|
|
129
|
-
"schema": {
|
|
130
|
-
"type": "integer"
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"name": "search",
|
|
135
|
-
"required": false,
|
|
136
|
-
"in": "query",
|
|
137
|
-
"description": "A search term.",
|
|
138
|
-
"schema": {
|
|
139
|
-
"type": "string"
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
],
|
|
143
105
|
"tags": [
|
|
144
106
|
"TOTP Management"
|
|
145
107
|
],
|
|
@@ -153,7 +115,7 @@
|
|
|
153
115
|
"content": {
|
|
154
116
|
"application/json": {
|
|
155
117
|
"schema": {
|
|
156
|
-
"$ref": "#/components/schemas/
|
|
118
|
+
"$ref": "#/components/schemas/DeviceListResponse"
|
|
157
119
|
}
|
|
158
120
|
}
|
|
159
121
|
},
|
|
@@ -698,69 +660,6 @@
|
|
|
698
660
|
"code"
|
|
699
661
|
]
|
|
700
662
|
},
|
|
701
|
-
"PaginatedDeviceListResponseList": {
|
|
702
|
-
"type": "object",
|
|
703
|
-
"required": [
|
|
704
|
-
"count",
|
|
705
|
-
"page",
|
|
706
|
-
"pages",
|
|
707
|
-
"page_size",
|
|
708
|
-
"has_next",
|
|
709
|
-
"has_previous",
|
|
710
|
-
"results"
|
|
711
|
-
],
|
|
712
|
-
"properties": {
|
|
713
|
-
"count": {
|
|
714
|
-
"type": "integer",
|
|
715
|
-
"description": "Total number of items across all pages",
|
|
716
|
-
"example": 150
|
|
717
|
-
},
|
|
718
|
-
"page": {
|
|
719
|
-
"type": "integer",
|
|
720
|
-
"description": "Current page number (1-based)",
|
|
721
|
-
"example": 2
|
|
722
|
-
},
|
|
723
|
-
"pages": {
|
|
724
|
-
"type": "integer",
|
|
725
|
-
"description": "Total number of pages",
|
|
726
|
-
"example": 15
|
|
727
|
-
},
|
|
728
|
-
"page_size": {
|
|
729
|
-
"type": "integer",
|
|
730
|
-
"description": "Number of items per page",
|
|
731
|
-
"example": 10
|
|
732
|
-
},
|
|
733
|
-
"has_next": {
|
|
734
|
-
"type": "boolean",
|
|
735
|
-
"description": "Whether there is a next page",
|
|
736
|
-
"example": true
|
|
737
|
-
},
|
|
738
|
-
"has_previous": {
|
|
739
|
-
"type": "boolean",
|
|
740
|
-
"description": "Whether there is a previous page",
|
|
741
|
-
"example": true
|
|
742
|
-
},
|
|
743
|
-
"next_page": {
|
|
744
|
-
"type": "integer",
|
|
745
|
-
"nullable": true,
|
|
746
|
-
"description": "Next page number (null if no next page)",
|
|
747
|
-
"example": 3
|
|
748
|
-
},
|
|
749
|
-
"previous_page": {
|
|
750
|
-
"type": "integer",
|
|
751
|
-
"nullable": true,
|
|
752
|
-
"description": "Previous page number (null if no previous page)",
|
|
753
|
-
"example": 1
|
|
754
|
-
},
|
|
755
|
-
"results": {
|
|
756
|
-
"type": "array",
|
|
757
|
-
"items": {
|
|
758
|
-
"$ref": "#/components/schemas/DeviceListResponse"
|
|
759
|
-
},
|
|
760
|
-
"description": "Array of items for current page"
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
},
|
|
764
663
|
"SetupRequest": {
|
|
765
664
|
"type": "object",
|
|
766
665
|
"description": "Serializer for starting 2FA setup.",
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Auto-generated by DjangoCFG - see CLAUDE.md
|
|
3
|
+
/**
|
|
4
|
+
* Serializer for regenerating backup codes.
|
|
5
|
+
*
|
|
6
|
+
* Request model (no read-only fields).
|
|
7
|
+
*/
|
|
8
|
+
export interface BackupCodesRegenerateRequest {
|
|
9
|
+
/** TOTP code for verification */
|
|
10
|
+
code: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
/**
|
|
4
14
|
* Response serializer for backup codes regeneration.
|
|
5
15
|
*
|
|
@@ -12,16 +22,6 @@ export interface BackupCodesRegenerateResponse {
|
|
|
12
22
|
warning: string;
|
|
13
23
|
}
|
|
14
24
|
|
|
15
|
-
/**
|
|
16
|
-
* Serializer for regenerating backup codes.
|
|
17
|
-
*
|
|
18
|
-
* Request model (no read-only fields).
|
|
19
|
-
*/
|
|
20
|
-
export interface BackupCodesRegenerateRequest {
|
|
21
|
-
/** TOTP code for verification */
|
|
22
|
-
code: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
25
|
/**
|
|
26
26
|
* Serializer for backup codes status.
|
|
27
27
|
*
|
|
@@ -12,22 +12,11 @@ export class TotpManagement {
|
|
|
12
12
|
this.client = client;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async totpDevicesList(ordering?: string, page?: number, page_size?: number, search?: string): Promise<Models.PaginatedDeviceListResponseList>;
|
|
16
|
-
async totpDevicesList(params?: { ordering?: string; page?: number; page_size?: number; search?: string }): Promise<Models.PaginatedDeviceListResponseList>;
|
|
17
|
-
|
|
18
15
|
/**
|
|
19
16
|
* List all TOTP devices for user.
|
|
20
17
|
*/
|
|
21
|
-
async
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
let params;
|
|
25
|
-
if (isParamsObject) {
|
|
26
|
-
params = args[0];
|
|
27
|
-
} else {
|
|
28
|
-
params = { ordering: args[0], page: args[1], page_size: args[2], search: args[3] };
|
|
29
|
-
}
|
|
30
|
-
const response = await this.client.request('GET', "/cfg/totp/devices/", { params });
|
|
18
|
+
async totpDevicesRetrieve(): Promise<Models.DeviceListResponse> {
|
|
19
|
+
const response = await this.client.request('GET', "/cfg/totp/devices/");
|
|
31
20
|
return response;
|
|
32
21
|
}
|
|
33
22
|
|
|
@@ -3,48 +3,23 @@
|
|
|
3
3
|
import * as Enums from "../enums";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Request model (no read-only fields).
|
|
9
|
-
*/
|
|
10
|
-
export interface DisableRequest {
|
|
11
|
-
/** TOTP code for verification */
|
|
12
|
-
code: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
6
|
+
* Response serializer for device list endpoint.
|
|
16
7
|
*
|
|
17
8
|
* Response model (includes read-only fields).
|
|
18
9
|
*/
|
|
19
|
-
export interface
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/** Current page number (1-based) */
|
|
23
|
-
page: number;
|
|
24
|
-
/** Total number of pages */
|
|
25
|
-
pages: number;
|
|
26
|
-
/** Number of items per page */
|
|
27
|
-
page_size: number;
|
|
28
|
-
/** Whether there is a next page */
|
|
29
|
-
has_next: boolean;
|
|
30
|
-
/** Whether there is a previous page */
|
|
31
|
-
has_previous: boolean;
|
|
32
|
-
/** Next page number (null if no next page) */
|
|
33
|
-
next_page?: number | null;
|
|
34
|
-
/** Previous page number (null if no previous page) */
|
|
35
|
-
previous_page?: number | null;
|
|
36
|
-
/** Array of items for current page */
|
|
37
|
-
results: Array<DeviceListResponse>;
|
|
10
|
+
export interface DeviceListResponse {
|
|
11
|
+
devices: Array<DeviceList>;
|
|
12
|
+
has_2fa_enabled: boolean;
|
|
38
13
|
}
|
|
39
14
|
|
|
40
15
|
/**
|
|
41
|
-
*
|
|
16
|
+
* Serializer for completely disabling 2FA.
|
|
42
17
|
*
|
|
43
|
-
*
|
|
18
|
+
* Request model (no read-only fields).
|
|
44
19
|
*/
|
|
45
|
-
export interface
|
|
46
|
-
|
|
47
|
-
|
|
20
|
+
export interface DisableRequest {
|
|
21
|
+
/** TOTP code for verification */
|
|
22
|
+
code: string;
|
|
48
23
|
}
|
|
49
24
|
|
|
50
25
|
/**
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Auto-generated by DjangoCFG - see CLAUDE.md
|
|
3
|
+
/**
|
|
4
|
+
* Serializer for confirming 2FA setup with first code.
|
|
5
|
+
*
|
|
6
|
+
* Request model (no read-only fields).
|
|
7
|
+
*/
|
|
8
|
+
export interface ConfirmSetupRequest {
|
|
9
|
+
/** Device ID from setup response */
|
|
10
|
+
device_id: string;
|
|
11
|
+
/** 6-digit TOTP code from authenticator app */
|
|
12
|
+
code: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
3
15
|
/**
|
|
4
16
|
* Response serializer for setup initiation.
|
|
5
17
|
*
|
|
@@ -18,18 +30,6 @@ export interface SetupResponse {
|
|
|
18
30
|
expires_in: number;
|
|
19
31
|
}
|
|
20
32
|
|
|
21
|
-
/**
|
|
22
|
-
* Serializer for confirming 2FA setup with first code.
|
|
23
|
-
*
|
|
24
|
-
* Request model (no read-only fields).
|
|
25
|
-
*/
|
|
26
|
-
export interface ConfirmSetupRequest {
|
|
27
|
-
/** Device ID from setup response */
|
|
28
|
-
device_id: string;
|
|
29
|
-
/** 6-digit TOTP code from authenticator app */
|
|
30
|
-
code: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
33
|
/**
|
|
34
34
|
* Serializer for starting 2FA setup.
|
|
35
35
|
*
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Auto-generated by DjangoCFG - see CLAUDE.md
|
|
3
3
|
/**
|
|
4
|
-
* Serializer for
|
|
4
|
+
* Serializer for TOTP code verification during login.
|
|
5
5
|
*
|
|
6
6
|
* Request model (no read-only fields).
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface VerifyRequest {
|
|
9
9
|
/** 2FA session ID from login response */
|
|
10
10
|
session_id: string;
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/** 6-digit TOTP code from authenticator app */
|
|
12
|
+
code: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Serializer for
|
|
16
|
+
* Serializer for backup code verification during login.
|
|
17
17
|
*
|
|
18
18
|
* Request model (no read-only fields).
|
|
19
19
|
*/
|
|
20
|
-
export interface
|
|
20
|
+
export interface VerifyBackupRequest {
|
|
21
21
|
/** 2FA session ID from login response */
|
|
22
22
|
session_id: string;
|
|
23
|
-
/**
|
|
24
|
-
|
|
23
|
+
/** 8-character backup recovery code */
|
|
24
|
+
backup_code: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -68,13 +68,10 @@ export const useTwoFactorStatus = (): UseTwoFactorStatusReturn => {
|
|
|
68
68
|
try {
|
|
69
69
|
authLogger.info('Fetching 2FA status...');
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
// API returns { devices: [...], has_2fa_enabled: bool }
|
|
72
|
+
const response = await apiTotp.totp_management.totpDevicesRetrieve();
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// Join all devices into a single array
|
|
76
|
-
const devices = response.results.flatMap((device) => device.devices);
|
|
77
|
-
const mappedDevices: TwoFactorDevice[] = devices.map((device) => ({
|
|
74
|
+
const mappedDevices: TwoFactorDevice[] = response.devices.map((device) => ({
|
|
78
75
|
id: device.id,
|
|
79
76
|
name: device.name,
|
|
80
77
|
createdAt: device.created_at,
|
|
@@ -83,12 +80,9 @@ export const useTwoFactorStatus = (): UseTwoFactorStatusReturn => {
|
|
|
83
80
|
}));
|
|
84
81
|
|
|
85
82
|
setDevices(mappedDevices);
|
|
86
|
-
|
|
87
|
-
// 2FA is enabled if there are any devices
|
|
88
|
-
const enabled = mappedDevices.length > 0;
|
|
89
|
-
setHas2FAEnabled(enabled);
|
|
83
|
+
setHas2FAEnabled(response.has_2fa_enabled);
|
|
90
84
|
|
|
91
|
-
authLogger.info('2FA status:',
|
|
85
|
+
authLogger.info('2FA status:', response.has_2fa_enabled ? 'enabled' : 'disabled');
|
|
92
86
|
|
|
93
87
|
} catch (err) {
|
|
94
88
|
const errorMessage = err instanceof Error ? err.message : 'Failed to fetch 2FA status';
|
package/src/_api/generated/cfg_totp/_utils/schemas/PaginatedDeviceListResponseList.schema.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for PaginatedDeviceListResponseList
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* */
|
|
6
|
-
import { z } from 'zod'
|
|
7
|
-
import { DeviceListResponseSchema } from './DeviceListResponse.schema'
|
|
8
|
-
|
|
9
|
-
export const PaginatedDeviceListResponseListSchema = z.object({
|
|
10
|
-
count: z.number().int(),
|
|
11
|
-
page: z.number().int(),
|
|
12
|
-
pages: z.number().int(),
|
|
13
|
-
page_size: z.number().int(),
|
|
14
|
-
has_next: z.boolean(),
|
|
15
|
-
has_previous: z.boolean(),
|
|
16
|
-
next_page: z.number().int().nullable().optional(),
|
|
17
|
-
previous_page: z.number().int().nullable().optional(),
|
|
18
|
-
results: z.array(DeviceListResponseSchema),
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Infer TypeScript type from Zod schema
|
|
23
|
-
*/
|
|
24
|
-
export type PaginatedDeviceListResponseList = z.infer<typeof PaginatedDeviceListResponseListSchema>
|