@vynelix/nestjs-multi-auth 1.0.2 → 1.0.3
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 +4 -0
- package/README.md +1 -1
- package/dist/auth/auth.module.js +28 -28
- package/dist/auth/auth.module.js.map +1 -1
- package/dist/auth/core/database-otp.provider.js +14 -4
- package/dist/auth/core/database-otp.provider.js.map +1 -1
- package/dist/auth/decorator/current-user.decorator.d.ts +1 -1
- package/dist/auth/interfaces/auth-module-async-options.interface.d.ts +2 -0
- package/dist/auth/strategies/local-auth.strategy.js +1 -0
- package/dist/auth/strategies/local-auth.strategy.js.map +1 -1
- package/dist/database/typeorm/entities/entities.d.ts +1 -1
- package/dist/database/typeorm/migrations/auth-entities.d.ts +1 -1
- package/dist/database/typeorm/repositories/auth-identifier.repository.js +11 -6
- package/dist/database/typeorm/repositories/auth-identifier.repository.js.map +1 -1
- package/dist/database/typeorm/repositories/otp-token.repository.js +2 -1
- package/dist/database/typeorm/repositories/otp-token.repository.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/auth/auth-type.enum.d.ts +0 -22
- package/dist/auth/auth-type.enum.js +0 -32
- package/dist/auth/auth-type.enum.js.map +0 -1
- package/dist/auth/core/cookie-namespace.resolver.d.ts +0 -8
- package/dist/auth/core/cookie-namespace.resolver.js +0 -48
- package/dist/auth/core/cookie-namespace.resolver.js.map +0 -1
- package/dist/auth/current-user-interface.d.ts +0 -4
- package/dist/auth/current-user-interface.js +0 -4
- package/dist/auth/current-user-interface.js.map +0 -1
- package/dist/auth/current-user.decorator.d.ts +0 -2
- package/dist/auth/current-user.decorator.js +0 -16
- package/dist/auth/current-user.decorator.js.map +0 -1
- package/dist/auth/dto/auth-response.dto.d.ts +0 -17
- package/dist/auth/dto/auth-response.dto.js +0 -83
- package/dist/auth/dto/auth-response.dto.js.map +0 -1
- package/dist/auth/dto/identifier-response.dto.d.ts +0 -8
- package/dist/auth/dto/identifier-response.dto.js +0 -46
- package/dist/auth/dto/identifier-response.dto.js.map +0 -1
- package/dist/auth/dto/login.dto.d.ts +0 -11
- package/dist/auth/dto/login.dto.js +0 -68
- package/dist/auth/dto/login.dto.js.map +0 -1
- package/dist/auth/dto/mfa.dto.d.ts +0 -8
- package/dist/auth/dto/mfa.dto.js +0 -51
- package/dist/auth/dto/mfa.dto.js.map +0 -1
- package/dist/auth/dto/oauth-provider-response.dto.d.ts +0 -5
- package/dist/auth/dto/oauth-provider-response.dto.js +0 -30
- package/dist/auth/dto/oauth-provider-response.dto.js.map +0 -1
- package/dist/auth/dto/refresh-token.dto.d.ts +0 -3
- package/dist/auth/dto/refresh-token.dto.js +0 -28
- package/dist/auth/dto/refresh-token.dto.js.map +0 -1
- package/dist/auth/dto/signup.dto.d.ts +0 -13
- package/dist/auth/dto/signup.dto.js +0 -70
- package/dist/auth/dto/signup.dto.js.map +0 -1
- package/dist/auth/dto/verify.dto.d.ts +0 -7
- package/dist/auth/dto/verify.dto.js +0 -48
- package/dist/auth/dto/verify.dto.js.map +0 -1
- package/dist/auth/entities/auth-identify.entity.d.ts +0 -33
- package/dist/auth/entities/auth-identify.entity.js +0 -73
- package/dist/auth/entities/auth-identify.entity.js.map +0 -1
- package/dist/auth/entities/auth.entity.d.ts +0 -45
- package/dist/auth/entities/auth.entity.js +0 -129
- package/dist/auth/entities/auth.entity.js.map +0 -1
- package/dist/auth/entities/base.entity.d.ts +0 -6
- package/dist/auth/entities/base.entity.js +0 -41
- package/dist/auth/entities/base.entity.js.map +0 -1
- package/dist/auth/entities/entities.d.ts +0 -7
- package/dist/auth/entities/entities.js +0 -18
- package/dist/auth/entities/entities.js.map +0 -1
- package/dist/auth/entities/mfa-method.entity.d.ts +0 -23
- package/dist/auth/entities/mfa-method.entity.js +0 -69
- package/dist/auth/entities/mfa-method.entity.js.map +0 -1
- package/dist/auth/entities/oauth-provider.entity.d.ts +0 -38
- package/dist/auth/entities/oauth-provider.entity.js +0 -88
- package/dist/auth/entities/oauth-provider.entity.js.map +0 -1
- package/dist/auth/entities/otp-token.entity.d.ts +0 -22
- package/dist/auth/entities/otp-token.entity.js +0 -61
- package/dist/auth/entities/otp-token.entity.js.map +0 -1
- package/dist/auth/entities/session.entity.d.ts +0 -21
- package/dist/auth/entities/session.entity.js +0 -71
- package/dist/auth/entities/session.entity.js.map +0 -1
- package/dist/auth/entities/session_log.entity.d.ts +0 -31
- package/dist/auth/entities/session_log.entity.js +0 -85
- package/dist/auth/entities/session_log.entity.js.map +0 -1
- package/dist/auth/interfaces/auth-user-service.interface.d.ts +0 -13
- package/dist/auth/interfaces/auth-user-service.interface.js +0 -7
- package/dist/auth/interfaces/auth-user-service.interface.js.map +0 -1
- package/dist/auth/interfaces/current-user.decorator.d.ts +0 -2
- package/dist/auth/interfaces/current-user.decorator.js +0 -16
- package/dist/auth/interfaces/current-user.decorator.js.map +0 -1
- package/dist/auth/jwt-payload-interface.d.ts +0 -4
- package/dist/auth/jwt-payload-interface.js +0 -3
- package/dist/auth/jwt-payload-interface.js.map +0 -1
- package/dist/auth/jwt.strategy.d.ts +0 -13
- package/dist/auth/jwt.strategy.js +0 -60
- package/dist/auth/jwt.strategy.js.map +0 -1
- package/dist/auth/strategies/company.strategy.d.ts +0 -0
- package/dist/auth/strategies/company.strategy.js +0 -1
- package/dist/auth/strategies/company.strategy.js.map +0 -1
- package/dist/auth/strategies/google.strategy.d.ts +0 -7
- package/dist/auth/strategies/google.strategy.js +0 -23
- package/dist/auth/strategies/google.strategy.js.map +0 -1
- package/dist/auth/strategies/oauth/oauth-strategy.interface.d.ts +0 -14
- package/dist/auth/strategies/oauth/oauth-strategy.interface.js +0 -3
- package/dist/auth/strategies/oauth/oauth-strategy.interface.js.map +0 -1
- package/dist/auth/strategies/otp.strategy.d.ts +0 -7
- package/dist/auth/strategies/otp.strategy.js +0 -23
- package/dist/auth/strategies/otp.strategy.js.map +0 -1
- package/dist/auth/strategies/password.strategy.d.ts +0 -14
- package/dist/auth/strategies/password.strategy.js +0 -130
- package/dist/auth/strategies/password.strategy.js.map +0 -1
- package/dist/migrations/auth-entities.d.ts +0 -7
- package/dist/migrations/auth-entities.js +0 -18
- package/dist/migrations/auth-entities.js.map +0 -1
- package/dist/migrations/auth-schema.initializer.d.ts +0 -9
- package/dist/migrations/auth-schema.initializer.js +0 -36
- package/dist/migrations/auth-schema.initializer.js.map +0 -1
- package/dist/migrations/auth.migration.v1.d.ts +0 -12
- package/dist/migrations/auth.migration.v1.js +0 -157
- package/dist/migrations/auth.migration.v1.js.map +0 -1
- package/dist/migrations/auth.migration.v2.d.ts +0 -8
- package/dist/migrations/auth.migration.v2.js +0 -39
- package/dist/migrations/auth.migration.v2.js.map +0 -1
- package/dist/migrations/auth.migrations.d.ts +0 -2
- package/dist/migrations/auth.migrations.js +0 -8
- package/dist/migrations/auth.migrations.js.map +0 -1
- package/dist/migrations/migration.runner.d.ts +0 -9
- package/dist/migrations/migration.runner.js +0 -67
- package/dist/migrations/migration.runner.js.map +0 -1
- package/dist/migrations/migration.service.d.ts +0 -9
- package/dist/migrations/migration.service.js +0 -75
- package/dist/migrations/migration.service.js.map +0 -1
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.SignupDto = void 0;
|
|
13
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
14
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
-
const class_validator_1 = require("class-validator");
|
|
16
|
-
const auth_type_enum_1 = require("../enums/auth-type.enum");
|
|
17
|
-
class SignupDto {
|
|
18
|
-
}
|
|
19
|
-
exports.SignupDto = SignupDto;
|
|
20
|
-
__decorate([
|
|
21
|
-
(0, swagger_1.ApiProperty)({
|
|
22
|
-
enum: auth_type_enum_1.AuthStrategy,
|
|
23
|
-
example: auth_type_enum_1.AuthStrategy.LOCAL,
|
|
24
|
-
description: 'Authentication method chosen by the user',
|
|
25
|
-
type: () => auth_type_enum_1.AuthStrategy,
|
|
26
|
-
}),
|
|
27
|
-
(0, class_validator_1.IsEnum)(auth_type_enum_1.AuthStrategy),
|
|
28
|
-
__metadata("design:type", String)
|
|
29
|
-
], SignupDto.prototype, "method", void 0);
|
|
30
|
-
__decorate([
|
|
31
|
-
(0, swagger_1.ApiProperty)({
|
|
32
|
-
enum: auth_type_enum_1.OAuthProviderType,
|
|
33
|
-
example: auth_type_enum_1.OAuthProviderType.GOOGLE,
|
|
34
|
-
description: 'OAuth provider (required if method is OAUTH)',
|
|
35
|
-
required: false,
|
|
36
|
-
}),
|
|
37
|
-
(0, class_validator_1.IsEnum)(auth_type_enum_1.OAuthProviderType),
|
|
38
|
-
(0, class_validator_1.IsOptional)(),
|
|
39
|
-
__metadata("design:type", String)
|
|
40
|
-
], SignupDto.prototype, "provider", void 0);
|
|
41
|
-
__decorate([
|
|
42
|
-
(0, swagger_1.ApiProperty)({ example: '+2347035742844', required: false }),
|
|
43
|
-
(0, class_validator_1.IsPhoneNumber)('NG'),
|
|
44
|
-
(0, class_validator_1.IsOptional)(),
|
|
45
|
-
__metadata("design:type", String)
|
|
46
|
-
], SignupDto.prototype, "phone", void 0);
|
|
47
|
-
__decorate([
|
|
48
|
-
(0, swagger_1.ApiProperty)({ example: 'john_doe', required: false }),
|
|
49
|
-
(0, class_validator_1.IsOptional)(),
|
|
50
|
-
(0, class_validator_1.IsString)(),
|
|
51
|
-
__metadata("design:type", String)
|
|
52
|
-
], SignupDto.prototype, "username", void 0);
|
|
53
|
-
__decorate([
|
|
54
|
-
(0, swagger_1.ApiProperty)({ example: 'john@example.com', required: false }),
|
|
55
|
-
(0, class_validator_1.IsOptional)(),
|
|
56
|
-
(0, class_validator_1.IsEmail)(),
|
|
57
|
-
__metadata("design:type", String)
|
|
58
|
-
], SignupDto.prototype, "email", void 0);
|
|
59
|
-
__decorate([
|
|
60
|
-
(0, swagger_1.ApiProperty)({ example: 'securePassword123', required: false }),
|
|
61
|
-
(0, class_validator_1.IsOptional)(),
|
|
62
|
-
(0, class_validator_1.MinLength)(6),
|
|
63
|
-
__metadata("design:type", String)
|
|
64
|
-
], SignupDto.prototype, "password", void 0);
|
|
65
|
-
__decorate([
|
|
66
|
-
(0, class_validator_1.IsOptional)(),
|
|
67
|
-
(0, class_validator_1.IsString)(),
|
|
68
|
-
__metadata("design:type", String)
|
|
69
|
-
], SignupDto.prototype, "token", void 0);
|
|
70
|
-
//# sourceMappingURL=signup.dto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signup.dto.js","sourceRoot":"","sources":["../../../src/auth/dto/signup.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAAsD;AACtD,6CAA8C;AAC9C,qDAOyB;AACzB,4DAA0E;AAE1E,MAAa,SAAS;CA+CrB;AA/CD,8BA+CC;AAvCC;IAPC,IAAA,qBAAW,EAAC;QACX,IAAI,EAAE,6BAAY;QAClB,OAAO,EAAE,6BAAY,CAAC,KAAK;QAC3B,WAAW,EAAE,0CAA0C;QACvD,IAAI,EAAE,GAAG,EAAE,CAAC,6BAAY;KACzB,CAAC;IACD,IAAA,wBAAM,EAAC,6BAAY,CAAC;;yCACA;AAUrB;IARC,IAAA,qBAAW,EAAC;QACX,IAAI,EAAE,kCAAiB;QACvB,OAAO,EAAE,kCAAiB,CAAC,MAAM;QACjC,WAAW,EAAE,8CAA8C;QAC3D,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,IAAA,wBAAM,EAAC,kCAAiB,CAAC;IACzB,IAAA,4BAAU,GAAE;;2CACgB;AAM7B;IAHC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC3D,IAAA,+BAAa,EAAC,IAAI,CAAC;IACnB,IAAA,4BAAU,GAAE;;wCACE;AAKf;IAHC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACrD,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;2CACO;AAKlB;IAHC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC7D,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;;wCACK;AAKf;IAHC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC9D,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,EAAC,CAAC,CAAC;;2CACK;AAOlB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;wCACI"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ResendVerificationDto = exports.VerifyDto = void 0;
|
|
13
|
-
const class_validator_1 = require("class-validator");
|
|
14
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
-
class VerifyDto {
|
|
16
|
-
}
|
|
17
|
-
exports.VerifyDto = VerifyDto;
|
|
18
|
-
__decorate([
|
|
19
|
-
(0, swagger_1.ApiProperty)({
|
|
20
|
-
description: 'The unique identity ID (UID) being verified',
|
|
21
|
-
example: 'uuid-string',
|
|
22
|
-
}),
|
|
23
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
24
|
-
(0, class_validator_1.IsUUID)(),
|
|
25
|
-
__metadata("design:type", String)
|
|
26
|
-
], VerifyDto.prototype, "uid", void 0);
|
|
27
|
-
__decorate([
|
|
28
|
-
(0, swagger_1.ApiProperty)({
|
|
29
|
-
description: 'The verification code sent via email or phone',
|
|
30
|
-
example: '123456',
|
|
31
|
-
}),
|
|
32
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
33
|
-
(0, class_validator_1.IsString)(),
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], VerifyDto.prototype, "code", void 0);
|
|
36
|
-
class ResendVerificationDto {
|
|
37
|
-
}
|
|
38
|
-
exports.ResendVerificationDto = ResendVerificationDto;
|
|
39
|
-
__decorate([
|
|
40
|
-
(0, swagger_1.ApiProperty)({
|
|
41
|
-
description: 'The unique identity ID (UID) to resend the code for',
|
|
42
|
-
example: 'uuid-string',
|
|
43
|
-
}),
|
|
44
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
45
|
-
(0, class_validator_1.IsUUID)(),
|
|
46
|
-
__metadata("design:type", String)
|
|
47
|
-
], ResendVerificationDto.prototype, "uid", void 0);
|
|
48
|
-
//# sourceMappingURL=verify.dto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify.dto.js","sourceRoot":"","sources":["../../../src/auth/dto/verify.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA+D;AAC/D,6CAA8C;AAE9C,MAAa,SAAS;CAgBrB;AAhBD,8BAgBC;AATG;IANC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,6CAA6C;QAC1D,OAAO,EAAE,aAAa;KACzB,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;;sCACG;AAQZ;IANC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,+CAA+C;QAC5D,OAAO,EAAE,QAAQ;KACpB,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;uCACE;AAGjB,MAAa,qBAAqB;CAQjC;AARD,sDAQC;AADG;IANC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,qDAAqD;QAClE,OAAO,EAAE,aAAa;KACzB,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;;kDACG"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Auth } from './auth.entity';
|
|
2
|
-
import { BaseEntity } from './base.entity';
|
|
3
|
-
export declare enum IdentifierType {
|
|
4
|
-
EMAIL = "EMAIL",
|
|
5
|
-
PHONE = "PHONE",
|
|
6
|
-
USERNAME = "USERNAME"
|
|
7
|
-
}
|
|
8
|
-
export declare enum IdentifierSource {
|
|
9
|
-
APPLE = "APPLE",
|
|
10
|
-
FACEBOOK = "FACEBOOK",
|
|
11
|
-
GOOGLE = "GOOGLE",
|
|
12
|
-
LOCAL = "LOCAL"
|
|
13
|
-
}
|
|
14
|
-
export declare class AuthIdentifier extends BaseEntity {
|
|
15
|
-
auth: Auth;
|
|
16
|
-
type: IdentifierType;
|
|
17
|
-
value: string;
|
|
18
|
-
isVerified: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Who issued this identifier
|
|
21
|
-
*/
|
|
22
|
-
source: IdentifierSource;
|
|
23
|
-
/**
|
|
24
|
-
* Optional: how it was verified
|
|
25
|
-
*/
|
|
26
|
-
verifiedBy?: 'OTP' | 'PROVIDER' | 'ADMIN';
|
|
27
|
-
toMap(): {
|
|
28
|
-
id: string;
|
|
29
|
-
type: IdentifierType;
|
|
30
|
-
value: string;
|
|
31
|
-
isVerified: boolean;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.AuthIdentifier = exports.IdentifierSource = exports.IdentifierType = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const auth_entity_1 = require("./auth.entity");
|
|
15
|
-
const base_entity_1 = require("./base.entity");
|
|
16
|
-
var IdentifierType;
|
|
17
|
-
(function (IdentifierType) {
|
|
18
|
-
IdentifierType["EMAIL"] = "EMAIL";
|
|
19
|
-
IdentifierType["PHONE"] = "PHONE";
|
|
20
|
-
IdentifierType["USERNAME"] = "USERNAME";
|
|
21
|
-
})(IdentifierType || (exports.IdentifierType = IdentifierType = {}));
|
|
22
|
-
var IdentifierSource;
|
|
23
|
-
(function (IdentifierSource) {
|
|
24
|
-
IdentifierSource["APPLE"] = "APPLE";
|
|
25
|
-
IdentifierSource["FACEBOOK"] = "FACEBOOK";
|
|
26
|
-
IdentifierSource["GOOGLE"] = "GOOGLE";
|
|
27
|
-
IdentifierSource["LOCAL"] = "LOCAL";
|
|
28
|
-
})(IdentifierSource || (exports.IdentifierSource = IdentifierSource = {}));
|
|
29
|
-
let AuthIdentifier = class AuthIdentifier extends base_entity_1.BaseEntity {
|
|
30
|
-
toMap() {
|
|
31
|
-
return {
|
|
32
|
-
id: this.id,
|
|
33
|
-
type: this.type,
|
|
34
|
-
value: this.value,
|
|
35
|
-
isVerified: this.isVerified,
|
|
36
|
-
// auth: this.auth.toMap(),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
exports.AuthIdentifier = AuthIdentifier;
|
|
41
|
-
__decorate([
|
|
42
|
-
(0, typeorm_1.ManyToOne)(() => auth_entity_1.Auth, (auth) => auth.identifiers, { onDelete: 'CASCADE' }),
|
|
43
|
-
__metadata("design:type", auth_entity_1.Auth)
|
|
44
|
-
], AuthIdentifier.prototype, "auth", void 0);
|
|
45
|
-
__decorate([
|
|
46
|
-
(0, typeorm_1.Column)({ type: 'enum', enum: IdentifierType }),
|
|
47
|
-
__metadata("design:type", String)
|
|
48
|
-
], AuthIdentifier.prototype, "type", void 0);
|
|
49
|
-
__decorate([
|
|
50
|
-
(0, typeorm_1.Index)({ unique: true }),
|
|
51
|
-
(0, typeorm_1.Column)(),
|
|
52
|
-
__metadata("design:type", String)
|
|
53
|
-
], AuthIdentifier.prototype, "value", void 0);
|
|
54
|
-
__decorate([
|
|
55
|
-
(0, typeorm_1.Column)({ default: false }),
|
|
56
|
-
__metadata("design:type", Boolean)
|
|
57
|
-
], AuthIdentifier.prototype, "isVerified", void 0);
|
|
58
|
-
__decorate([
|
|
59
|
-
(0, typeorm_1.Column)({
|
|
60
|
-
type: 'enum',
|
|
61
|
-
enum: IdentifierSource,
|
|
62
|
-
default: IdentifierSource.LOCAL,
|
|
63
|
-
}),
|
|
64
|
-
__metadata("design:type", String)
|
|
65
|
-
], AuthIdentifier.prototype, "source", void 0);
|
|
66
|
-
__decorate([
|
|
67
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
68
|
-
__metadata("design:type", String)
|
|
69
|
-
], AuthIdentifier.prototype, "verifiedBy", void 0);
|
|
70
|
-
exports.AuthIdentifier = AuthIdentifier = __decorate([
|
|
71
|
-
(0, typeorm_1.Entity)('auth_identifiers')
|
|
72
|
-
], AuthIdentifier);
|
|
73
|
-
//# sourceMappingURL=auth-identify.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-identify.entity.js","sourceRoot":"","sources":["../../../src/auth/entities/auth-identify.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAKiB;AACjB,+CAAqC;AACrC,+CAA2C;AAG3C,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,iCAAe,CAAA;IACf,uCAAqB,CAAA;AACvB,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AACD,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,mCAA0B,CAAA;IAC1B,yCAAgC,CAAA;IAChC,qCAA4B,CAAA;IAC5B,mCAA0B,CAAA;AAC5B,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAGM,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,wBAAU;IAiC5C,KAAK;QACH,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,2BAA2B;SAC5B,CAAC;IACJ,CAAC;CACF,CAAA;AA1CY,wCAAc;AAGzB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;8BACrE,kBAAI;4CAAC;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;;4CAC1B;AAMrB;IAFC,IAAA,eAAK,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvB,IAAA,gBAAM,GAAE;;6CACK;AAGd;IADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;kDACP;AAUpB;IALC,IAAA,gBAAM,EAAC;QACN,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,gBAAgB,CAAC,KAAK;KAChC,CAAC;;8CACuB;AAMzB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACe;yBA/B/B,cAAc;IAD1B,IAAA,gBAAM,EAAC,kBAAkB,CAAC;GACd,cAAc,CA0C1B"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from './base.entity';
|
|
2
|
-
import { AuthIdentifier } from './auth-identify.entity';
|
|
3
|
-
import { OAuthProvider } from './oauth-provider.entity';
|
|
4
|
-
import { AuthStrategy } from '../enums/auth-type.enum';
|
|
5
|
-
export declare class Auth extends BaseEntity {
|
|
6
|
-
uid: string;
|
|
7
|
-
strategy: AuthStrategy;
|
|
8
|
-
identifiers: AuthIdentifier[];
|
|
9
|
-
secretHash?: string;
|
|
10
|
-
isPrimary: boolean;
|
|
11
|
-
isVerified: boolean;
|
|
12
|
-
isActive: boolean;
|
|
13
|
-
meta?: Record<string, any>;
|
|
14
|
-
lastUsedAt?: Date;
|
|
15
|
-
oauthProviders?: OAuthProvider[];
|
|
16
|
-
toMap(): {
|
|
17
|
-
id: string;
|
|
18
|
-
strategy: AuthStrategy;
|
|
19
|
-
isActive: boolean;
|
|
20
|
-
isVerified: boolean;
|
|
21
|
-
isPrimary: boolean;
|
|
22
|
-
meta: Record<string, any>;
|
|
23
|
-
lastUsedAt: Date;
|
|
24
|
-
identifiers: {
|
|
25
|
-
id: string;
|
|
26
|
-
type: import("./auth-identify.entity").IdentifierType;
|
|
27
|
-
value: string;
|
|
28
|
-
isVerified: boolean;
|
|
29
|
-
}[];
|
|
30
|
-
oauthProviders: {
|
|
31
|
-
id: string;
|
|
32
|
-
provider: import("../enums/auth-type.enum").OAuthProviderType;
|
|
33
|
-
providerUserId: string;
|
|
34
|
-
accessToken: string;
|
|
35
|
-
refreshToken: string;
|
|
36
|
-
expiresAt: Date;
|
|
37
|
-
createdAt: Date;
|
|
38
|
-
updatedAt: Date;
|
|
39
|
-
deletedAt: Date;
|
|
40
|
-
}[];
|
|
41
|
-
createdAt: Date;
|
|
42
|
-
updatedAt: Date;
|
|
43
|
-
deletedAt: Date;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Auth = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
-
const base_entity_1 = require("./base.entity");
|
|
16
|
-
const auth_identify_entity_1 = require("./auth-identify.entity");
|
|
17
|
-
const oauth_provider_entity_1 = require("./oauth-provider.entity");
|
|
18
|
-
const auth_type_enum_1 = require("../enums/auth-type.enum");
|
|
19
|
-
let Auth = class Auth extends base_entity_1.BaseEntity {
|
|
20
|
-
toMap() {
|
|
21
|
-
return {
|
|
22
|
-
id: this.id,
|
|
23
|
-
strategy: this.strategy,
|
|
24
|
-
isActive: this.isActive,
|
|
25
|
-
isVerified: this.isVerified,
|
|
26
|
-
isPrimary: this.isPrimary,
|
|
27
|
-
meta: this.meta,
|
|
28
|
-
lastUsedAt: this.lastUsedAt,
|
|
29
|
-
// user: this.user.toMap(),
|
|
30
|
-
identifiers: this.identifiers?.map((id) => id?.toMap()),
|
|
31
|
-
oauthProviders: this.oauthProviders?.map((provider) => provider?.toMap()),
|
|
32
|
-
createdAt: this.createdAt,
|
|
33
|
-
updatedAt: this.updatedAt,
|
|
34
|
-
deletedAt: this.deletedAt,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
exports.Auth = Auth;
|
|
39
|
-
__decorate([
|
|
40
|
-
(0, swagger_1.ApiProperty)({
|
|
41
|
-
description: 'Unique identity ID (UID) of this account. Multiple auth methods can share the same UID.',
|
|
42
|
-
type: 'string',
|
|
43
|
-
example: 'uuid-string',
|
|
44
|
-
}),
|
|
45
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
46
|
-
(0, typeorm_1.Index)(),
|
|
47
|
-
__metadata("design:type", String)
|
|
48
|
-
], Auth.prototype, "uid", void 0);
|
|
49
|
-
__decorate([
|
|
50
|
-
(0, typeorm_1.Column)({ type: 'enum', enum: auth_type_enum_1.AuthStrategy }),
|
|
51
|
-
__metadata("design:type", String)
|
|
52
|
-
], Auth.prototype, "strategy", void 0);
|
|
53
|
-
__decorate([
|
|
54
|
-
(0, typeorm_1.OneToMany)(() => auth_identify_entity_1.AuthIdentifier, (identifier) => identifier.auth, {
|
|
55
|
-
cascade: true,
|
|
56
|
-
}),
|
|
57
|
-
__metadata("design:type", Array)
|
|
58
|
-
], Auth.prototype, "identifiers", void 0);
|
|
59
|
-
__decorate([
|
|
60
|
-
(0, swagger_1.ApiProperty)({
|
|
61
|
-
example: '$2b$10$hashedpassword...',
|
|
62
|
-
description: 'Hashed secret (password, TOTP secret). Null for OAuth',
|
|
63
|
-
nullable: true,
|
|
64
|
-
}),
|
|
65
|
-
(0, typeorm_1.Column)({ nullable: true, select: false }),
|
|
66
|
-
__metadata("design:type", String)
|
|
67
|
-
], Auth.prototype, "secretHash", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
(0, swagger_1.ApiProperty)({
|
|
70
|
-
example: true,
|
|
71
|
-
description: 'Primary login method for the user',
|
|
72
|
-
}),
|
|
73
|
-
(0, typeorm_1.Column)({ default: false }),
|
|
74
|
-
__metadata("design:type", Boolean)
|
|
75
|
-
], Auth.prototype, "isPrimary", void 0);
|
|
76
|
-
__decorate([
|
|
77
|
-
(0, swagger_1.ApiProperty)({
|
|
78
|
-
example: true,
|
|
79
|
-
description: 'Whether the identifier is verified',
|
|
80
|
-
}),
|
|
81
|
-
(0, typeorm_1.Column)({ default: false }),
|
|
82
|
-
__metadata("design:type", Boolean)
|
|
83
|
-
], Auth.prototype, "isVerified", void 0);
|
|
84
|
-
__decorate([
|
|
85
|
-
(0, swagger_1.ApiProperty)({
|
|
86
|
-
example: true,
|
|
87
|
-
description: 'Whether this auth method is enabled',
|
|
88
|
-
}),
|
|
89
|
-
(0, typeorm_1.Column)({ default: true }),
|
|
90
|
-
__metadata("design:type", Boolean)
|
|
91
|
-
], Auth.prototype, "isActive", void 0);
|
|
92
|
-
__decorate([
|
|
93
|
-
(0, swagger_1.ApiProperty)({
|
|
94
|
-
example: { device: 'iPhone', ip: '192.168.1.1' },
|
|
95
|
-
description: 'Additional metadata (JSON)',
|
|
96
|
-
}),
|
|
97
|
-
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
98
|
-
__metadata("design:type", Object)
|
|
99
|
-
], Auth.prototype, "meta", void 0);
|
|
100
|
-
__decorate([
|
|
101
|
-
(0, swagger_1.ApiProperty)({
|
|
102
|
-
example: '2025-09-30T12:00:00Z',
|
|
103
|
-
description: 'Last successful usage timestamp',
|
|
104
|
-
}),
|
|
105
|
-
(0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
|
|
106
|
-
__metadata("design:type", Date)
|
|
107
|
-
], Auth.prototype, "lastUsedAt", void 0);
|
|
108
|
-
__decorate([
|
|
109
|
-
(0, swagger_1.ApiProperty)({
|
|
110
|
-
type: () => oauth_provider_entity_1.OAuthProvider,
|
|
111
|
-
description: 'OAuth provider details (only for OAUTH method)',
|
|
112
|
-
required: false,
|
|
113
|
-
}),
|
|
114
|
-
(0, typeorm_1.OneToMany)(() => oauth_provider_entity_1.OAuthProvider, (provider) => provider.auth, {
|
|
115
|
-
cascade: true,
|
|
116
|
-
nullable: true,
|
|
117
|
-
}),
|
|
118
|
-
__metadata("design:type", Array)
|
|
119
|
-
], Auth.prototype, "oauthProviders", void 0);
|
|
120
|
-
exports.Auth = Auth = __decorate([
|
|
121
|
-
(0, typeorm_1.Entity)('auth'),
|
|
122
|
-
(0, typeorm_1.Index)('IDX_user_primary_auth', ['uid'], {
|
|
123
|
-
unique: true,
|
|
124
|
-
where: `"isPrimary" = true`,
|
|
125
|
-
}),
|
|
126
|
-
(0, typeorm_1.Index)(['strategy']),
|
|
127
|
-
(0, typeorm_1.Index)(['isActive'])
|
|
128
|
-
], Auth);
|
|
129
|
-
//# sourceMappingURL=auth.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.entity.js","sourceRoot":"","sources":["../../../src/auth/entities/auth.entity.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.BaseEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
-
class BaseEntity {
|
|
16
|
-
}
|
|
17
|
-
exports.BaseEntity = BaseEntity;
|
|
18
|
-
__decorate([
|
|
19
|
-
(0, swagger_1.ApiProperty)({
|
|
20
|
-
example: 'uuid-string',
|
|
21
|
-
description: 'Unique identifier',
|
|
22
|
-
}),
|
|
23
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
24
|
-
__metadata("design:type", String)
|
|
25
|
-
], BaseEntity.prototype, "id", void 0);
|
|
26
|
-
__decorate([
|
|
27
|
-
(0, swagger_1.ApiProperty)({ description: 'Creation date' }),
|
|
28
|
-
(0, typeorm_1.CreateDateColumn)({ type: 'timestamp' }),
|
|
29
|
-
__metadata("design:type", Date)
|
|
30
|
-
], BaseEntity.prototype, "createdAt", void 0);
|
|
31
|
-
__decorate([
|
|
32
|
-
(0, swagger_1.ApiProperty)({ description: 'Last update date' }),
|
|
33
|
-
(0, typeorm_1.UpdateDateColumn)({ type: 'timestamp' }),
|
|
34
|
-
__metadata("design:type", Date)
|
|
35
|
-
], BaseEntity.prototype, "updatedAt", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
(0, swagger_1.ApiProperty)({ description: 'Deletion date (soft delete)' }),
|
|
38
|
-
(0, typeorm_1.DeleteDateColumn)({ type: 'timestamp', nullable: true }),
|
|
39
|
-
__metadata("design:type", Date)
|
|
40
|
-
], BaseEntity.prototype, "deletedAt", void 0);
|
|
41
|
-
//# sourceMappingURL=base.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.entity.js","sourceRoot":"","sources":["../../../src/auth/entities/base.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAKiB;AACjB,6CAA8C;AAE9C,MAAsB,UAAU;CAmB/B;AAnBD,gCAmBC;AAbG;IALC,IAAA,qBAAW,EAAC;QACT,OAAO,EAAE,aAAa;QACtB,WAAW,EAAE,mBAAmB;KACnC,CAAC;IACD,IAAA,gCAAsB,EAAC,MAAM,CAAC;;sCACpB;AAIX;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC;IAC7C,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;8BAC7B,IAAI;6CAAC;AAIhB;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAChD,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;8BAC7B,IAAI;6CAAC;AAIhB;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;IAC3D,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BAC7C,IAAI;6CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Auth } from "./auth.entity";
|
|
2
|
-
import { AuthIdentifier } from "./auth-identify.entity";
|
|
3
|
-
import { OAuthProvider } from "./oauth-provider.entity";
|
|
4
|
-
import { OtpToken } from "./otp-token.entity";
|
|
5
|
-
import { MfaMethod } from "./mfa-method.entity";
|
|
6
|
-
import { Session } from "./session.entity";
|
|
7
|
-
export declare const AuthEntities: (typeof Auth | typeof OAuthProvider | typeof AuthIdentifier | typeof OtpToken | typeof MfaMethod | typeof Session)[];
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthEntities = void 0;
|
|
4
|
-
const auth_entity_1 = require("./auth.entity");
|
|
5
|
-
const auth_identify_entity_1 = require("./auth-identify.entity");
|
|
6
|
-
const oauth_provider_entity_1 = require("./oauth-provider.entity");
|
|
7
|
-
const otp_token_entity_1 = require("./otp-token.entity");
|
|
8
|
-
const mfa_method_entity_1 = require("./mfa-method.entity");
|
|
9
|
-
const session_entity_1 = require("./session.entity");
|
|
10
|
-
exports.AuthEntities = [
|
|
11
|
-
auth_entity_1.Auth,
|
|
12
|
-
auth_identify_entity_1.AuthIdentifier,
|
|
13
|
-
oauth_provider_entity_1.OAuthProvider,
|
|
14
|
-
otp_token_entity_1.OtpToken,
|
|
15
|
-
session_entity_1.Session,
|
|
16
|
-
mfa_method_entity_1.MfaMethod
|
|
17
|
-
];
|
|
18
|
-
//# sourceMappingURL=entities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../src/auth/entities/entities.ts"],"names":[],"mappings":";;;AAAA,+CAAqC;AACrC,iEAAwD;AACxD,mEAAwD;AACxD,yDAA8C;AAE9C,2DAAgD;AAChD,qDAA2C;AAE9B,QAAA,YAAY,GAAG;IACxB,kBAAI;IACJ,qCAAc;IACd,qCAAa;IACb,2BAAQ;IACR,wBAAO;IACP,6BAAS;CACZ,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare enum MfaType {
|
|
2
|
-
TOTP = "TOTP",// Authenticator App
|
|
3
|
-
SMS = "SMS",
|
|
4
|
-
EMAIL = "EMAIL"
|
|
5
|
-
}
|
|
6
|
-
export declare class MfaMethod {
|
|
7
|
-
id: string;
|
|
8
|
-
uid: string;
|
|
9
|
-
type: MfaType;
|
|
10
|
-
secret: string;
|
|
11
|
-
isEnabled: boolean;
|
|
12
|
-
isDefault: boolean;
|
|
13
|
-
lastUsedAt: Date;
|
|
14
|
-
createdAt: Date;
|
|
15
|
-
toMap(): {
|
|
16
|
-
id: string;
|
|
17
|
-
type: MfaType;
|
|
18
|
-
isEnabled: boolean;
|
|
19
|
-
isDefault: boolean;
|
|
20
|
-
lastUsedAt: Date;
|
|
21
|
-
createdAt: Date;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.MfaMethod = exports.MfaType = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
var MfaType;
|
|
15
|
-
(function (MfaType) {
|
|
16
|
-
MfaType["TOTP"] = "TOTP";
|
|
17
|
-
MfaType["SMS"] = "SMS";
|
|
18
|
-
MfaType["EMAIL"] = "EMAIL";
|
|
19
|
-
})(MfaType || (exports.MfaType = MfaType = {}));
|
|
20
|
-
let MfaMethod = class MfaMethod {
|
|
21
|
-
toMap() {
|
|
22
|
-
return {
|
|
23
|
-
id: this.id,
|
|
24
|
-
type: this.type,
|
|
25
|
-
isEnabled: this.isEnabled,
|
|
26
|
-
isDefault: this.isDefault,
|
|
27
|
-
lastUsedAt: this.lastUsedAt,
|
|
28
|
-
createdAt: this.createdAt,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
exports.MfaMethod = MfaMethod;
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
35
|
-
__metadata("design:type", String)
|
|
36
|
-
], MfaMethod.prototype, "id", void 0);
|
|
37
|
-
__decorate([
|
|
38
|
-
(0, typeorm_1.Column)(),
|
|
39
|
-
(0, typeorm_1.Index)(),
|
|
40
|
-
__metadata("design:type", String)
|
|
41
|
-
], MfaMethod.prototype, "uid", void 0);
|
|
42
|
-
__decorate([
|
|
43
|
-
(0, typeorm_1.Column)({ type: 'enum', enum: MfaType }),
|
|
44
|
-
__metadata("design:type", String)
|
|
45
|
-
], MfaMethod.prototype, "type", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
(0, typeorm_1.Column)({ select: false }),
|
|
48
|
-
__metadata("design:type", String)
|
|
49
|
-
], MfaMethod.prototype, "secret", void 0);
|
|
50
|
-
__decorate([
|
|
51
|
-
(0, typeorm_1.Column)({ default: false }),
|
|
52
|
-
__metadata("design:type", Boolean)
|
|
53
|
-
], MfaMethod.prototype, "isEnabled", void 0);
|
|
54
|
-
__decorate([
|
|
55
|
-
(0, typeorm_1.Column)({ default: false }),
|
|
56
|
-
__metadata("design:type", Boolean)
|
|
57
|
-
], MfaMethod.prototype, "isDefault", void 0);
|
|
58
|
-
__decorate([
|
|
59
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
60
|
-
__metadata("design:type", Date)
|
|
61
|
-
], MfaMethod.prototype, "lastUsedAt", void 0);
|
|
62
|
-
__decorate([
|
|
63
|
-
(0, typeorm_1.CreateDateColumn)(),
|
|
64
|
-
__metadata("design:type", Date)
|
|
65
|
-
], MfaMethod.prototype, "createdAt", void 0);
|
|
66
|
-
exports.MfaMethod = MfaMethod = __decorate([
|
|
67
|
-
(0, typeorm_1.Entity)('auth_mfa_methods')
|
|
68
|
-
], MfaMethod);
|
|
69
|
-
//# sourceMappingURL=mfa-method.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mfa-method.entity.js","sourceRoot":"","sources":["../../../src/auth/entities/mfa-method.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAMiB;AAEjB,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,wBAAa,CAAA;IACb,sBAAW,CAAA;IACX,0BAAe,CAAA;AACjB,CAAC,EAJW,OAAO,uBAAP,OAAO,QAIlB;AAGM,IAAM,SAAS,GAAf,MAAM,SAAS;IA4BpB,KAAK;QACH,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;IACJ,CAAC;CACF,CAAA;AAtCY,8BAAS;AAEpB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;qCACpB;AAIX;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,GAAE;;sCACI;AAGZ;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;uCAC1B;AAKd;IADC,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;;yCACX;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;4CACR;AAGnB;IADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;4CACR;AAGnB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACf,IAAI;6CAAC;AAGjB;IADC,IAAA,0BAAgB,GAAE;8BACR,IAAI;4CAAC;oBA1BL,SAAS;IADrB,IAAA,gBAAM,EAAC,kBAAkB,CAAC;GACd,SAAS,CAsCrB"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from './base.entity';
|
|
2
|
-
import { Auth } from './auth.entity';
|
|
3
|
-
import { OAuthProviderType } from '../enums/auth-type.enum';
|
|
4
|
-
export declare class OAuthProvider extends BaseEntity {
|
|
5
|
-
auth: Auth;
|
|
6
|
-
provider: OAuthProviderType;
|
|
7
|
-
providerUserId: string;
|
|
8
|
-
accessToken?: string;
|
|
9
|
-
refreshToken?: string;
|
|
10
|
-
expiresAt?: Date;
|
|
11
|
-
/**
|
|
12
|
-
* Display name from provider (e.g. "John Doe")
|
|
13
|
-
*/
|
|
14
|
-
displayName?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Avatar/profile picture URL
|
|
17
|
-
*/
|
|
18
|
-
avatarUrl?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Whether provider verified the email
|
|
21
|
-
*/
|
|
22
|
-
emailVerified?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Raw provider response (for debugging/future-proofing)
|
|
25
|
-
*/
|
|
26
|
-
rawProfile?: Record<string, any>;
|
|
27
|
-
toMap(): {
|
|
28
|
-
id: string;
|
|
29
|
-
provider: OAuthProviderType;
|
|
30
|
-
providerUserId: string;
|
|
31
|
-
accessToken: string;
|
|
32
|
-
refreshToken: string;
|
|
33
|
-
expiresAt: Date;
|
|
34
|
-
createdAt: Date;
|
|
35
|
-
updatedAt: Date;
|
|
36
|
-
deletedAt: Date;
|
|
37
|
-
};
|
|
38
|
-
}
|