tychat-contracts 1.6.8 → 1.6.9
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/.github/workflows/publish-npm.yml +25 -25
- package/dist/legal-terms/legal-term-dispatch.dto.d.ts +8 -1
- package/dist/legal-terms/legal-term-dispatch.dto.d.ts.map +1 -1
- package/dist/legal-terms/legal-term-preview.dto.d.ts +4 -0
- package/dist/legal-terms/legal-term-preview.dto.d.ts.map +1 -1
- package/dist/legal-terms/legal-term-preview.dto.js +13 -1
- package/package.json +29 -29
- package/src/analytics/analytics-kafka-topics.ts +24 -24
- package/src/analytics/create-tenant-audit-log.dto.ts +105 -105
- package/src/analytics/index.ts +8 -8
- package/src/analytics/list-tenant-audit-logs-query.dto.ts +45 -45
- package/src/auth/auth-kafka.payloads.ts +218 -218
- package/src/auth/change-own-password.dto.ts +34 -34
- package/src/auth/index.ts +28 -28
- package/src/auth/login-2fa.dto.ts +14 -14
- package/src/auth/password-reset-finalize-2fa.dto.ts +36 -36
- package/src/auth/request-password-reset-response.dto.ts +26 -26
- package/src/auth/revoke-device-session.dto.ts +19 -19
- package/src/auth/totp-user.dto.ts +58 -58
- package/src/configurations/app-module-policy.dto.ts +72 -72
- package/src/configurations/app-module-policy.enums.ts +30 -30
- package/src/configurations/configuration-tenant-summary.dto.ts +79 -79
- package/src/configurations/index.ts +13 -13
- package/src/legal-terms/legal-term-dispatch.dto.ts +12 -1
- package/src/legal-terms/legal-term-preview.dto.ts +15 -1
- package/src/storage/presign-download-rpc.dto.ts +38 -38
- package/src/storage/storage-rmq-patterns.ts +5 -5
|
@@ -1,219 +1,219 @@
|
|
|
1
|
-
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import {
|
|
3
|
-
IsIn,
|
|
4
|
-
IsOptional,
|
|
5
|
-
IsString,
|
|
6
|
-
IsUUID,
|
|
7
|
-
Matches,
|
|
8
|
-
MaxLength,
|
|
9
|
-
MinLength,
|
|
10
|
-
} from 'class-validator';
|
|
11
|
-
import { LoginDto } from './login.dto';
|
|
12
|
-
import { RefreshTokenDto } from './refresh-token.dto';
|
|
13
|
-
|
|
14
|
-
export class LoginPayload extends LoginDto {
|
|
15
|
-
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
16
|
-
@IsString()
|
|
17
|
-
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
18
|
-
@MaxLength(255)
|
|
19
|
-
tenant: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** Segundo passo do login quando 2FA está ativo (RMQ/Kafka → auth-service). */
|
|
23
|
-
export class Login2faPayload {
|
|
24
|
-
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
25
|
-
@IsString()
|
|
26
|
-
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
27
|
-
@MaxLength(255)
|
|
28
|
-
tenant: string;
|
|
29
|
-
|
|
30
|
-
@ApiProperty({ description: 'JWT pre_2fa do primeiro passo' })
|
|
31
|
-
@IsString()
|
|
32
|
-
@MinLength(1, { message: 'pre_auth_token não pode ser vazio' })
|
|
33
|
-
pre_auth_token: string;
|
|
34
|
-
|
|
35
|
-
@ApiProperty({ description: 'Código TOTP de 6 dígitos' })
|
|
36
|
-
@IsString()
|
|
37
|
-
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
38
|
-
totp: string;
|
|
39
|
-
|
|
40
|
-
@ApiPropertyOptional({ example: 'Chrome — Windows' })
|
|
41
|
-
@IsOptional()
|
|
42
|
-
@IsString()
|
|
43
|
-
@MaxLength(255)
|
|
44
|
-
device_name?: string;
|
|
45
|
-
|
|
46
|
-
@ApiPropertyOptional({ enum: ['web', 'mobile', 'api'] })
|
|
47
|
-
@IsOptional()
|
|
48
|
-
@IsIn(['web', 'mobile', 'api'])
|
|
49
|
-
device_type?: 'web' | 'mobile' | 'api';
|
|
50
|
-
|
|
51
|
-
@ApiPropertyOptional()
|
|
52
|
-
@IsOptional()
|
|
53
|
-
@IsString()
|
|
54
|
-
@MaxLength(64)
|
|
55
|
-
ip_address?: string | null;
|
|
56
|
-
|
|
57
|
-
@ApiPropertyOptional()
|
|
58
|
-
@IsOptional()
|
|
59
|
-
@IsString()
|
|
60
|
-
@MaxLength(255)
|
|
61
|
-
location?: string | null;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export class ValidatePayload {
|
|
65
|
-
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
66
|
-
@IsString()
|
|
67
|
-
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
68
|
-
@MaxLength(255)
|
|
69
|
-
tenant: string;
|
|
70
|
-
|
|
71
|
-
@ApiProperty({ description: 'Token de acesso JWT', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' })
|
|
72
|
-
@IsString()
|
|
73
|
-
@MinLength(1, { message: 'refresh_token não pode ser vazio' })
|
|
74
|
-
@MaxLength(255)
|
|
75
|
-
access_token: string;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export class RefreshPayload extends RefreshTokenDto {
|
|
79
|
-
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
80
|
-
@IsString()
|
|
81
|
-
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
82
|
-
@MaxLength(255)
|
|
83
|
-
tenant: string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/** Pedido Kafka: perfil do utilizador autenticado (dados atuais na BD do auth-service). */
|
|
87
|
-
export class GetProfilePayload {
|
|
88
|
-
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
89
|
-
@IsString()
|
|
90
|
-
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
91
|
-
@MaxLength(255)
|
|
92
|
-
tenant: string;
|
|
93
|
-
|
|
94
|
-
@ApiProperty({
|
|
95
|
-
format: 'uuid',
|
|
96
|
-
description: 'ID do utilizador (JWT sub)',
|
|
97
|
-
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
98
|
-
})
|
|
99
|
-
@IsUUID('4', { message: 'userId deve ser um UUID válido' })
|
|
100
|
-
userId: string;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export class RequestPasswordResetPayload {
|
|
104
|
-
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
105
|
-
@IsString()
|
|
106
|
-
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
107
|
-
@MaxLength(255)
|
|
108
|
-
tenant: string;
|
|
109
|
-
|
|
110
|
-
@ApiProperty({ description: 'E-mail do usuário', example: 'usuario@empresa.com' })
|
|
111
|
-
@IsString()
|
|
112
|
-
@MinLength(1, { message: 'email não pode ser vazio' })
|
|
113
|
-
@MaxLength(255)
|
|
114
|
-
email: string;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export class ConfirmPasswordResetPayload {
|
|
118
|
-
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
119
|
-
@IsString()
|
|
120
|
-
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
121
|
-
@MaxLength(255)
|
|
122
|
-
tenant: string;
|
|
123
|
-
|
|
124
|
-
@ApiProperty({ description: 'Token de verificação para reset de senha', example: 'a3b5f3c1...' })
|
|
125
|
-
@IsString()
|
|
126
|
-
@MinLength(1, { message: 'verify_token não pode ser vazio' })
|
|
127
|
-
@MaxLength(255)
|
|
128
|
-
verify_token: string;
|
|
129
|
-
|
|
130
|
-
@ApiProperty({ description: 'Nova senha do usuário', example: 'senha123' })
|
|
131
|
-
@IsString()
|
|
132
|
-
@MinLength(6, { message: 'password deve ter no mínimo 6 caracteres' })
|
|
133
|
-
@MaxLength(255)
|
|
134
|
-
password: string;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/** Conclui reset de senha com 2FA (RMQ/Kafka → auth-service). */
|
|
138
|
-
export class DeviceSessionsRevokePayload {
|
|
139
|
-
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
140
|
-
@IsString()
|
|
141
|
-
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
142
|
-
@MaxLength(255)
|
|
143
|
-
tenant: string;
|
|
144
|
-
|
|
145
|
-
@ApiProperty({ format: 'uuid' })
|
|
146
|
-
@IsUUID('4', { message: 'userId deve ser um UUID válido' })
|
|
147
|
-
userId: string;
|
|
148
|
-
|
|
149
|
-
@ApiProperty({ format: 'uuid' })
|
|
150
|
-
@IsUUID('4', { message: 'sessionId deve ser um UUID válido' })
|
|
151
|
-
sessionId: string;
|
|
152
|
-
|
|
153
|
-
@ApiPropertyOptional()
|
|
154
|
-
@IsOptional()
|
|
155
|
-
@IsString()
|
|
156
|
-
@MaxLength(255)
|
|
157
|
-
password?: string;
|
|
158
|
-
|
|
159
|
-
@ApiPropertyOptional()
|
|
160
|
-
@IsOptional()
|
|
161
|
-
@IsString()
|
|
162
|
-
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
163
|
-
totp?: string;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export class ChangeOwnPasswordPayload {
|
|
167
|
-
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
168
|
-
@IsString()
|
|
169
|
-
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
170
|
-
@MaxLength(255)
|
|
171
|
-
tenant: string;
|
|
172
|
-
|
|
173
|
-
@ApiProperty({ format: 'uuid' })
|
|
174
|
-
@IsUUID('4')
|
|
175
|
-
userId: string;
|
|
176
|
-
|
|
177
|
-
@ApiProperty({ minLength: 6 })
|
|
178
|
-
@IsString()
|
|
179
|
-
@MinLength(6)
|
|
180
|
-
@MaxLength(255)
|
|
181
|
-
new_password: string;
|
|
182
|
-
|
|
183
|
-
@ApiPropertyOptional()
|
|
184
|
-
@IsOptional()
|
|
185
|
-
@IsString()
|
|
186
|
-
@MaxLength(255)
|
|
187
|
-
password?: string;
|
|
188
|
-
|
|
189
|
-
@ApiPropertyOptional()
|
|
190
|
-
@IsOptional()
|
|
191
|
-
@IsString()
|
|
192
|
-
@Matches(/^\d{6}$/)
|
|
193
|
-
totp?: string;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export class PasswordResetFinalize2faPayload {
|
|
197
|
-
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
198
|
-
@IsString()
|
|
199
|
-
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
200
|
-
@MaxLength(255)
|
|
201
|
-
tenant: string;
|
|
202
|
-
|
|
203
|
-
@ApiProperty({ description: 'JWT pre_password_reset do pedido de reset' })
|
|
204
|
-
@IsString()
|
|
205
|
-
@MinLength(1, { message: 'pre_recovery_token não pode ser vazio' })
|
|
206
|
-
@MaxLength(4096)
|
|
207
|
-
pre_recovery_token: string;
|
|
208
|
-
|
|
209
|
-
@ApiProperty({ description: 'Código TOTP de 6 dígitos' })
|
|
210
|
-
@IsString()
|
|
211
|
-
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
212
|
-
totp: string;
|
|
213
|
-
|
|
214
|
-
@ApiProperty({ description: 'Nova senha', example: 'senha123' })
|
|
215
|
-
@IsString()
|
|
216
|
-
@MinLength(6, { message: 'password deve ter no mínimo 6 caracteres' })
|
|
217
|
-
@MaxLength(255)
|
|
218
|
-
password: string;
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import {
|
|
3
|
+
IsIn,
|
|
4
|
+
IsOptional,
|
|
5
|
+
IsString,
|
|
6
|
+
IsUUID,
|
|
7
|
+
Matches,
|
|
8
|
+
MaxLength,
|
|
9
|
+
MinLength,
|
|
10
|
+
} from 'class-validator';
|
|
11
|
+
import { LoginDto } from './login.dto';
|
|
12
|
+
import { RefreshTokenDto } from './refresh-token.dto';
|
|
13
|
+
|
|
14
|
+
export class LoginPayload extends LoginDto {
|
|
15
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
16
|
+
@IsString()
|
|
17
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
18
|
+
@MaxLength(255)
|
|
19
|
+
tenant: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Segundo passo do login quando 2FA está ativo (RMQ/Kafka → auth-service). */
|
|
23
|
+
export class Login2faPayload {
|
|
24
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
25
|
+
@IsString()
|
|
26
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
27
|
+
@MaxLength(255)
|
|
28
|
+
tenant: string;
|
|
29
|
+
|
|
30
|
+
@ApiProperty({ description: 'JWT pre_2fa do primeiro passo' })
|
|
31
|
+
@IsString()
|
|
32
|
+
@MinLength(1, { message: 'pre_auth_token não pode ser vazio' })
|
|
33
|
+
pre_auth_token: string;
|
|
34
|
+
|
|
35
|
+
@ApiProperty({ description: 'Código TOTP de 6 dígitos' })
|
|
36
|
+
@IsString()
|
|
37
|
+
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
38
|
+
totp: string;
|
|
39
|
+
|
|
40
|
+
@ApiPropertyOptional({ example: 'Chrome — Windows' })
|
|
41
|
+
@IsOptional()
|
|
42
|
+
@IsString()
|
|
43
|
+
@MaxLength(255)
|
|
44
|
+
device_name?: string;
|
|
45
|
+
|
|
46
|
+
@ApiPropertyOptional({ enum: ['web', 'mobile', 'api'] })
|
|
47
|
+
@IsOptional()
|
|
48
|
+
@IsIn(['web', 'mobile', 'api'])
|
|
49
|
+
device_type?: 'web' | 'mobile' | 'api';
|
|
50
|
+
|
|
51
|
+
@ApiPropertyOptional()
|
|
52
|
+
@IsOptional()
|
|
53
|
+
@IsString()
|
|
54
|
+
@MaxLength(64)
|
|
55
|
+
ip_address?: string | null;
|
|
56
|
+
|
|
57
|
+
@ApiPropertyOptional()
|
|
58
|
+
@IsOptional()
|
|
59
|
+
@IsString()
|
|
60
|
+
@MaxLength(255)
|
|
61
|
+
location?: string | null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export class ValidatePayload {
|
|
65
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
66
|
+
@IsString()
|
|
67
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
68
|
+
@MaxLength(255)
|
|
69
|
+
tenant: string;
|
|
70
|
+
|
|
71
|
+
@ApiProperty({ description: 'Token de acesso JWT', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' })
|
|
72
|
+
@IsString()
|
|
73
|
+
@MinLength(1, { message: 'refresh_token não pode ser vazio' })
|
|
74
|
+
@MaxLength(255)
|
|
75
|
+
access_token: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export class RefreshPayload extends RefreshTokenDto {
|
|
79
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
80
|
+
@IsString()
|
|
81
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
82
|
+
@MaxLength(255)
|
|
83
|
+
tenant: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Pedido Kafka: perfil do utilizador autenticado (dados atuais na BD do auth-service). */
|
|
87
|
+
export class GetProfilePayload {
|
|
88
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
89
|
+
@IsString()
|
|
90
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
91
|
+
@MaxLength(255)
|
|
92
|
+
tenant: string;
|
|
93
|
+
|
|
94
|
+
@ApiProperty({
|
|
95
|
+
format: 'uuid',
|
|
96
|
+
description: 'ID do utilizador (JWT sub)',
|
|
97
|
+
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
98
|
+
})
|
|
99
|
+
@IsUUID('4', { message: 'userId deve ser um UUID válido' })
|
|
100
|
+
userId: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export class RequestPasswordResetPayload {
|
|
104
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
105
|
+
@IsString()
|
|
106
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
107
|
+
@MaxLength(255)
|
|
108
|
+
tenant: string;
|
|
109
|
+
|
|
110
|
+
@ApiProperty({ description: 'E-mail do usuário', example: 'usuario@empresa.com' })
|
|
111
|
+
@IsString()
|
|
112
|
+
@MinLength(1, { message: 'email não pode ser vazio' })
|
|
113
|
+
@MaxLength(255)
|
|
114
|
+
email: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export class ConfirmPasswordResetPayload {
|
|
118
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
119
|
+
@IsString()
|
|
120
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
121
|
+
@MaxLength(255)
|
|
122
|
+
tenant: string;
|
|
123
|
+
|
|
124
|
+
@ApiProperty({ description: 'Token de verificação para reset de senha', example: 'a3b5f3c1...' })
|
|
125
|
+
@IsString()
|
|
126
|
+
@MinLength(1, { message: 'verify_token não pode ser vazio' })
|
|
127
|
+
@MaxLength(255)
|
|
128
|
+
verify_token: string;
|
|
129
|
+
|
|
130
|
+
@ApiProperty({ description: 'Nova senha do usuário', example: 'senha123' })
|
|
131
|
+
@IsString()
|
|
132
|
+
@MinLength(6, { message: 'password deve ter no mínimo 6 caracteres' })
|
|
133
|
+
@MaxLength(255)
|
|
134
|
+
password: string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Conclui reset de senha com 2FA (RMQ/Kafka → auth-service). */
|
|
138
|
+
export class DeviceSessionsRevokePayload {
|
|
139
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
140
|
+
@IsString()
|
|
141
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
142
|
+
@MaxLength(255)
|
|
143
|
+
tenant: string;
|
|
144
|
+
|
|
145
|
+
@ApiProperty({ format: 'uuid' })
|
|
146
|
+
@IsUUID('4', { message: 'userId deve ser um UUID válido' })
|
|
147
|
+
userId: string;
|
|
148
|
+
|
|
149
|
+
@ApiProperty({ format: 'uuid' })
|
|
150
|
+
@IsUUID('4', { message: 'sessionId deve ser um UUID válido' })
|
|
151
|
+
sessionId: string;
|
|
152
|
+
|
|
153
|
+
@ApiPropertyOptional()
|
|
154
|
+
@IsOptional()
|
|
155
|
+
@IsString()
|
|
156
|
+
@MaxLength(255)
|
|
157
|
+
password?: string;
|
|
158
|
+
|
|
159
|
+
@ApiPropertyOptional()
|
|
160
|
+
@IsOptional()
|
|
161
|
+
@IsString()
|
|
162
|
+
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
163
|
+
totp?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export class ChangeOwnPasswordPayload {
|
|
167
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
168
|
+
@IsString()
|
|
169
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
170
|
+
@MaxLength(255)
|
|
171
|
+
tenant: string;
|
|
172
|
+
|
|
173
|
+
@ApiProperty({ format: 'uuid' })
|
|
174
|
+
@IsUUID('4')
|
|
175
|
+
userId: string;
|
|
176
|
+
|
|
177
|
+
@ApiProperty({ minLength: 6 })
|
|
178
|
+
@IsString()
|
|
179
|
+
@MinLength(6)
|
|
180
|
+
@MaxLength(255)
|
|
181
|
+
new_password: string;
|
|
182
|
+
|
|
183
|
+
@ApiPropertyOptional()
|
|
184
|
+
@IsOptional()
|
|
185
|
+
@IsString()
|
|
186
|
+
@MaxLength(255)
|
|
187
|
+
password?: string;
|
|
188
|
+
|
|
189
|
+
@ApiPropertyOptional()
|
|
190
|
+
@IsOptional()
|
|
191
|
+
@IsString()
|
|
192
|
+
@Matches(/^\d{6}$/)
|
|
193
|
+
totp?: string;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export class PasswordResetFinalize2faPayload {
|
|
197
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
198
|
+
@IsString()
|
|
199
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
200
|
+
@MaxLength(255)
|
|
201
|
+
tenant: string;
|
|
202
|
+
|
|
203
|
+
@ApiProperty({ description: 'JWT pre_password_reset do pedido de reset' })
|
|
204
|
+
@IsString()
|
|
205
|
+
@MinLength(1, { message: 'pre_recovery_token não pode ser vazio' })
|
|
206
|
+
@MaxLength(4096)
|
|
207
|
+
pre_recovery_token: string;
|
|
208
|
+
|
|
209
|
+
@ApiProperty({ description: 'Código TOTP de 6 dígitos' })
|
|
210
|
+
@IsString()
|
|
211
|
+
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
212
|
+
totp: string;
|
|
213
|
+
|
|
214
|
+
@ApiProperty({ description: 'Nova senha', example: 'senha123' })
|
|
215
|
+
@IsString()
|
|
216
|
+
@MinLength(6, { message: 'password deve ter no mínimo 6 caracteres' })
|
|
217
|
+
@MaxLength(255)
|
|
218
|
+
password: string;
|
|
219
219
|
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
-
import { IsOptional, IsString, Matches, MaxLength, MinLength } from 'class-validator';
|
|
3
|
-
import { MatchField } from './match-field.decorator';
|
|
4
|
-
|
|
5
|
-
/** Troca de senha autenticada: com 2FA usa apenas TOTP; sem 2FA usa senha atual. */
|
|
6
|
-
export class ChangeOwnPasswordDto {
|
|
7
|
-
@ApiPropertyOptional({ description: 'Senha atual (se 2FA desativado)' })
|
|
8
|
-
@IsOptional()
|
|
9
|
-
@IsString()
|
|
10
|
-
@MinLength(1)
|
|
11
|
-
@MaxLength(255)
|
|
12
|
-
current_password?: string;
|
|
13
|
-
|
|
14
|
-
@ApiPropertyOptional({ description: 'Código TOTP (se 2FA ativo)' })
|
|
15
|
-
@IsOptional()
|
|
16
|
-
@IsString()
|
|
17
|
-
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
18
|
-
totp?: string;
|
|
19
|
-
|
|
20
|
-
@ApiProperty({ minLength: 6 })
|
|
21
|
-
@IsString()
|
|
22
|
-
@MinLength(6, { message: 'new_password deve ter no mínimo 6 caracteres' })
|
|
23
|
-
@MaxLength(255)
|
|
24
|
-
new_password: string;
|
|
25
|
-
|
|
26
|
-
@ApiProperty({ minLength: 6 })
|
|
27
|
-
@IsString()
|
|
28
|
-
@MinLength(6, { message: 'new_password_confirmation deve ter no mínimo 6 caracteres' })
|
|
29
|
-
@MaxLength(255)
|
|
30
|
-
@MatchField('new_password', {
|
|
31
|
-
message: 'new_password_confirmation deve ser igual a new_password',
|
|
32
|
-
})
|
|
33
|
-
new_password_confirmation: string;
|
|
34
|
-
}
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { IsOptional, IsString, Matches, MaxLength, MinLength } from 'class-validator';
|
|
3
|
+
import { MatchField } from './match-field.decorator';
|
|
4
|
+
|
|
5
|
+
/** Troca de senha autenticada: com 2FA usa apenas TOTP; sem 2FA usa senha atual. */
|
|
6
|
+
export class ChangeOwnPasswordDto {
|
|
7
|
+
@ApiPropertyOptional({ description: 'Senha atual (se 2FA desativado)' })
|
|
8
|
+
@IsOptional()
|
|
9
|
+
@IsString()
|
|
10
|
+
@MinLength(1)
|
|
11
|
+
@MaxLength(255)
|
|
12
|
+
current_password?: string;
|
|
13
|
+
|
|
14
|
+
@ApiPropertyOptional({ description: 'Código TOTP (se 2FA ativo)' })
|
|
15
|
+
@IsOptional()
|
|
16
|
+
@IsString()
|
|
17
|
+
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
18
|
+
totp?: string;
|
|
19
|
+
|
|
20
|
+
@ApiProperty({ minLength: 6 })
|
|
21
|
+
@IsString()
|
|
22
|
+
@MinLength(6, { message: 'new_password deve ter no mínimo 6 caracteres' })
|
|
23
|
+
@MaxLength(255)
|
|
24
|
+
new_password: string;
|
|
25
|
+
|
|
26
|
+
@ApiProperty({ minLength: 6 })
|
|
27
|
+
@IsString()
|
|
28
|
+
@MinLength(6, { message: 'new_password_confirmation deve ter no mínimo 6 caracteres' })
|
|
29
|
+
@MaxLength(255)
|
|
30
|
+
@MatchField('new_password', {
|
|
31
|
+
message: 'new_password_confirmation deve ser igual a new_password',
|
|
32
|
+
})
|
|
33
|
+
new_password_confirmation: string;
|
|
34
|
+
}
|
package/src/auth/index.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
export { LoginDto } from './login.dto';
|
|
2
|
-
export {
|
|
3
|
-
LoginPayload,
|
|
4
|
-
Login2faPayload,
|
|
5
|
-
ValidatePayload,
|
|
6
|
-
RefreshPayload,
|
|
7
|
-
GetProfilePayload,
|
|
8
|
-
RequestPasswordResetPayload,
|
|
9
|
-
ConfirmPasswordResetPayload,
|
|
10
|
-
PasswordResetFinalize2faPayload,
|
|
11
|
-
DeviceSessionsRevokePayload,
|
|
12
|
-
ChangeOwnPasswordPayload,
|
|
13
|
-
} from './auth-kafka.payloads';
|
|
14
|
-
export { RefreshTokenDto } from './refresh-token.dto';
|
|
15
|
-
export { RequestPasswordResetDto } from './request-password-reset.dto';
|
|
16
|
-
export { ConfirmPasswordResetDto } from './confirm-password-reset.dto';
|
|
17
|
-
export { RequestPasswordResetResponseDto } from './request-password-reset-response.dto';
|
|
18
|
-
export { PasswordResetFinalize2faDto } from './password-reset-finalize-2fa.dto';
|
|
19
|
-
export { RevokeDeviceSessionDto } from './revoke-device-session.dto';
|
|
20
|
-
export { ChangeOwnPasswordDto } from './change-own-password.dto';
|
|
21
|
-
export { AuthLoginResponseDto } from './auth-login-response.dto';
|
|
22
|
-
export { Login2faDto } from './login-2fa.dto';
|
|
23
|
-
export {
|
|
24
|
-
TotpSetupConfirmDto,
|
|
25
|
-
TotpSetupConfirmResponseDto,
|
|
26
|
-
TotpDisableDto,
|
|
27
|
-
TotpSetupStartResponseDto,
|
|
28
|
-
} from './totp-user.dto';
|
|
1
|
+
export { LoginDto } from './login.dto';
|
|
2
|
+
export {
|
|
3
|
+
LoginPayload,
|
|
4
|
+
Login2faPayload,
|
|
5
|
+
ValidatePayload,
|
|
6
|
+
RefreshPayload,
|
|
7
|
+
GetProfilePayload,
|
|
8
|
+
RequestPasswordResetPayload,
|
|
9
|
+
ConfirmPasswordResetPayload,
|
|
10
|
+
PasswordResetFinalize2faPayload,
|
|
11
|
+
DeviceSessionsRevokePayload,
|
|
12
|
+
ChangeOwnPasswordPayload,
|
|
13
|
+
} from './auth-kafka.payloads';
|
|
14
|
+
export { RefreshTokenDto } from './refresh-token.dto';
|
|
15
|
+
export { RequestPasswordResetDto } from './request-password-reset.dto';
|
|
16
|
+
export { ConfirmPasswordResetDto } from './confirm-password-reset.dto';
|
|
17
|
+
export { RequestPasswordResetResponseDto } from './request-password-reset-response.dto';
|
|
18
|
+
export { PasswordResetFinalize2faDto } from './password-reset-finalize-2fa.dto';
|
|
19
|
+
export { RevokeDeviceSessionDto } from './revoke-device-session.dto';
|
|
20
|
+
export { ChangeOwnPasswordDto } from './change-own-password.dto';
|
|
21
|
+
export { AuthLoginResponseDto } from './auth-login-response.dto';
|
|
22
|
+
export { Login2faDto } from './login-2fa.dto';
|
|
23
|
+
export {
|
|
24
|
+
TotpSetupConfirmDto,
|
|
25
|
+
TotpSetupConfirmResponseDto,
|
|
26
|
+
TotpDisableDto,
|
|
27
|
+
TotpSetupStartResponseDto,
|
|
28
|
+
} from './totp-user.dto';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
-
import { IsString, Matches, MinLength } from 'class-validator';
|
|
3
|
-
|
|
4
|
-
export class Login2faDto {
|
|
5
|
-
@ApiProperty({ description: 'JWT retornado no primeiro passo do login (two_factor_required)' })
|
|
6
|
-
@IsString()
|
|
7
|
-
@MinLength(1, { message: 'pre_auth_token não pode ser vazio' })
|
|
8
|
-
pre_auth_token: string;
|
|
9
|
-
|
|
10
|
-
@ApiProperty({ description: 'Código TOTP de 6 dígitos do aplicativo autenticador' })
|
|
11
|
-
@IsString()
|
|
12
|
-
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
13
|
-
totp: string;
|
|
14
|
-
}
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsString, Matches, MinLength } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
export class Login2faDto {
|
|
5
|
+
@ApiProperty({ description: 'JWT retornado no primeiro passo do login (two_factor_required)' })
|
|
6
|
+
@IsString()
|
|
7
|
+
@MinLength(1, { message: 'pre_auth_token não pode ser vazio' })
|
|
8
|
+
pre_auth_token: string;
|
|
9
|
+
|
|
10
|
+
@ApiProperty({ description: 'Código TOTP de 6 dígitos do aplicativo autenticador' })
|
|
11
|
+
@IsString()
|
|
12
|
+
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
13
|
+
totp: string;
|
|
14
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
-
import { IsString, Matches, MaxLength, MinLength } from 'class-validator';
|
|
3
|
-
import { MatchField } from './match-field.decorator';
|
|
4
|
-
|
|
5
|
-
/** Finaliza recuperação de senha quando o utilizador tem 2FA (após `password-reset/request`). */
|
|
6
|
-
export class PasswordResetFinalize2faDto {
|
|
7
|
-
@ApiProperty({ description: 'JWT pre_password_reset devolvido no pedido de reset' })
|
|
8
|
-
@IsString()
|
|
9
|
-
@MinLength(1, { message: 'pre_recovery_token não pode ser vazio' })
|
|
10
|
-
@MaxLength(4096)
|
|
11
|
-
pre_recovery_token: string;
|
|
12
|
-
|
|
13
|
-
@ApiProperty({ description: 'Código TOTP de 6 dígitos' })
|
|
14
|
-
@IsString()
|
|
15
|
-
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
16
|
-
totp: string;
|
|
17
|
-
|
|
18
|
-
@ApiProperty({ description: 'Nova senha', example: 'senha123', minLength: 6 })
|
|
19
|
-
@IsString()
|
|
20
|
-
@MinLength(6, { message: 'password deve ter no mínimo 6 caracteres' })
|
|
21
|
-
@MaxLength(255)
|
|
22
|
-
password: string;
|
|
23
|
-
|
|
24
|
-
@ApiProperty({
|
|
25
|
-
description: 'Confirmação da nova senha',
|
|
26
|
-
example: 'senha123',
|
|
27
|
-
minLength: 6,
|
|
28
|
-
})
|
|
29
|
-
@IsString()
|
|
30
|
-
@MinLength(6, { message: 'password_confirmation deve ter no mínimo 6 caracteres' })
|
|
31
|
-
@MaxLength(255)
|
|
32
|
-
@MatchField('password', {
|
|
33
|
-
message: 'password_confirmation deve ser igual a password',
|
|
34
|
-
})
|
|
35
|
-
password_confirmation: string;
|
|
36
|
-
}
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsString, Matches, MaxLength, MinLength } from 'class-validator';
|
|
3
|
+
import { MatchField } from './match-field.decorator';
|
|
4
|
+
|
|
5
|
+
/** Finaliza recuperação de senha quando o utilizador tem 2FA (após `password-reset/request`). */
|
|
6
|
+
export class PasswordResetFinalize2faDto {
|
|
7
|
+
@ApiProperty({ description: 'JWT pre_password_reset devolvido no pedido de reset' })
|
|
8
|
+
@IsString()
|
|
9
|
+
@MinLength(1, { message: 'pre_recovery_token não pode ser vazio' })
|
|
10
|
+
@MaxLength(4096)
|
|
11
|
+
pre_recovery_token: string;
|
|
12
|
+
|
|
13
|
+
@ApiProperty({ description: 'Código TOTP de 6 dígitos' })
|
|
14
|
+
@IsString()
|
|
15
|
+
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
16
|
+
totp: string;
|
|
17
|
+
|
|
18
|
+
@ApiProperty({ description: 'Nova senha', example: 'senha123', minLength: 6 })
|
|
19
|
+
@IsString()
|
|
20
|
+
@MinLength(6, { message: 'password deve ter no mínimo 6 caracteres' })
|
|
21
|
+
@MaxLength(255)
|
|
22
|
+
password: string;
|
|
23
|
+
|
|
24
|
+
@ApiProperty({
|
|
25
|
+
description: 'Confirmação da nova senha',
|
|
26
|
+
example: 'senha123',
|
|
27
|
+
minLength: 6,
|
|
28
|
+
})
|
|
29
|
+
@IsString()
|
|
30
|
+
@MinLength(6, { message: 'password_confirmation deve ter no mínimo 6 caracteres' })
|
|
31
|
+
@MaxLength(255)
|
|
32
|
+
@MatchField('password', {
|
|
33
|
+
message: 'password_confirmation deve ser igual a password',
|
|
34
|
+
})
|
|
35
|
+
password_confirmation: string;
|
|
36
|
+
}
|