@likewatt/models 1.95.0 → 1.96.0
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/core/User.d.ts +21 -0
- package/dist/core/User.js +66 -2
- package/package.json +1 -1
package/dist/core/User.d.ts
CHANGED
|
@@ -60,6 +60,26 @@ export declare const WebhookParamsSchema: import("mongoose").Schema<WebhookParam
|
|
|
60
60
|
} & {
|
|
61
61
|
__v: number;
|
|
62
62
|
}>;
|
|
63
|
+
/**
|
|
64
|
+
* 2FA TOTP. Les champs sensibles ne quittent jamais le microservice par
|
|
65
|
+
* défaut : le prop `mfa` du User est déclaré `select: false`.
|
|
66
|
+
*/
|
|
67
|
+
export declare class Mfa {
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
secret?: string;
|
|
70
|
+
pendingSecret?: string;
|
|
71
|
+
backupCodes?: string[];
|
|
72
|
+
enabledAt?: Date;
|
|
73
|
+
}
|
|
74
|
+
export declare const MfaSchema: import("mongoose").Schema<Mfa, import("mongoose").Model<Mfa, any, any, any, Document<unknown, any, Mfa, any, {}> & Mfa & {
|
|
75
|
+
_id: import("mongoose").Types.ObjectId;
|
|
76
|
+
} & {
|
|
77
|
+
__v: number;
|
|
78
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Mfa, Document<unknown, {}, import("mongoose").FlatRecord<Mfa>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Mfa> & {
|
|
79
|
+
_id: import("mongoose").Types.ObjectId;
|
|
80
|
+
} & {
|
|
81
|
+
__v: number;
|
|
82
|
+
}>;
|
|
63
83
|
/**
|
|
64
84
|
* Représente un utilisateur dans le système.
|
|
65
85
|
* - @Schema/timestamps : gère createdAt et updatedAt automatiques
|
|
@@ -72,6 +92,7 @@ export declare class User {
|
|
|
72
92
|
leadTenantId?: string | null;
|
|
73
93
|
email: string;
|
|
74
94
|
password: string;
|
|
95
|
+
mfa?: Mfa;
|
|
75
96
|
firstname: string;
|
|
76
97
|
folders: Folder[];
|
|
77
98
|
managerLicenses?: ManagerLicenses;
|
package/dist/core/User.js
CHANGED
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.UserSchema = exports.User = exports.WebhookParamsSchema = exports.WebhookParams = exports.tokenDataSchema = exports.tokenData = exports.RightsSchema = exports.Rights = exports.SiteTagSchema = exports.SiteTag = void 0;
|
|
12
|
+
exports.UserSchema = exports.User = exports.MfaSchema = exports.Mfa = exports.WebhookParamsSchema = exports.WebhookParams = exports.tokenDataSchema = exports.tokenData = exports.RightsSchema = exports.Rights = exports.SiteTagSchema = exports.SiteTag = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
15
15
|
const uuid_1 = require("uuid");
|
|
@@ -143,6 +143,63 @@ exports.WebhookParams = WebhookParams = __decorate([
|
|
|
143
143
|
(0, mongoose_1.Schema)({ _id: false })
|
|
144
144
|
], WebhookParams);
|
|
145
145
|
exports.WebhookParamsSchema = mongoose_1.SchemaFactory.createForClass(WebhookParams);
|
|
146
|
+
/**
|
|
147
|
+
* 2FA TOTP. Les champs sensibles ne quittent jamais le microservice par
|
|
148
|
+
* défaut : le prop `mfa` du User est déclaré `select: false`.
|
|
149
|
+
*/
|
|
150
|
+
let Mfa = class Mfa {
|
|
151
|
+
};
|
|
152
|
+
exports.Mfa = Mfa;
|
|
153
|
+
__decorate([
|
|
154
|
+
(0, swagger_1.ApiProperty)({ description: '2FA active', example: false }),
|
|
155
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: true, default: false }),
|
|
156
|
+
(0, class_validator_1.IsBoolean)(),
|
|
157
|
+
__metadata("design:type", Boolean)
|
|
158
|
+
], Mfa.prototype, "enabled", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
(0, swagger_1.ApiProperty)({
|
|
161
|
+
description: 'Secret TOTP chiffré AES-256-GCM (format iv:tag:cipher hex)',
|
|
162
|
+
writeOnly: true,
|
|
163
|
+
required: false,
|
|
164
|
+
}),
|
|
165
|
+
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
166
|
+
(0, class_validator_1.IsOptional)(),
|
|
167
|
+
(0, class_validator_1.IsString)(),
|
|
168
|
+
__metadata("design:type", String)
|
|
169
|
+
], Mfa.prototype, "secret", void 0);
|
|
170
|
+
__decorate([
|
|
171
|
+
(0, swagger_1.ApiProperty)({
|
|
172
|
+
description: 'Secret en attente de validation (setup non confirmé)',
|
|
173
|
+
writeOnly: true,
|
|
174
|
+
required: false,
|
|
175
|
+
}),
|
|
176
|
+
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
177
|
+
(0, class_validator_1.IsOptional)(),
|
|
178
|
+
(0, class_validator_1.IsString)(),
|
|
179
|
+
__metadata("design:type", String)
|
|
180
|
+
], Mfa.prototype, "pendingSecret", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
(0, swagger_1.ApiProperty)({
|
|
183
|
+
description: 'Backup codes hashés (sha256 hex)',
|
|
184
|
+
writeOnly: true,
|
|
185
|
+
required: false,
|
|
186
|
+
}),
|
|
187
|
+
(0, mongoose_1.Prop)({ type: [String], required: false, default: [] }),
|
|
188
|
+
(0, class_validator_1.IsOptional)(),
|
|
189
|
+
(0, class_validator_1.IsArray)(),
|
|
190
|
+
__metadata("design:type", Array)
|
|
191
|
+
], Mfa.prototype, "backupCodes", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
(0, swagger_1.ApiProperty)({ description: "Date d'activation", required: false }),
|
|
194
|
+
(0, mongoose_1.Prop)({ type: Date, required: false }),
|
|
195
|
+
(0, class_validator_1.IsOptional)(),
|
|
196
|
+
(0, class_validator_1.IsDate)(),
|
|
197
|
+
__metadata("design:type", Date)
|
|
198
|
+
], Mfa.prototype, "enabledAt", void 0);
|
|
199
|
+
exports.Mfa = Mfa = __decorate([
|
|
200
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
201
|
+
], Mfa);
|
|
202
|
+
exports.MfaSchema = mongoose_1.SchemaFactory.createForClass(Mfa);
|
|
146
203
|
/**
|
|
147
204
|
* Représente un utilisateur dans le système.
|
|
148
205
|
* - @Schema/timestamps : gère createdAt et updatedAt automatiques
|
|
@@ -189,10 +246,17 @@ __decorate([
|
|
|
189
246
|
writeOnly: true,
|
|
190
247
|
minLength: 8,
|
|
191
248
|
}),
|
|
192
|
-
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
249
|
+
(0, mongoose_1.Prop)({ type: String, required: true, select: false }),
|
|
193
250
|
(0, class_validator_1.IsString)(),
|
|
194
251
|
__metadata("design:type", String)
|
|
195
252
|
], User.prototype, "password", void 0);
|
|
253
|
+
__decorate([
|
|
254
|
+
(0, swagger_1.ApiProperty)({ type: Mfa, required: false }),
|
|
255
|
+
(0, mongoose_1.Prop)({ type: exports.MfaSchema, _id: false, required: false, select: false }),
|
|
256
|
+
(0, class_validator_1.IsOptional)(),
|
|
257
|
+
(0, class_validator_1.IsObject)(),
|
|
258
|
+
__metadata("design:type", Mfa)
|
|
259
|
+
], User.prototype, "mfa", void 0);
|
|
196
260
|
__decorate([
|
|
197
261
|
(0, swagger_1.ApiProperty)({
|
|
198
262
|
description: 'Prénom de l’utilisateur',
|