@vynelix/nestjs-multi-auth 0.0.2
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/README.md +760 -0
- package/bin/cli.js +152 -0
- package/dist/auth/auth-type.enum.d.ts +22 -0
- package/dist/auth/auth-type.enum.js +32 -0
- package/dist/auth/auth-type.enum.js.map +1 -0
- package/dist/auth/auth.controller.d.ts +70 -0
- package/dist/auth/auth.controller.js +434 -0
- package/dist/auth/auth.controller.js.map +1 -0
- package/dist/auth/auth.module.d.ts +9 -0
- package/dist/auth/auth.module.js +193 -0
- package/dist/auth/auth.module.js.map +1 -0
- package/dist/auth/auth.service.d.ts +180 -0
- package/dist/auth/auth.service.js +695 -0
- package/dist/auth/auth.service.js.map +1 -0
- package/dist/auth/core/auth-mapper.d.ts +6 -0
- package/dist/auth/core/auth-mapper.js +17 -0
- package/dist/auth/core/auth-mapper.js.map +1 -0
- package/dist/auth/core/jwt.strategy.d.ts +13 -0
- package/dist/auth/core/jwt.strategy.js +59 -0
- package/dist/auth/core/jwt.strategy.js.map +1 -0
- package/dist/auth/core/registration.d.ts +3 -0
- package/dist/auth/core/registration.js +60 -0
- package/dist/auth/core/registration.js.map +1 -0
- package/dist/auth/current-user-interface.d.ts +4 -0
- package/dist/auth/current-user-interface.js +4 -0
- package/dist/auth/current-user-interface.js.map +1 -0
- package/dist/auth/current-user.decorator.d.ts +2 -0
- package/dist/auth/current-user.decorator.js +16 -0
- package/dist/auth/current-user.decorator.js.map +1 -0
- package/dist/auth/decorator/current-user.decorator.d.ts +2 -0
- package/dist/auth/decorator/current-user.decorator.js +13 -0
- package/dist/auth/decorator/current-user.decorator.js.map +1 -0
- package/dist/auth/decorator/email-or-phone.decorator.d.ts +2 -0
- package/dist/auth/decorator/email-or-phone.decorator.js +26 -0
- package/dist/auth/decorator/email-or-phone.decorator.js.map +1 -0
- package/dist/auth/decorator/optional.decorator.d.ts +2 -0
- package/dist/auth/decorator/optional.decorator.js +9 -0
- package/dist/auth/decorator/optional.decorator.js.map +1 -0
- package/dist/auth/decorator/public.decorator.d.ts +2 -0
- package/dist/auth/decorator/public.decorator.js +9 -0
- package/dist/auth/decorator/public.decorator.js.map +1 -0
- package/dist/auth/dto/auth-response.dto.d.ts +17 -0
- package/dist/auth/dto/auth-response.dto.js +83 -0
- package/dist/auth/dto/auth-response.dto.js.map +1 -0
- package/dist/auth/dto/identifier-response.dto.d.ts +8 -0
- package/dist/auth/dto/identifier-response.dto.js +46 -0
- package/dist/auth/dto/identifier-response.dto.js.map +1 -0
- package/dist/auth/dto/login.dto.d.ts +11 -0
- package/dist/auth/dto/login.dto.js +68 -0
- package/dist/auth/dto/login.dto.js.map +1 -0
- package/dist/auth/dto/mfa.dto.d.ts +8 -0
- package/dist/auth/dto/mfa.dto.js +51 -0
- package/dist/auth/dto/mfa.dto.js.map +1 -0
- package/dist/auth/dto/oauth-provider-response.dto.d.ts +5 -0
- package/dist/auth/dto/oauth-provider-response.dto.js +30 -0
- package/dist/auth/dto/oauth-provider-response.dto.js.map +1 -0
- package/dist/auth/dto/refresh-token.dto.d.ts +3 -0
- package/dist/auth/dto/refresh-token.dto.js +28 -0
- package/dist/auth/dto/refresh-token.dto.js.map +1 -0
- package/dist/auth/dto/requests/forgot-password.dto.d.ts +5 -0
- package/dist/auth/dto/requests/forgot-password.dto.js +36 -0
- package/dist/auth/dto/requests/forgot-password.dto.js.map +1 -0
- package/dist/auth/dto/requests/login.dto.d.ts +11 -0
- package/dist/auth/dto/requests/login.dto.js +68 -0
- package/dist/auth/dto/requests/login.dto.js.map +1 -0
- package/dist/auth/dto/requests/magic-link.dto.d.ts +6 -0
- package/dist/auth/dto/requests/magic-link.dto.js +33 -0
- package/dist/auth/dto/requests/magic-link.dto.js.map +1 -0
- package/dist/auth/dto/requests/mfa.dto.d.ts +8 -0
- package/dist/auth/dto/requests/mfa.dto.js +51 -0
- package/dist/auth/dto/requests/mfa.dto.js.map +1 -0
- package/dist/auth/dto/requests/refresh-token.dto.d.ts +3 -0
- package/dist/auth/dto/requests/refresh-token.dto.js +29 -0
- package/dist/auth/dto/requests/refresh-token.dto.js.map +1 -0
- package/dist/auth/dto/requests/reset-password.dto.d.ts +5 -0
- package/dist/auth/dto/requests/reset-password.dto.js +36 -0
- package/dist/auth/dto/requests/reset-password.dto.js.map +1 -0
- package/dist/auth/dto/requests/secure-account.dto.d.ts +3 -0
- package/dist/auth/dto/requests/secure-account.dto.js +24 -0
- package/dist/auth/dto/requests/secure-account.dto.js.map +1 -0
- package/dist/auth/dto/requests/signup.dto.d.ts +13 -0
- package/dist/auth/dto/requests/signup.dto.js +70 -0
- package/dist/auth/dto/requests/signup.dto.js.map +1 -0
- package/dist/auth/dto/requests/update-password.dto.d.ts +4 -0
- package/dist/auth/dto/requests/update-password.dto.js +30 -0
- package/dist/auth/dto/requests/update-password.dto.js.map +1 -0
- package/dist/auth/dto/requests/verify.dto.d.ts +7 -0
- package/dist/auth/dto/requests/verify.dto.js +48 -0
- package/dist/auth/dto/requests/verify.dto.js.map +1 -0
- package/dist/auth/dto/responses/auth-response.dto.d.ts +17 -0
- package/dist/auth/dto/responses/auth-response.dto.js +83 -0
- package/dist/auth/dto/responses/auth-response.dto.js.map +1 -0
- package/dist/auth/dto/responses/identifier-response.dto.d.ts +10 -0
- package/dist/auth/dto/responses/identifier-response.dto.js +56 -0
- package/dist/auth/dto/responses/identifier-response.dto.js.map +1 -0
- package/dist/auth/dto/responses/oauth-provider-response.dto.d.ts +10 -0
- package/dist/auth/dto/responses/oauth-provider-response.dto.js +55 -0
- package/dist/auth/dto/responses/oauth-provider-response.dto.js.map +1 -0
- package/dist/auth/dto/signup.dto.d.ts +13 -0
- package/dist/auth/dto/signup.dto.js +70 -0
- package/dist/auth/dto/signup.dto.js.map +1 -0
- package/dist/auth/dto/verify.dto.d.ts +7 -0
- package/dist/auth/dto/verify.dto.js +48 -0
- package/dist/auth/dto/verify.dto.js.map +1 -0
- package/dist/auth/entities/auth-identify.entity.d.ts +33 -0
- package/dist/auth/entities/auth-identify.entity.js +73 -0
- package/dist/auth/entities/auth-identify.entity.js.map +1 -0
- package/dist/auth/entities/auth.entity.d.ts +45 -0
- package/dist/auth/entities/auth.entity.js +129 -0
- package/dist/auth/entities/auth.entity.js.map +1 -0
- package/dist/auth/entities/base.entity.d.ts +6 -0
- package/dist/auth/entities/base.entity.js +41 -0
- package/dist/auth/entities/base.entity.js.map +1 -0
- package/dist/auth/entities/mfa-method.entity.d.ts +23 -0
- package/dist/auth/entities/mfa-method.entity.js +69 -0
- package/dist/auth/entities/mfa-method.entity.js.map +1 -0
- package/dist/auth/entities/oauth-provider.entity.d.ts +38 -0
- package/dist/auth/entities/oauth-provider.entity.js +88 -0
- package/dist/auth/entities/oauth-provider.entity.js.map +1 -0
- package/dist/auth/entities/otp-token.entity.d.ts +22 -0
- package/dist/auth/entities/otp-token.entity.js +61 -0
- package/dist/auth/entities/otp-token.entity.js.map +1 -0
- package/dist/auth/entities/session.entity.d.ts +19 -0
- package/dist/auth/entities/session.entity.js +65 -0
- package/dist/auth/entities/session.entity.js.map +1 -0
- package/dist/auth/enums/auth-type.enum.d.ts +23 -0
- package/dist/auth/enums/auth-type.enum.js +34 -0
- package/dist/auth/enums/auth-type.enum.js.map +1 -0
- package/dist/auth/guards/jwt-auth.guard.d.ts +10 -0
- package/dist/auth/guards/jwt-auth.guard.js +68 -0
- package/dist/auth/guards/jwt-auth.guard.js.map +1 -0
- package/dist/auth/guards/optional-auth.guard.d.ts +8 -0
- package/dist/auth/guards/optional-auth.guard.js +45 -0
- package/dist/auth/guards/optional-auth.guard.js.map +1 -0
- package/dist/auth/guards/ws-jwt-auth.guard.d.ts +0 -0
- package/dist/auth/guards/ws-jwt-auth.guard.js +31 -0
- package/dist/auth/guards/ws-jwt-auth.guard.js.map +1 -0
- package/dist/auth/interfaces/auth-module-async-options.interface.d.ts +7 -0
- package/dist/auth/interfaces/auth-module-async-options.interface.js +3 -0
- package/dist/auth/interfaces/auth-module-async-options.interface.js.map +1 -0
- package/dist/auth/interfaces/auth-module-options.interface.d.ts +132 -0
- package/dist/auth/interfaces/auth-module-options.interface.js +5 -0
- package/dist/auth/interfaces/auth-module-options.interface.js.map +1 -0
- package/dist/auth/interfaces/auth-notification-provider.interface.d.ts +29 -0
- package/dist/auth/interfaces/auth-notification-provider.interface.js +5 -0
- package/dist/auth/interfaces/auth-notification-provider.interface.js.map +1 -0
- package/dist/auth/interfaces/auth-user-service.interface.d.ts +13 -0
- package/dist/auth/interfaces/auth-user-service.interface.js +7 -0
- package/dist/auth/interfaces/auth-user-service.interface.js.map +1 -0
- package/dist/auth/interfaces/current-user-interface.d.ts +4 -0
- package/dist/auth/interfaces/current-user-interface.js +4 -0
- package/dist/auth/interfaces/current-user-interface.js.map +1 -0
- package/dist/auth/interfaces/current-user.decorator.d.ts +2 -0
- package/dist/auth/interfaces/current-user.decorator.js +16 -0
- package/dist/auth/interfaces/current-user.decorator.js.map +1 -0
- package/dist/auth/interfaces/jwt-payload-interface.d.ts +4 -0
- package/dist/auth/interfaces/jwt-payload-interface.js +3 -0
- package/dist/auth/interfaces/jwt-payload-interface.js.map +1 -0
- package/dist/auth/interfaces/oauth-strategy.interface.d.ts +14 -0
- package/dist/auth/interfaces/oauth-strategy.interface.js +3 -0
- package/dist/auth/interfaces/oauth-strategy.interface.js.map +1 -0
- package/dist/auth/jwt-payload-interface.d.ts +4 -0
- package/dist/auth/jwt-payload-interface.js +3 -0
- package/dist/auth/jwt-payload-interface.js.map +1 -0
- package/dist/auth/jwt.strategy.d.ts +13 -0
- package/dist/auth/jwt.strategy.js +60 -0
- package/dist/auth/jwt.strategy.js.map +1 -0
- package/dist/auth/strategies/company.strategy.d.ts +0 -0
- package/dist/auth/strategies/company.strategy.js +1 -0
- package/dist/auth/strategies/company.strategy.js.map +1 -0
- package/dist/auth/strategies/google.strategy.d.ts +7 -0
- package/dist/auth/strategies/google.strategy.js +23 -0
- package/dist/auth/strategies/google.strategy.js.map +1 -0
- package/dist/auth/strategies/local-auth.strategy.d.ts +24 -0
- package/dist/auth/strategies/local-auth.strategy.js +244 -0
- package/dist/auth/strategies/local-auth.strategy.js.map +1 -0
- package/dist/auth/strategies/oauth/apple.strategy.d.ts +27 -0
- package/dist/auth/strategies/oauth/apple.strategy.js +176 -0
- package/dist/auth/strategies/oauth/apple.strategy.js.map +1 -0
- package/dist/auth/strategies/oauth/facebook.strategy.d.ts +24 -0
- package/dist/auth/strategies/oauth/facebook.strategy.js +150 -0
- package/dist/auth/strategies/oauth/facebook.strategy.js.map +1 -0
- package/dist/auth/strategies/oauth/google.strategy.d.ts +25 -0
- package/dist/auth/strategies/oauth/google.strategy.js +225 -0
- package/dist/auth/strategies/oauth/google.strategy.js.map +1 -0
- package/dist/auth/strategies/oauth/oauth-strategy.interface.d.ts +14 -0
- package/dist/auth/strategies/oauth/oauth-strategy.interface.js +3 -0
- package/dist/auth/strategies/oauth/oauth-strategy.interface.js.map +1 -0
- package/dist/auth/strategies/oauth/oauth.strategy.d.ts +25 -0
- package/dist/auth/strategies/oauth/oauth.strategy.js +70 -0
- package/dist/auth/strategies/oauth/oauth.strategy.js.map +1 -0
- package/dist/auth/strategies/otp.strategy.d.ts +7 -0
- package/dist/auth/strategies/otp.strategy.js +23 -0
- package/dist/auth/strategies/otp.strategy.js.map +1 -0
- package/dist/auth/strategies/password.strategy.d.ts +14 -0
- package/dist/auth/strategies/password.strategy.js +130 -0
- package/dist/auth/strategies/password.strategy.js.map +1 -0
- package/dist/auth/utils/duration.util.d.ts +8 -0
- package/dist/auth/utils/duration.util.js +29 -0
- package/dist/auth/utils/duration.util.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/auth-entities.d.ts +7 -0
- package/dist/migrations/auth-entities.js +18 -0
- package/dist/migrations/auth-entities.js.map +1 -0
- package/dist/migrations/auth-schema.initializer.d.ts +9 -0
- package/dist/migrations/auth-schema.initializer.js +36 -0
- package/dist/migrations/auth-schema.initializer.js.map +1 -0
- package/dist/migrations/auth.migration.v1.d.ts +12 -0
- package/dist/migrations/auth.migration.v1.js +157 -0
- package/dist/migrations/auth.migration.v1.js.map +1 -0
- package/dist/migrations/auth.migration.v2.d.ts +8 -0
- package/dist/migrations/auth.migration.v2.js +39 -0
- package/dist/migrations/auth.migration.v2.js.map +1 -0
- package/dist/migrations/auth.migrations.d.ts +2 -0
- package/dist/migrations/auth.migrations.js +8 -0
- package/dist/migrations/auth.migrations.js.map +1 -0
- package/dist/migrations/migration.runner.d.ts +9 -0
- package/dist/migrations/migration.runner.js +67 -0
- package/dist/migrations/migration.runner.js.map +1 -0
- package/dist/migrations/migration.service.d.ts +9 -0
- package/dist/migrations/migration.service.js +71 -0
- package/dist/migrations/migration.service.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +82 -0
package/bin/cli.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { Command } = require('commander');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const program = new Command();
|
|
8
|
+
|
|
9
|
+
program
|
|
10
|
+
.name('nestjs-multi-auth')
|
|
11
|
+
.description('Auth CLI tools')
|
|
12
|
+
.version('1.0.0');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// 🔍 Resolve DataSource path
|
|
16
|
+
function resolveDataSource() {
|
|
17
|
+
const cwd = process.cwd();
|
|
18
|
+
|
|
19
|
+
const possiblePaths = [
|
|
20
|
+
'dist/data-source.js',
|
|
21
|
+
'dist/database/data-source.js',
|
|
22
|
+
'src/data-source.ts',
|
|
23
|
+
'src/database/data-source.ts',
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
for (const p of possiblePaths) {
|
|
27
|
+
const fullPath = path.join(cwd, p);
|
|
28
|
+
if (fs.existsSync(fullPath)) {
|
|
29
|
+
return fullPath;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
throw new Error(
|
|
34
|
+
'[!] Could not find data-source file. Expected one of:\n' +
|
|
35
|
+
possiblePaths.map(p => ` - ${p}`).join('\n')
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
// 🔧 Extract or create DataSource
|
|
41
|
+
function extractDataSource(exported) {
|
|
42
|
+
const { DataSource } = require('typeorm');
|
|
43
|
+
|
|
44
|
+
if (!exported) {
|
|
45
|
+
throw new Error('No exports found in data-source file');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ✅ Already a DataSource instance
|
|
49
|
+
if (exported.AppDataSource instanceof DataSource) {
|
|
50
|
+
return exported.AppDataSource;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (exported.dataSource instanceof DataSource) {
|
|
54
|
+
return exported.dataSource;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (exported.default instanceof DataSource) {
|
|
58
|
+
return exported.default;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ✅ Config object → wrap it
|
|
62
|
+
const config =
|
|
63
|
+
exported.default ||
|
|
64
|
+
exported.databaseConfig ||
|
|
65
|
+
exported;
|
|
66
|
+
|
|
67
|
+
return new DataSource(config);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// 🔧 Load DataSource (TS + JS support)
|
|
72
|
+
async function loadDataSource() {
|
|
73
|
+
const dataSourcePath = resolveDataSource();
|
|
74
|
+
|
|
75
|
+
console.log('[i] Using DataSource at:', dataSourcePath);
|
|
76
|
+
|
|
77
|
+
if (dataSourcePath.endsWith('.ts')) {
|
|
78
|
+
require('ts-node/register');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const exported = require(dataSourcePath);
|
|
82
|
+
|
|
83
|
+
const dataSource = extractDataSource(exported);
|
|
84
|
+
|
|
85
|
+
if (!dataSource.isInitialized) {
|
|
86
|
+
await dataSource.initialize();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return dataSource;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
// 🔁 Shared runner
|
|
94
|
+
async function runWithDataSource(fn) {
|
|
95
|
+
const dataSource = await loadDataSource();
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
await fn(dataSource);
|
|
99
|
+
} finally {
|
|
100
|
+
if (dataSource.isInitialized) {
|
|
101
|
+
await dataSource.destroy();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
// 🚀 MIGRATE COMMAND
|
|
108
|
+
program
|
|
109
|
+
.command('migrate')
|
|
110
|
+
.description('Run auth migrations')
|
|
111
|
+
.action(async () => {
|
|
112
|
+
try {
|
|
113
|
+
const { AuthMigrationService } = require('../dist/migrations/migration.service');
|
|
114
|
+
|
|
115
|
+
await runWithDataSource(async (dataSource) => {
|
|
116
|
+
const service = new AuthMigrationService(dataSource);
|
|
117
|
+
await service.runMigrations();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
console.log('[i] Auth migrations completed');
|
|
121
|
+
process.exit(0);
|
|
122
|
+
} catch (err) {
|
|
123
|
+
console.error('[!] Migration failed:\n', err);
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
// 🔍 DOCTOR COMMAND
|
|
130
|
+
program
|
|
131
|
+
.command('doctor')
|
|
132
|
+
.description('Check auth schema status')
|
|
133
|
+
.action(async () => {
|
|
134
|
+
try {
|
|
135
|
+
const { AuthMigrationService } = require('../dist/migrations/migration.service');
|
|
136
|
+
|
|
137
|
+
await runWithDataSource(async (dataSource) => {
|
|
138
|
+
const service = new AuthMigrationService(dataSource);
|
|
139
|
+
const version = await service.getCurrentVersion();
|
|
140
|
+
|
|
141
|
+
console.log('[i] Current auth schema version:', version);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
process.exit(0);
|
|
145
|
+
} catch (err) {
|
|
146
|
+
console.error('[!] Doctor check failed:\n', err);
|
|
147
|
+
process.exit(1);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
program.parse(process.argv);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum AuthStrategy {
|
|
2
|
+
EMAIL = "EMAIL",
|
|
3
|
+
PHONE = "PHONE",
|
|
4
|
+
USERNAME = "USERNAME",
|
|
5
|
+
GOOGLE = "GOOGLE",
|
|
6
|
+
FACEBOOK = "FACEBOOK",
|
|
7
|
+
APPLE = "APPLE",
|
|
8
|
+
/** @deprecated Use granular types instead */
|
|
9
|
+
LOCAL = "LOCAL",
|
|
10
|
+
/** @deprecated Use granular types instead */
|
|
11
|
+
OAUTH = "OAUTH"
|
|
12
|
+
}
|
|
13
|
+
export declare enum OAuthProviderType {
|
|
14
|
+
GOOGLE = "GOOGLE",
|
|
15
|
+
FACEBOOK = "FACEBOOK",
|
|
16
|
+
APPLE = "APPLE"
|
|
17
|
+
}
|
|
18
|
+
export declare enum AuthTransport {
|
|
19
|
+
COOKIE = "cookie",
|
|
20
|
+
BEARER = "bearer",
|
|
21
|
+
BOTH = "both"
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/auth/enums/auth-types.enum.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AuthTransport = exports.OAuthProviderType = exports.AuthStrategy = void 0;
|
|
5
|
+
var AuthStrategy;
|
|
6
|
+
(function (AuthStrategy) {
|
|
7
|
+
// Local / Password-based
|
|
8
|
+
AuthStrategy["EMAIL"] = "EMAIL";
|
|
9
|
+
AuthStrategy["PHONE"] = "PHONE";
|
|
10
|
+
AuthStrategy["USERNAME"] = "USERNAME";
|
|
11
|
+
// Social / OAuth
|
|
12
|
+
AuthStrategy["GOOGLE"] = "GOOGLE";
|
|
13
|
+
AuthStrategy["FACEBOOK"] = "FACEBOOK";
|
|
14
|
+
AuthStrategy["APPLE"] = "APPLE";
|
|
15
|
+
/** @deprecated Use granular types instead */
|
|
16
|
+
AuthStrategy["LOCAL"] = "LOCAL";
|
|
17
|
+
/** @deprecated Use granular types instead */
|
|
18
|
+
AuthStrategy["OAUTH"] = "OAUTH";
|
|
19
|
+
})(AuthStrategy || (exports.AuthStrategy = AuthStrategy = {}));
|
|
20
|
+
var OAuthProviderType;
|
|
21
|
+
(function (OAuthProviderType) {
|
|
22
|
+
OAuthProviderType["GOOGLE"] = "GOOGLE";
|
|
23
|
+
OAuthProviderType["FACEBOOK"] = "FACEBOOK";
|
|
24
|
+
OAuthProviderType["APPLE"] = "APPLE";
|
|
25
|
+
})(OAuthProviderType || (exports.OAuthProviderType = OAuthProviderType = {}));
|
|
26
|
+
var AuthTransport;
|
|
27
|
+
(function (AuthTransport) {
|
|
28
|
+
AuthTransport["COOKIE"] = "cookie";
|
|
29
|
+
AuthTransport["BEARER"] = "bearer";
|
|
30
|
+
AuthTransport["BOTH"] = "both";
|
|
31
|
+
})(AuthTransport || (exports.AuthTransport = AuthTransport = {}));
|
|
32
|
+
//# sourceMappingURL=auth-type.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-type.enum.js","sourceRoot":"","sources":["../../src/auth/auth-type.enum.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;AAEpC,IAAY,YAeX;AAfD,WAAY,YAAY;IACtB,yBAAyB;IACzB,+BAAe,CAAA;IACf,+BAAe,CAAA;IACf,qCAAqB,CAAA;IAErB,iBAAiB;IACjB,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,+BAAe,CAAA;IAEf,6CAA6C;IAC7C,+BAAe,CAAA;IACf,6CAA6C;IAC7C,+BAAe,CAAA;AACjB,CAAC,EAfW,YAAY,4BAAZ,YAAY,QAevB;AAED,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;IACrB,oCAAe,CAAA;AACjB,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B;AAED,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,kCAAiB,CAAA;IACjB,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { AuthService } from './auth.service';
|
|
2
|
+
import { LoginDto } from './dto/requests/login.dto';
|
|
3
|
+
import { SignupDto } from './dto/requests/signup.dto';
|
|
4
|
+
import { VerifyDto, ResendVerificationDto } from './dto/requests/verify.dto';
|
|
5
|
+
import { EnrollMfaDto, ActivateMfaDto } from './dto/requests/mfa.dto';
|
|
6
|
+
import { RefreshTokenDto } from './dto/requests/refresh-token.dto';
|
|
7
|
+
import { ForgotPasswordDto } from './dto/requests/forgot-password.dto';
|
|
8
|
+
import { ResetPasswordDto } from './dto/requests/reset-password.dto';
|
|
9
|
+
import { UpdatePasswordDto } from './dto/requests/update-password.dto';
|
|
10
|
+
import { MagicLinkRequestDto } from './dto/requests/magic-link.dto';
|
|
11
|
+
import { SecureAccountDto } from './dto/requests/secure-account.dto';
|
|
12
|
+
import { AuthModuleOptions } from './interfaces/auth-module-options.interface';
|
|
13
|
+
import type { Response, Request } from 'express';
|
|
14
|
+
export declare class AuthController {
|
|
15
|
+
private authService;
|
|
16
|
+
private options;
|
|
17
|
+
constructor(authService: AuthService, options: AuthModuleOptions);
|
|
18
|
+
private getTransports;
|
|
19
|
+
private getDynamicPath;
|
|
20
|
+
private setCookies;
|
|
21
|
+
signup(dto: SignupDto, res: Response, req: Request): Promise<any>;
|
|
22
|
+
login(dto: LoginDto, res: Response, req: Request): Promise<any>;
|
|
23
|
+
verify(dto: VerifyDto, res: Response, req: Request): Promise<any>;
|
|
24
|
+
resendVerification(dto: ResendVerificationDto): Promise<{
|
|
25
|
+
message: string;
|
|
26
|
+
}>;
|
|
27
|
+
forgotPassword(dto: ForgotPasswordDto): Promise<{
|
|
28
|
+
message: string;
|
|
29
|
+
}>;
|
|
30
|
+
resetPassword(dto: ResetPasswordDto): Promise<{
|
|
31
|
+
message: string;
|
|
32
|
+
}>;
|
|
33
|
+
updatePassword(req: any, dto: UpdatePasswordDto): Promise<{
|
|
34
|
+
message: string;
|
|
35
|
+
}>;
|
|
36
|
+
secureAccount(uid: string, dto: SecureAccountDto): Promise<{
|
|
37
|
+
message: string;
|
|
38
|
+
}>;
|
|
39
|
+
requestMagicLink(dto: MagicLinkRequestDto): Promise<{
|
|
40
|
+
message: string;
|
|
41
|
+
}>;
|
|
42
|
+
verifyMagicLink(token: string, res: Response, req: Request): Promise<any>;
|
|
43
|
+
link(dto: SignupDto, req: any, res: Response): Promise<any>;
|
|
44
|
+
refresh(req: Request, res: Response, dto: RefreshTokenDto): Promise<{
|
|
45
|
+
message: string;
|
|
46
|
+
tokens: {
|
|
47
|
+
accessToken: string;
|
|
48
|
+
refreshToken: string;
|
|
49
|
+
};
|
|
50
|
+
} | {
|
|
51
|
+
message: string;
|
|
52
|
+
tokens?: undefined;
|
|
53
|
+
}>;
|
|
54
|
+
enrollMfa(req: any, dto: EnrollMfaDto): Promise<{
|
|
55
|
+
secret: string;
|
|
56
|
+
otpauth: string;
|
|
57
|
+
}>;
|
|
58
|
+
activateMfa(req: any, dto: ActivateMfaDto): Promise<{
|
|
59
|
+
message: string;
|
|
60
|
+
}>;
|
|
61
|
+
logout(req: Request, res: Response, dto: RefreshTokenDto): Promise<{
|
|
62
|
+
message: string;
|
|
63
|
+
}>;
|
|
64
|
+
me(req: any): Promise<import("./dto/responses/auth-response.dto").AuthResponseDto>;
|
|
65
|
+
viewAll(req: any): Promise<import("./dto/responses/auth-response.dto").AuthResponseDto[]>;
|
|
66
|
+
deleteAccount(req: any, res: Response): Promise<{
|
|
67
|
+
message: string;
|
|
68
|
+
}>;
|
|
69
|
+
deleteAuthMethod(req: any, authId: string): Promise<void>;
|
|
70
|
+
}
|