@skyapp-labs/blueprint-backend-core 1.6.0 → 1.8.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/CHANGELOG.md +21 -10
- package/dist/common/decorators/otp-length-aware.decorator.d.ts +3 -0
- package/dist/common/decorators/otp-length-aware.decorator.d.ts.map +1 -0
- package/dist/common/decorators/otp-length-aware.decorator.js +8 -0
- package/dist/common/decorators/otp-length-aware.decorator.js.map +1 -0
- package/dist/common/decorators/pin-length-aware.decorator.d.ts +3 -0
- package/dist/common/decorators/pin-length-aware.decorator.d.ts.map +1 -0
- package/dist/common/decorators/pin-length-aware.decorator.js +8 -0
- package/dist/common/decorators/pin-length-aware.decorator.js.map +1 -0
- package/dist/common/pipes/config-aware-validation.pipe.d.ts.map +1 -1
- package/dist/common/pipes/config-aware-validation.pipe.js +13 -4
- package/dist/common/pipes/config-aware-validation.pipe.js.map +1 -1
- package/dist/common/validators/is-configured-otp-length.validator.d.ts +9 -0
- package/dist/common/validators/is-configured-otp-length.validator.d.ts.map +1 -0
- package/dist/common/validators/is-configured-otp-length.validator.js +40 -0
- package/dist/common/validators/is-configured-otp-length.validator.js.map +1 -0
- package/dist/common/validators/is-configured-pin-length.validator.d.ts +7 -0
- package/dist/common/validators/is-configured-pin-length.validator.d.ts.map +1 -0
- package/dist/common/validators/is-configured-pin-length.validator.js +43 -0
- package/dist/common/validators/is-configured-pin-length.validator.js.map +1 -0
- package/dist/database/seeds/settings.seed.d.ts.map +1 -1
- package/dist/database/seeds/settings.seed.js +17 -1
- package/dist/database/seeds/settings.seed.js.map +1 -1
- package/dist/modules/auth/controllers/otp.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/otp.controller.js +3 -3
- package/dist/modules/auth/controllers/otp.controller.js.map +1 -1
- package/dist/modules/auth/controllers/pin.controller.d.ts +1 -0
- package/dist/modules/auth/controllers/pin.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/pin.controller.js +37 -0
- package/dist/modules/auth/controllers/pin.controller.js.map +1 -1
- package/dist/modules/auth/dto/login-phone.dto.d.ts +2 -1
- package/dist/modules/auth/dto/login-phone.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/login-phone.dto.js +9 -3
- package/dist/modules/auth/dto/login-phone.dto.js.map +1 -1
- package/dist/modules/auth/dto/otp.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/otp.dto.js +7 -2
- package/dist/modules/auth/dto/otp.dto.js.map +1 -1
- package/dist/modules/auth/dto/pin.dto.d.ts +8 -4
- package/dist/modules/auth/dto/pin.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/pin.dto.js +52 -20
- package/dist/modules/auth/dto/pin.dto.js.map +1 -1
- package/dist/modules/auth/dto/register-phone.dto.d.ts +2 -1
- package/dist/modules/auth/dto/register-phone.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/register-phone.dto.js +9 -5
- package/dist/modules/auth/dto/register-phone.dto.js.map +1 -1
- package/dist/modules/auth/services/pin-auth.service.d.ts +4 -0
- package/dist/modules/auth/services/pin-auth.service.d.ts.map +1 -1
- package/dist/modules/auth/services/pin-auth.service.js +38 -15
- package/dist/modules/auth/services/pin-auth.service.js.map +1 -1
- package/dist/modules/otp/constants/otp.constants.d.ts +4 -1
- package/dist/modules/otp/constants/otp.constants.d.ts.map +1 -1
- package/dist/modules/otp/constants/otp.constants.js +14 -2
- package/dist/modules/otp/constants/otp.constants.js.map +1 -1
- package/dist/modules/otp/dto/verify-email.dto.d.ts.map +1 -1
- package/dist/modules/otp/dto/verify-email.dto.js +2 -1
- package/dist/modules/otp/dto/verify-email.dto.js.map +1 -1
- package/dist/modules/otp/dto/verify-otp.dto.d.ts.map +1 -1
- package/dist/modules/otp/dto/verify-otp.dto.js +2 -1
- package/dist/modules/otp/dto/verify-otp.dto.js.map +1 -1
- package/dist/modules/otp/otp.service.d.ts.map +1 -1
- package/dist/modules/otp/otp.service.js +16 -3
- package/dist/modules/otp/otp.service.js.map +1 -1
- package/dist/modules/otp/services/otp.session.store.d.ts.map +1 -1
- package/dist/modules/otp/services/otp.session.store.js +3 -1
- package/dist/modules/otp/services/otp.session.store.js.map +1 -1
- package/dist/modules/otp/utils/otp.utils.d.ts +2 -0
- package/dist/modules/otp/utils/otp.utils.d.ts.map +1 -1
- package/dist/modules/otp/utils/otp.utils.js +19 -2
- package/dist/modules/otp/utils/otp.utils.js.map +1 -1
- package/dist/modules/settings/constants/settings.defaults.d.ts +2 -0
- package/dist/modules/settings/constants/settings.defaults.d.ts.map +1 -1
- package/dist/modules/settings/constants/settings.defaults.js +2 -0
- package/dist/modules/settings/constants/settings.defaults.js.map +1 -1
- package/dist/modules/settings/constants/settings.keys.d.ts +2 -0
- package/dist/modules/settings/constants/settings.keys.d.ts.map +1 -1
- package/dist/modules/settings/constants/settings.keys.js +2 -0
- package/dist/modules/settings/constants/settings.keys.js.map +1 -1
- package/dist/modules/settings/controllers/settings.controller.d.ts.map +1 -1
- package/dist/modules/settings/controllers/settings.controller.js +8 -0
- package/dist/modules/settings/controllers/settings.controller.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ exports.resolveChannel = resolveChannel;
|
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
const swagger_1 = require("@nestjs/swagger");
|
|
16
16
|
const auth_method_aware_decorator_1 = require("../../../common/decorators/auth-method-aware.decorator");
|
|
17
|
+
const is_configured_otp_length_validator_1 = require("../../../common/validators/is-configured-otp-length.validator");
|
|
17
18
|
function resolveChannel(o) {
|
|
18
19
|
if (o.channel)
|
|
19
20
|
return o.channel;
|
|
@@ -68,8 +69,12 @@ __decorate([
|
|
|
68
69
|
__metadata("design:type", String)
|
|
69
70
|
], VerifyOtpDto.prototype, "verificationId", void 0);
|
|
70
71
|
__decorate([
|
|
71
|
-
(0, swagger_1.ApiProperty)({
|
|
72
|
-
|
|
72
|
+
(0, swagger_1.ApiProperty)({
|
|
73
|
+
example: '123456',
|
|
74
|
+
description: 'OTP code sent via SMS or email (4–6 digits). Normally matches otp.code_length; test OTP codes may differ.',
|
|
75
|
+
}),
|
|
76
|
+
(0, class_validator_1.IsString)(),
|
|
77
|
+
(0, is_configured_otp_length_validator_1.IsConfiguredOtpLength)(),
|
|
73
78
|
__metadata("design:type", String)
|
|
74
79
|
], VerifyOtpDto.prototype, "otp", void 0);
|
|
75
80
|
class ResendOtpDto {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.dto.js","sourceRoot":"","sources":["../../../../src/modules/auth/dto/otp.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"otp.dto.js","sourceRoot":"","sources":["../../../../src/modules/auth/dto/otp.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsBA,wCAIC;AA1BD,qDAQyB;AACzB,6CAAmE;AACnE,wGAAyF;AACzF,sHAAsG;AAWtG,SAAgB,cAAc,CAAC,CAAa;IAC3C,IAAI,CAAC,CAAC,OAAO;QAAE,OAAO,CAAC,CAAC,OAAO,CAAC;IAChC,IAAI,CAAC,CAAC,WAAW,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IAC9C,OAAO,KAAK,CAAC;AACd,CAAC;AAGM,IAAM,UAAU,GAAhB,MAAM,UAAU;CA8BtB,CAAA;AA9BY,gCAAU;AAGtB;IADC,IAAA,4BAAU,GAAE;;+CACmB;AAUhC;IARC,IAAA,6BAAmB,EAAC;QACpB,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;QACtB,OAAO,EAAE,KAAK;QACd,WAAW,EACV,gGAAgG;KACjG,CAAC;IACD,IAAA,sBAAI,EAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACtB,IAAA,4BAAU,GAAE;;2CACa;AAQ1B;IANC,IAAA,6BAAmB,EAAC;QACpB,OAAO,EAAE,gBAAgB;QACzB,WAAW,EAAE,yEAAyE;KACtF,CAAC;IACD,IAAA,4BAAU,EAAC,CAAC,CAAa,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC;IAC1D,IAAA,+BAAa,GAAE;;yCACD;AAQf;IANC,IAAA,6BAAmB,EAAC;QACpB,OAAO,EAAE,kBAAkB;QAC3B,WAAW,EAAE,4DAA4D;KACzE,CAAC;IACD,IAAA,4BAAU,EAAC,CAAC,CAAa,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC;IAC5D,IAAA,yBAAO,GAAE;;yCACK;qBA7BH,UAAU;IADtB,IAAA,6CAAe,GAAE;GACL,UAAU,CA8BtB;AAED,MAAa,YAAY;CAaxB;AAbD,oCAaC;AAVA;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,oDAAoD,EAAE,CAAC;IAClF,IAAA,wBAAM,GAAE;;oDACe;AASxB;IAPC,IAAA,qBAAW,EAAC;QACZ,OAAO,EAAE,QAAQ;QACjB,WAAW,EACV,2GAA2G;KAC5G,CAAC;IACD,IAAA,0BAAQ,GAAE;IACV,IAAA,0DAAqB,GAAE;;yCACX;AAGd,MAAa,YAAY;CAIxB;AAJD,oCAIC;AADA;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;IACpE,IAAA,wBAAM,GAAE;;oDACe"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
export declare class
|
|
1
|
+
export declare class PinLengthAwareDto {
|
|
2
|
+
_pinLength?: number;
|
|
3
|
+
}
|
|
4
|
+
export declare class SetPinDto extends PinLengthAwareDto {
|
|
2
5
|
type: string;
|
|
3
6
|
pin: string;
|
|
4
7
|
}
|
|
5
|
-
export declare class ChangePinDto {
|
|
8
|
+
export declare class ChangePinDto extends PinLengthAwareDto {
|
|
6
9
|
type: string;
|
|
7
10
|
currentPin: string;
|
|
8
11
|
newPin: string;
|
|
9
12
|
}
|
|
10
|
-
export declare class VerifyPinDto {
|
|
13
|
+
export declare class VerifyPinDto extends PinLengthAwareDto {
|
|
11
14
|
type: string;
|
|
12
15
|
pin: string;
|
|
13
16
|
}
|
|
14
|
-
export declare class RemovePinDto {
|
|
17
|
+
export declare class RemovePinDto extends PinLengthAwareDto {
|
|
15
18
|
type: string;
|
|
16
19
|
currentPin: string;
|
|
17
20
|
}
|
|
@@ -22,5 +25,6 @@ export declare class PinStatusDto {
|
|
|
22
25
|
lastVerifiedAt?: Date;
|
|
23
26
|
isLocked: boolean;
|
|
24
27
|
lockedUntil?: Date;
|
|
28
|
+
length: number;
|
|
25
29
|
}
|
|
26
30
|
//# sourceMappingURL=pin.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pin.dto.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/dto/pin.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pin.dto.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/dto/pin.dto.ts"],"names":[],"mappings":"AAMA,qBAAa,iBAAiB;IAE7B,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,qBACa,SAAU,SAAQ,iBAAiB;IAO/C,IAAI,EAAG,MAAM,CAAC;IAQd,GAAG,EAAG,MAAM,CAAC;CACb;AAID,qBACa,YAAa,SAAQ,iBAAiB;IAOlD,IAAI,EAAG,MAAM,CAAC;IAKd,UAAU,EAAG,MAAM,CAAC;IAKpB,MAAM,EAAG,MAAM,CAAC;CAChB;AAID,qBACa,YAAa,SAAQ,iBAAiB;IAOlD,IAAI,EAAG,MAAM,CAAC;IAQd,GAAG,EAAG,MAAM,CAAC;CACb;AAID,qBACa,YAAa,SAAQ,iBAAiB;IAOlD,IAAI,EAAG,MAAM,CAAC;IAKd,UAAU,EAAG,MAAM,CAAC;CACpB;AAID,qBAAa,YAAY;IAExB,IAAI,EAAG,MAAM,CAAC;IAGd,KAAK,EAAG,OAAO,CAAC;IAGhB,YAAY,CAAC,EAAE,IAAI,CAAC;IAGpB,cAAc,CAAC,EAAE,IAAI,CAAC;IAGtB,QAAQ,EAAG,OAAO,CAAC;IAGnB,WAAW,CAAC,EAAE,IAAI,CAAC;IAMnB,MAAM,EAAG,MAAM,CAAC;CAChB"}
|
|
@@ -9,13 +9,20 @@ 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.PinStatusDto = exports.RemovePinDto = exports.VerifyPinDto = exports.ChangePinDto = exports.SetPinDto = void 0;
|
|
12
|
+
exports.PinStatusDto = exports.RemovePinDto = exports.VerifyPinDto = exports.ChangePinDto = exports.SetPinDto = exports.PinLengthAwareDto = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
class
|
|
15
|
+
const pin_length_aware_decorator_1 = require("../../../common/decorators/pin-length-aware.decorator");
|
|
16
|
+
const is_configured_pin_length_validator_1 = require("../../../common/validators/is-configured-pin-length.validator");
|
|
17
|
+
class PinLengthAwareDto {
|
|
18
18
|
}
|
|
19
|
+
exports.PinLengthAwareDto = PinLengthAwareDto;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, class_validator_1.IsOptional)(),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], PinLengthAwareDto.prototype, "_pinLength", void 0);
|
|
24
|
+
let SetPinDto = class SetPinDto extends PinLengthAwareDto {
|
|
25
|
+
};
|
|
19
26
|
exports.SetPinDto = SetPinDto;
|
|
20
27
|
__decorate([
|
|
21
28
|
(0, swagger_1.ApiProperty)({
|
|
@@ -27,13 +34,19 @@ __decorate([
|
|
|
27
34
|
__metadata("design:type", String)
|
|
28
35
|
], SetPinDto.prototype, "type", void 0);
|
|
29
36
|
__decorate([
|
|
30
|
-
(0, swagger_1.ApiProperty)({
|
|
37
|
+
(0, swagger_1.ApiProperty)({
|
|
38
|
+
description: 'Numeric PIN (length configured via pin.length setting)',
|
|
39
|
+
example: '123456',
|
|
40
|
+
}),
|
|
31
41
|
(0, class_validator_1.IsString)(),
|
|
32
|
-
(0,
|
|
42
|
+
(0, is_configured_pin_length_validator_1.IsConfiguredPinLength)(),
|
|
33
43
|
__metadata("design:type", String)
|
|
34
44
|
], SetPinDto.prototype, "pin", void 0);
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
exports.SetPinDto = SetPinDto = __decorate([
|
|
46
|
+
(0, pin_length_aware_decorator_1.PinLengthAware)()
|
|
47
|
+
], SetPinDto);
|
|
48
|
+
let ChangePinDto = class ChangePinDto extends PinLengthAwareDto {
|
|
49
|
+
};
|
|
37
50
|
exports.ChangePinDto = ChangePinDto;
|
|
38
51
|
__decorate([
|
|
39
52
|
(0, swagger_1.ApiProperty)({
|
|
@@ -45,19 +58,22 @@ __decorate([
|
|
|
45
58
|
__metadata("design:type", String)
|
|
46
59
|
], ChangePinDto.prototype, "type", void 0);
|
|
47
60
|
__decorate([
|
|
48
|
-
(0, swagger_1.ApiProperty)({ description: 'Current PIN
|
|
61
|
+
(0, swagger_1.ApiProperty)({ description: 'Current PIN', example: '123456' }),
|
|
49
62
|
(0, class_validator_1.IsString)(),
|
|
50
|
-
(0,
|
|
63
|
+
(0, is_configured_pin_length_validator_1.IsConfiguredPinLength)(),
|
|
51
64
|
__metadata("design:type", String)
|
|
52
65
|
], ChangePinDto.prototype, "currentPin", void 0);
|
|
53
66
|
__decorate([
|
|
54
|
-
(0, swagger_1.ApiProperty)({ description: 'New PIN
|
|
67
|
+
(0, swagger_1.ApiProperty)({ description: 'New PIN', example: '654321' }),
|
|
55
68
|
(0, class_validator_1.IsString)(),
|
|
56
|
-
(0,
|
|
69
|
+
(0, is_configured_pin_length_validator_1.IsConfiguredPinLength)(),
|
|
57
70
|
__metadata("design:type", String)
|
|
58
71
|
], ChangePinDto.prototype, "newPin", void 0);
|
|
59
|
-
|
|
60
|
-
|
|
72
|
+
exports.ChangePinDto = ChangePinDto = __decorate([
|
|
73
|
+
(0, pin_length_aware_decorator_1.PinLengthAware)()
|
|
74
|
+
], ChangePinDto);
|
|
75
|
+
let VerifyPinDto = class VerifyPinDto extends PinLengthAwareDto {
|
|
76
|
+
};
|
|
61
77
|
exports.VerifyPinDto = VerifyPinDto;
|
|
62
78
|
__decorate([
|
|
63
79
|
(0, swagger_1.ApiProperty)({
|
|
@@ -69,13 +85,19 @@ __decorate([
|
|
|
69
85
|
__metadata("design:type", String)
|
|
70
86
|
], VerifyPinDto.prototype, "type", void 0);
|
|
71
87
|
__decorate([
|
|
72
|
-
(0, swagger_1.ApiProperty)({
|
|
88
|
+
(0, swagger_1.ApiProperty)({
|
|
89
|
+
description: 'Numeric PIN (length configured via pin.length setting)',
|
|
90
|
+
example: '123456',
|
|
91
|
+
}),
|
|
73
92
|
(0, class_validator_1.IsString)(),
|
|
74
|
-
(0,
|
|
93
|
+
(0, is_configured_pin_length_validator_1.IsConfiguredPinLength)(),
|
|
75
94
|
__metadata("design:type", String)
|
|
76
95
|
], VerifyPinDto.prototype, "pin", void 0);
|
|
77
|
-
|
|
78
|
-
|
|
96
|
+
exports.VerifyPinDto = VerifyPinDto = __decorate([
|
|
97
|
+
(0, pin_length_aware_decorator_1.PinLengthAware)()
|
|
98
|
+
], VerifyPinDto);
|
|
99
|
+
let RemovePinDto = class RemovePinDto extends PinLengthAwareDto {
|
|
100
|
+
};
|
|
79
101
|
exports.RemovePinDto = RemovePinDto;
|
|
80
102
|
__decorate([
|
|
81
103
|
(0, swagger_1.ApiProperty)({
|
|
@@ -87,11 +109,14 @@ __decorate([
|
|
|
87
109
|
__metadata("design:type", String)
|
|
88
110
|
], RemovePinDto.prototype, "type", void 0);
|
|
89
111
|
__decorate([
|
|
90
|
-
(0, swagger_1.ApiProperty)({ description: 'Current PIN — required to confirm removal', example: '
|
|
112
|
+
(0, swagger_1.ApiProperty)({ description: 'Current PIN — required to confirm removal', example: '123456' }),
|
|
91
113
|
(0, class_validator_1.IsString)(),
|
|
92
|
-
(0,
|
|
114
|
+
(0, is_configured_pin_length_validator_1.IsConfiguredPinLength)(),
|
|
93
115
|
__metadata("design:type", String)
|
|
94
116
|
], RemovePinDto.prototype, "currentPin", void 0);
|
|
117
|
+
exports.RemovePinDto = RemovePinDto = __decorate([
|
|
118
|
+
(0, pin_length_aware_decorator_1.PinLengthAware)()
|
|
119
|
+
], RemovePinDto);
|
|
95
120
|
class PinStatusDto {
|
|
96
121
|
}
|
|
97
122
|
exports.PinStatusDto = PinStatusDto;
|
|
@@ -119,4 +144,11 @@ __decorate([
|
|
|
119
144
|
(0, swagger_1.ApiPropertyOptional)({ example: '2024-01-16T08:05:00.000Z' }),
|
|
120
145
|
__metadata("design:type", Date)
|
|
121
146
|
], PinStatusDto.prototype, "lockedUntil", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
(0, swagger_1.ApiProperty)({
|
|
149
|
+
example: 6,
|
|
150
|
+
description: 'Required PIN digit length from the pin.length app setting',
|
|
151
|
+
}),
|
|
152
|
+
__metadata("design:type", Number)
|
|
153
|
+
], PinStatusDto.prototype, "length", void 0);
|
|
122
154
|
//# sourceMappingURL=pin.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pin.dto.js","sourceRoot":"","sources":["../../../../src/modules/auth/dto/pin.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmE;AACnE,
|
|
1
|
+
{"version":3,"file":"pin.dto.js","sourceRoot":"","sources":["../../../../src/modules/auth/dto/pin.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmE;AACnE,qDAAmE;AACnE,sGAAuF;AACvF,sHAAsG;AAGtG,MAAa,iBAAiB;CAG7B;AAHD,8CAGC;AADA;IADC,IAAA,4BAAU,GAAE;;qDACO;AAMd,IAAM,SAAS,GAAf,MAAM,SAA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IAAA,qBAAW,EAAC;QACZ,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,2DAA2D;KACxE,CAAC;;4CACc"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CreateUserProfileDto } from '../../profile/dto/create-user-profile.dto';
|
|
2
|
-
|
|
2
|
+
import { PinLengthAwareDto } from './pin.dto';
|
|
3
|
+
export declare class RegisterPhoneDto extends PinLengthAwareDto {
|
|
3
4
|
verificationToken: string;
|
|
4
5
|
pin?: string;
|
|
5
6
|
password?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-phone.dto.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/dto/register-phone.dto.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"register-phone.dto.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/dto/register-phone.dto.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAGjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,qBACa,gBAAiB,SAAQ,iBAAiB;IAEtD,iBAAiB,EAAG,MAAM,CAAC;IAI3B,GAAG,CAAC,EAAE,MAAM,CAAC;IAKb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAKlB,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAC/B"}
|
|
@@ -13,8 +13,11 @@ exports.RegisterPhoneDto = void 0;
|
|
|
13
13
|
const class_validator_1 = require("class-validator");
|
|
14
14
|
const class_transformer_1 = require("class-transformer");
|
|
15
15
|
const create_user_profile_dto_1 = require("../../profile/dto/create-user-profile.dto");
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const pin_length_aware_decorator_1 = require("../../../common/decorators/pin-length-aware.decorator");
|
|
17
|
+
const is_configured_pin_length_validator_1 = require("../../../common/validators/is-configured-pin-length.validator");
|
|
18
|
+
const pin_dto_1 = require("./pin.dto");
|
|
19
|
+
let RegisterPhoneDto = class RegisterPhoneDto extends pin_dto_1.PinLengthAwareDto {
|
|
20
|
+
};
|
|
18
21
|
exports.RegisterPhoneDto = RegisterPhoneDto;
|
|
19
22
|
__decorate([
|
|
20
23
|
(0, class_validator_1.IsString)(),
|
|
@@ -22,9 +25,7 @@ __decorate([
|
|
|
22
25
|
], RegisterPhoneDto.prototype, "verificationToken", void 0);
|
|
23
26
|
__decorate([
|
|
24
27
|
(0, class_validator_1.IsOptional)(),
|
|
25
|
-
(0,
|
|
26
|
-
message: 'PIN must be between 4 and 8 digits',
|
|
27
|
-
}),
|
|
28
|
+
(0, is_configured_pin_length_validator_1.IsConfiguredPinLength)(),
|
|
28
29
|
__metadata("design:type", String)
|
|
29
30
|
], RegisterPhoneDto.prototype, "pin", void 0);
|
|
30
31
|
__decorate([
|
|
@@ -39,4 +40,7 @@ __decorate([
|
|
|
39
40
|
(0, class_transformer_1.Type)(() => create_user_profile_dto_1.CreateUserProfileDto),
|
|
40
41
|
__metadata("design:type", create_user_profile_dto_1.CreateUserProfileDto)
|
|
41
42
|
], RegisterPhoneDto.prototype, "profile", void 0);
|
|
43
|
+
exports.RegisterPhoneDto = RegisterPhoneDto = __decorate([
|
|
44
|
+
(0, pin_length_aware_decorator_1.PinLengthAware)()
|
|
45
|
+
], RegisterPhoneDto);
|
|
42
46
|
//# sourceMappingURL=register-phone.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-phone.dto.js","sourceRoot":"","sources":["../../../../src/modules/auth/dto/register-phone.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,
|
|
1
|
+
{"version":3,"file":"register-phone.dto.js","sourceRoot":"","sources":["../../../../src/modules/auth/dto/register-phone.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,qDAAkF;AAElF,yDAAyC;AAEzC,uFAAiF;AACjF,sGAAuF;AACvF,sHAAsG;AACtG,uCAA8C;AAGvC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,2BAAiB;CAiBtD,CAAA;AAjBY,4CAAgB;AAE5B;IADC,IAAA,0BAAQ,GAAE;;2DACgB;AAI3B;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0DAAqB,GAAE;;6CACX;AAKb;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;;kDACK;AAKlB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,8CAAoB,CAAC;8BACvB,8CAAoB;iDAAC;2BAhBnB,gBAAgB;IAD5B,IAAA,2CAAc,GAAE;GACJ,gBAAgB,CAiB5B"}
|
|
@@ -19,10 +19,14 @@ export declare class PinAuthService {
|
|
|
19
19
|
removePin(userId: string, dto: RemovePinDto): Promise<{
|
|
20
20
|
message: string;
|
|
21
21
|
}>;
|
|
22
|
+
getPinStatusForType(userId: string, type: string): Promise<PinStatusDto>;
|
|
22
23
|
getPinStatus(userId: string): Promise<PinStatusDto[]>;
|
|
23
24
|
private loadPinRecord;
|
|
24
25
|
private assertPinCorrect;
|
|
25
26
|
private getAllowedTypes;
|
|
27
|
+
private getConfiguredPinLength;
|
|
28
|
+
private buildPinStatus;
|
|
26
29
|
private assertAllowedType;
|
|
30
|
+
private assertPinLength;
|
|
27
31
|
}
|
|
28
32
|
//# sourceMappingURL=pin-auth.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pin-auth.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/services/pin-auth.service.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,O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E,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAmB1E,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAkB1E,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAYxE,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;YAc7C,aAAa;YAmBb,gBAAgB;IA0D9B,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,cAAc;IAuBtB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,eAAe;CAMvB"}
|
|
@@ -62,6 +62,7 @@ let PinAuthService = PinAuthService_1 = class PinAuthService {
|
|
|
62
62
|
}
|
|
63
63
|
async setPin(userId, dto) {
|
|
64
64
|
this.assertAllowedType(dto.type);
|
|
65
|
+
this.assertPinLength(dto.pin);
|
|
65
66
|
const existing = await this.pinRepo.findOne({ where: { userId, type: dto.type } });
|
|
66
67
|
if (existing) {
|
|
67
68
|
throw new common_1.ConflictException(`A ${dto.type} PIN is already set. Use the change-pin endpoint to update it.`);
|
|
@@ -78,6 +79,8 @@ let PinAuthService = PinAuthService_1 = class PinAuthService {
|
|
|
78
79
|
}
|
|
79
80
|
async changePin(userId, dto) {
|
|
80
81
|
this.assertAllowedType(dto.type);
|
|
82
|
+
this.assertPinLength(dto.currentPin);
|
|
83
|
+
this.assertPinLength(dto.newPin);
|
|
81
84
|
const record = await this.loadPinRecord(userId, dto.type);
|
|
82
85
|
await this.assertPinCorrect(record, dto.currentPin);
|
|
83
86
|
record.pinHash = await argon2.hash(dto.newPin);
|
|
@@ -90,6 +93,7 @@ let PinAuthService = PinAuthService_1 = class PinAuthService {
|
|
|
90
93
|
}
|
|
91
94
|
async verifyPin(userId, dto) {
|
|
92
95
|
this.assertAllowedType(dto.type);
|
|
96
|
+
this.assertPinLength(dto.pin);
|
|
93
97
|
const record = await this.loadPinRecord(userId, dto.type);
|
|
94
98
|
await this.assertPinCorrect(record, dto.pin);
|
|
95
99
|
record.lastVerifiedAt = new Date();
|
|
@@ -99,31 +103,23 @@ let PinAuthService = PinAuthService_1 = class PinAuthService {
|
|
|
99
103
|
}
|
|
100
104
|
async removePin(userId, dto) {
|
|
101
105
|
this.assertAllowedType(dto.type);
|
|
106
|
+
this.assertPinLength(dto.currentPin);
|
|
102
107
|
const record = await this.loadPinRecord(userId, dto.type);
|
|
103
108
|
await this.assertPinCorrect(record, dto.currentPin);
|
|
104
109
|
await this.pinRepo.remove(record);
|
|
105
110
|
this.logger.log({ event: 'PIN_REMOVED', userId, type: dto.type });
|
|
106
111
|
return { message: `${dto.type} PIN removed successfully.` };
|
|
107
112
|
}
|
|
113
|
+
async getPinStatusForType(userId, type) {
|
|
114
|
+
this.assertAllowedType(type);
|
|
115
|
+
const record = await this.pinRepo.findOne({ where: { userId, type } });
|
|
116
|
+
return this.buildPinStatus(type, record ?? undefined);
|
|
117
|
+
}
|
|
108
118
|
async getPinStatus(userId) {
|
|
109
119
|
const allowedTypes = this.getAllowedTypes();
|
|
110
120
|
const records = await this.pinRepo.find({ where: { userId } });
|
|
111
121
|
const recordMap = new Map(records.map((r) => [r.type, r]));
|
|
112
|
-
|
|
113
|
-
return allowedTypes.map((type) => {
|
|
114
|
-
const record = recordMap.get(type);
|
|
115
|
-
if (!record) {
|
|
116
|
-
return { type, isSet: false, isLocked: false };
|
|
117
|
-
}
|
|
118
|
-
return {
|
|
119
|
-
type,
|
|
120
|
-
isSet: true,
|
|
121
|
-
pinUpdatedAt: record.pinUpdatedAt,
|
|
122
|
-
lastVerifiedAt: record.lastVerifiedAt,
|
|
123
|
-
isLocked: !!(record.lockedUntil && record.lockedUntil > now),
|
|
124
|
-
lockedUntil: record.lockedUntil,
|
|
125
|
-
};
|
|
126
|
-
});
|
|
122
|
+
return allowedTypes.map((type) => this.buildPinStatus(type, recordMap.get(type)));
|
|
127
123
|
}
|
|
128
124
|
async loadPinRecord(userId, type) {
|
|
129
125
|
const record = await this.pinRepo
|
|
@@ -142,6 +138,8 @@ let PinAuthService = PinAuthService_1 = class PinAuthService {
|
|
|
142
138
|
const secondsLeft = Math.ceil((record.lockedUntil.getTime() - Date.now()) / 1000);
|
|
143
139
|
throw new common_1.ForbiddenException(`PIN is locked. Try again in ${secondsLeft}s.`);
|
|
144
140
|
}
|
|
141
|
+
console.log('record.pinHash', record.pinHash);
|
|
142
|
+
console.log('rawPin', rawPin);
|
|
145
143
|
const valid = await argon2.verify(record.pinHash, rawPin);
|
|
146
144
|
if (!valid) {
|
|
147
145
|
const maxAttempts = this.settingsService.get(settings_keys_1.SETTING_KEYS.PIN_MAX_ATTEMPTS);
|
|
@@ -176,12 +174,37 @@ let PinAuthService = PinAuthService_1 = class PinAuthService {
|
|
|
176
174
|
getAllowedTypes() {
|
|
177
175
|
return this.settingsService.get(settings_keys_1.SETTING_KEYS.PIN_ALLOWED_TYPES);
|
|
178
176
|
}
|
|
177
|
+
getConfiguredPinLength() {
|
|
178
|
+
return this.settingsService.get(settings_keys_1.SETTING_KEYS.PIN_LENGTH);
|
|
179
|
+
}
|
|
180
|
+
buildPinStatus(type, record) {
|
|
181
|
+
const length = this.getConfiguredPinLength();
|
|
182
|
+
const now = new Date();
|
|
183
|
+
if (!record) {
|
|
184
|
+
return { type, isSet: false, isLocked: false, length };
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
type,
|
|
188
|
+
isSet: true,
|
|
189
|
+
pinUpdatedAt: record.pinUpdatedAt,
|
|
190
|
+
lastVerifiedAt: record.lastVerifiedAt,
|
|
191
|
+
isLocked: !!(record.lockedUntil && record.lockedUntil > now),
|
|
192
|
+
lockedUntil: record.lockedUntil,
|
|
193
|
+
length,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
179
196
|
assertAllowedType(type) {
|
|
180
197
|
const allowed = this.getAllowedTypes();
|
|
181
198
|
if (!allowed.includes(type)) {
|
|
182
199
|
throw new common_1.BadRequestException(`Unknown PIN type "${type}". Allowed types: ${allowed.join(', ')}.`);
|
|
183
200
|
}
|
|
184
201
|
}
|
|
202
|
+
assertPinLength(pin) {
|
|
203
|
+
const length = this.settingsService.get(settings_keys_1.SETTING_KEYS.PIN_LENGTH);
|
|
204
|
+
if (!new RegExp(`^\\d{${length}}$`).test(pin)) {
|
|
205
|
+
throw new common_1.BadRequestException(`PIN must be exactly ${length} digits.`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
185
208
|
};
|
|
186
209
|
exports.PinAuthService = PinAuthService;
|
|
187
210
|
exports.PinAuthService = PinAuthService = PinAuthService_1 = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pin-auth.service.js","sourceRoot":"","sources":["../../../../src/modules/auth/services/pin-auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAQwB;AACxB,6CAAmD;AACnD,qCAAqC;AACrC,+CAAiC;AACjC,iEAAsD;AACtD,+EAA2E;AAC3E,0EAAsE;AAI/D,IAAM,cAAc,sBAApB,MAAM,cAAc;IAG1B,YAEC,OAA6C,EAC5B,eAAgC;QADhC,YAAO,GAAP,OAAO,CAAqB;QAC5B,oBAAe,GAAf,eAAe,CAAiB;QALjC,WAAM,GAAG,IAAI,eAAM,CAAC,gBAAc,CAAC,IAAI,CAAC,CAAC;IAMvD,CAAC;IASJ,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,GAAc;QAC1C,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"pin-auth.service.js","sourceRoot":"","sources":["../../../../src/modules/auth/services/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clampOtpCodeLength(length: number): number;
|
|
4
|
+
export declare function isValidOtpCode(value: string): boolean;
|
|
2
5
|
export declare const OTP_CORRELATION_TTL_SECONDS = 120;
|
|
3
6
|
export declare function renderOtpTemplate(template: string, code: string): string;
|
|
4
7
|
//# sourceMappingURL=otp.constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.constants.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/constants/otp.constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"otp.constants.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/constants/otp.constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,IAAI,CAAC;AAGhC,eAAO,MAAM,cAAc,IAAI,CAAC;AAGhC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIzD;AAGD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD;AAOD,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAQ/C,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAExE"}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OTP_CORRELATION_TTL_SECONDS = exports.
|
|
3
|
+
exports.OTP_CORRELATION_TTL_SECONDS = exports.OTP_MAX_LENGTH = exports.OTP_MIN_LENGTH = void 0;
|
|
4
|
+
exports.clampOtpCodeLength = clampOtpCodeLength;
|
|
5
|
+
exports.isValidOtpCode = isValidOtpCode;
|
|
4
6
|
exports.renderOtpTemplate = renderOtpTemplate;
|
|
5
|
-
exports.
|
|
7
|
+
exports.OTP_MIN_LENGTH = 4;
|
|
8
|
+
exports.OTP_MAX_LENGTH = 6;
|
|
9
|
+
function clampOtpCodeLength(length) {
|
|
10
|
+
const n = Math.trunc(Number(length));
|
|
11
|
+
if (!Number.isFinite(n) || n < exports.OTP_MIN_LENGTH)
|
|
12
|
+
return exports.OTP_MIN_LENGTH;
|
|
13
|
+
return Math.min(n, exports.OTP_MAX_LENGTH);
|
|
14
|
+
}
|
|
15
|
+
function isValidOtpCode(value) {
|
|
16
|
+
return /^\d+$/.test(value) && value.length >= exports.OTP_MIN_LENGTH && value.length <= exports.OTP_MAX_LENGTH;
|
|
17
|
+
}
|
|
6
18
|
exports.OTP_CORRELATION_TTL_SECONDS = 120;
|
|
7
19
|
function renderOtpTemplate(template, code) {
|
|
8
20
|
return template.replace(/\{code\}/g, code);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.constants.js","sourceRoot":"","sources":["../../../../src/modules/otp/constants/otp.constants.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"otp.constants.js","sourceRoot":"","sources":["../../../../src/modules/otp/constants/otp.constants.ts"],"names":[],"mappings":";;;AAWA,gDAIC;AAGD,wCAEC;AAeD,8CAEC;AAhCY,QAAA,cAAc,GAAG,CAAC,CAAC;AAGnB,QAAA,cAAc,GAAG,CAAC,CAAC;AAGhC,SAAgB,kBAAkB,CAAC,MAAc;IAChD,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,sBAAc;QAAE,OAAO,sBAAc,CAAC;IACrE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAc,CAAC,CAAC;AACpC,CAAC;AAGD,SAAgB,cAAc,CAAC,KAAa;IAC3C,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,sBAAc,IAAI,KAAK,CAAC,MAAM,IAAI,sBAAc,CAAC;AAChG,CAAC;AAOY,QAAA,2BAA2B,GAAG,GAAG,CAAC;AAQ/C,SAAgB,iBAAiB,CAAC,QAAgB,EAAE,IAAY;IAC/D,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-email.dto.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/dto/verify-email.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verify-email.dto.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/dto/verify-email.dto.ts"],"names":[],"mappings":"AAKA,qBAAa,cAAc;IAE1B,KAAK,EAAG,MAAM,CAAC;IAIf,GAAG,EAAG,MAAM,CAAC;CACb"}
|
|
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.VerifyEmailDto = void 0;
|
|
13
13
|
const class_validator_1 = require("class-validator");
|
|
14
|
+
const is_configured_otp_length_validator_1 = require("../../../common/validators/is-configured-otp-length.validator");
|
|
14
15
|
class VerifyEmailDto {
|
|
15
16
|
}
|
|
16
17
|
exports.VerifyEmailDto = VerifyEmailDto;
|
|
@@ -20,7 +21,7 @@ __decorate([
|
|
|
20
21
|
], VerifyEmailDto.prototype, "email", void 0);
|
|
21
22
|
__decorate([
|
|
22
23
|
(0, class_validator_1.IsString)(),
|
|
23
|
-
(0,
|
|
24
|
+
(0, is_configured_otp_length_validator_1.IsConfiguredOtpLength)(),
|
|
24
25
|
__metadata("design:type", String)
|
|
25
26
|
], VerifyEmailDto.prototype, "otp", void 0);
|
|
26
27
|
//# sourceMappingURL=verify-email.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-email.dto.js","sourceRoot":"","sources":["../../../../src/modules/otp/dto/verify-email.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,
|
|
1
|
+
{"version":3,"file":"verify-email.dto.js","sourceRoot":"","sources":["../../../../src/modules/otp/dto/verify-email.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,qDAAoD;AACpD,sHAAsG;AAEtG,MAAa,cAAc;CAO1B;AAPD,wCAOC;AALA;IADC,IAAA,yBAAO,GAAE;;6CACK;AAIf;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,0DAAqB,GAAE;;2CACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-otp.dto.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/dto/verify-otp.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verify-otp.dto.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/dto/verify-otp.dto.ts"],"names":[],"mappings":"AAKA,qBAAa,YAAY;IAGxB,WAAW,EAAG,MAAM,CAAC;IAIrB,GAAG,EAAG,MAAM,CAAC;CACb"}
|
|
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.VerifyOtpDto = void 0;
|
|
13
13
|
const class_validator_1 = require("class-validator");
|
|
14
|
+
const is_configured_otp_length_validator_1 = require("../../../common/validators/is-configured-otp-length.validator");
|
|
14
15
|
class VerifyOtpDto {
|
|
15
16
|
}
|
|
16
17
|
exports.VerifyOtpDto = VerifyOtpDto;
|
|
@@ -21,7 +22,7 @@ __decorate([
|
|
|
21
22
|
], VerifyOtpDto.prototype, "phoneNumber", void 0);
|
|
22
23
|
__decorate([
|
|
23
24
|
(0, class_validator_1.IsString)(),
|
|
24
|
-
(0,
|
|
25
|
+
(0, is_configured_otp_length_validator_1.IsConfiguredOtpLength)(),
|
|
25
26
|
__metadata("design:type", String)
|
|
26
27
|
], VerifyOtpDto.prototype, "otp", void 0);
|
|
27
28
|
//# sourceMappingURL=verify-otp.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-otp.dto.js","sourceRoot":"","sources":["../../../../src/modules/otp/dto/verify-otp.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,
|
|
1
|
+
{"version":3,"file":"verify-otp.dto.js","sourceRoot":"","sources":["../../../../src/modules/otp/dto/verify-otp.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,qDAAoD;AACpD,sHAAsG;AAEtG,MAAa,YAAY;CAQxB;AARD,oCAQC;AALA;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,yBAAO,EAAC,oBAAoB,CAAC;;iDACT;AAIrB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,0DAAqB,GAAE;;yCACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.service.d.ts","sourceRoot":"","sources":["../../../src/modules/otp/otp.service.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EACN,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"otp.service.d.ts","sourceRoot":"","sources":["../../../src/modules/otp/otp.service.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EACN,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAIxE,qBACa,UAAW,SAAQ,WAAW;IAMzC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAGtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAZjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+B;gBAKpC,KAAK,EAAE,OAAO,GAAG,IAAI,EAGrB,SAAS,EAAE,SAAS,GAAG,IAAI,EAC3B,YAAY,EAAE,eAAe,EAC7B,WAAW,EAAE,cAAc,EAC3B,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe;IAY5C,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAuBrF,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAuCvE,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA+CjE,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,gBAAgB;IAsCxB,OAAO,CAAC,8BAA8B;IAWtC,OAAO,CAAC,QAAQ;CAGhB"}
|
|
@@ -22,6 +22,7 @@ const redis_module_1 = require("../../config/redis.module");
|
|
|
22
22
|
const otp_session_store_1 = require("./services/otp.session.store");
|
|
23
23
|
const otp_rate_limiter_1 = require("./services/otp.rate-limiter");
|
|
24
24
|
const otp_utils_1 = require("./utils/otp.utils");
|
|
25
|
+
const otp_constants_1 = require("./constants/otp.constants");
|
|
25
26
|
const settings_service_1 = require("../settings/services/settings.service");
|
|
26
27
|
const settings_keys_1 = require("../settings/constants/settings.keys");
|
|
27
28
|
let OtpService = OtpService_1 = class OtpService extends otp_service_interface_1.IOtpService {
|
|
@@ -124,11 +125,23 @@ let OtpService = OtpService_1 = class OtpService extends otp_service_interface_1
|
|
|
124
125
|
if (!Array.isArray(entries))
|
|
125
126
|
return null;
|
|
126
127
|
for (const entry of entries) {
|
|
127
|
-
if (entry.channel !== channel || !entry.identifier?.trim() || !entry.code)
|
|
128
|
+
if (entry.channel !== channel || !entry.identifier?.trim() || !entry.code?.trim()) {
|
|
128
129
|
continue;
|
|
130
|
+
}
|
|
129
131
|
const normalizedEntry = this.normalizeTestSettingIdentifier(entry.identifier.trim(), channel);
|
|
130
|
-
if (normalizedEntry
|
|
131
|
-
|
|
132
|
+
if (normalizedEntry !== normalizedIdentifier)
|
|
133
|
+
continue;
|
|
134
|
+
const code = entry.code.trim();
|
|
135
|
+
if (!(0, otp_constants_1.isValidOtpCode)(code)) {
|
|
136
|
+
this.logger.warn(JSON.stringify({
|
|
137
|
+
event: 'TEST_OTP_ENTRY_SKIPPED',
|
|
138
|
+
reason: 'invalid_code_length',
|
|
139
|
+
identifier: (0, otp_utils_1.maskIdentifier)(normalizedEntry, channel),
|
|
140
|
+
channel,
|
|
141
|
+
}));
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
return { ...entry, identifier: normalizedEntry, code };
|
|
132
145
|
}
|
|
133
146
|
return null;
|
|
134
147
|
}
|