@applers/auth-magic-link-nest 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/auth/authentication.middleware.d.ts +16 -0
- package/dist/src/auth/authentication.middleware.d.ts.map +1 -0
- package/dist/src/auth/authentication.middleware.js +137 -0
- package/dist/src/auth/authentication.middleware.js.map +1 -0
- package/dist/src/auth/cookie-token.service.d.ts +23 -0
- package/dist/src/auth/cookie-token.service.d.ts.map +1 -0
- package/dist/src/auth/cookie-token.service.js +94 -0
- package/dist/src/auth/cookie-token.service.js.map +1 -0
- package/dist/src/auth-magic-link.module.d.ts +12 -0
- package/dist/src/auth-magic-link.module.d.ts.map +1 -0
- package/dist/src/auth-magic-link.module.js +114 -0
- package/dist/src/auth-magic-link.module.js.map +1 -0
- package/dist/src/constants.d.ts +6 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +9 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/environment.types.d.ts +39 -0
- package/dist/src/environment.types.d.ts.map +1 -0
- package/dist/src/environment.types.js +7 -0
- package/dist/src/environment.types.js.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +20 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/magic-link/export.types.d.ts +21 -0
- package/dist/src/magic-link/export.types.d.ts.map +1 -0
- package/dist/src/magic-link/export.types.js +3 -0
- package/dist/src/magic-link/export.types.js.map +1 -0
- package/dist/src/magic-link/extract-email-from-magic-link.decorator.d.ts +2 -0
- package/dist/src/magic-link/extract-email-from-magic-link.decorator.d.ts.map +1 -0
- package/dist/src/magic-link/extract-email-from-magic-link.decorator.js +9 -0
- package/dist/src/magic-link/extract-email-from-magic-link.decorator.js.map +1 -0
- package/dist/src/magic-link/login.controller.d.ts +14 -0
- package/dist/src/magic-link/login.controller.d.ts.map +1 -0
- package/dist/src/magic-link/login.controller.js +74 -0
- package/dist/src/magic-link/login.controller.js.map +1 -0
- package/dist/src/magic-link/magic-link.strategy.d.ts +10 -0
- package/dist/src/magic-link/magic-link.strategy.d.ts.map +1 -0
- package/dist/src/magic-link/magic-link.strategy.js +59 -0
- package/dist/src/magic-link/magic-link.strategy.js.map +1 -0
- package/dist/src/magic-link/request-magic-link.guard.d.ts +6 -0
- package/dist/src/magic-link/request-magic-link.guard.d.ts.map +1 -0
- package/dist/src/magic-link/request-magic-link.guard.js +29 -0
- package/dist/src/magic-link/request-magic-link.guard.js.map +1 -0
- package/dist/src/magic-link/types.d.ts +10 -0
- package/dist/src/magic-link/types.d.ts.map +1 -0
- package/dist/src/magic-link/types.js +3 -0
- package/dist/src/magic-link/types.js.map +1 -0
- package/dist/src/magic-link/validate-magic-link.guard.d.ts +6 -0
- package/dist/src/magic-link/validate-magic-link.guard.d.ts.map +1 -0
- package/dist/src/magic-link/validate-magic-link.guard.js +29 -0
- package/dist/src/magic-link/validate-magic-link.guard.js.map +1 -0
- package/dist/src/module.util.d.ts +6 -0
- package/dist/src/module.util.d.ts.map +1 -0
- package/dist/src/module.util.js +10 -0
- package/dist/src/module.util.js.map +1 -0
- package/dist/src/types.d.ts +6 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +3 -0
- package/dist/src/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +44 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.controller.d.ts","sourceRoot":"","sources":["../../../src/magic-link/login.controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAQlE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD,qBACa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACN,OAAO,CAAC,MAAM;IAChB,OAAO,CAAC,IAAI;gBAFtB,kBAAkB,EAAE,kBAAkB,EAClB,MAAM,EAAE,uBAAuB,EACjC,IAAI,EAAE,iBAAiB;IAK5D,gBAAgB;IAGV,QAAQ,CACgB,QAAQ,EAAE,QAAQ,EACjB,KAAK,EAAE,MAAM;IAetC,MAAM,CACH,GAAG,EAAE,GAAG,EACa,QAAQ,EAAE,QAAQ;CAUjD"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.LoginController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const cookie_token_service_1 = require("../auth/cookie-token.service");
|
|
18
|
+
const request_magic_link_guard_1 = require("./request-magic-link.guard");
|
|
19
|
+
const validate_magic_link_guard_1 = require("./validate-magic-link.guard");
|
|
20
|
+
const extract_email_from_magic_link_decorator_1 = require("./extract-email-from-magic-link.decorator");
|
|
21
|
+
const module_util_1 = require("../module.util");
|
|
22
|
+
let LoginController = exports.LoginController = class LoginController {
|
|
23
|
+
cookieTokenService;
|
|
24
|
+
config;
|
|
25
|
+
util;
|
|
26
|
+
constructor(cookieTokenService, config, util) {
|
|
27
|
+
this.cookieTokenService = cookieTokenService;
|
|
28
|
+
this.config = config;
|
|
29
|
+
this.util = util;
|
|
30
|
+
}
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
32
|
+
requestMagicLink() { }
|
|
33
|
+
async validate(response, email) {
|
|
34
|
+
const { redirectUrl } = this.config;
|
|
35
|
+
const { userId } = await this.util.findOrCreateByEmail({ email });
|
|
36
|
+
await this.cookieTokenService.prepareResponseWithNewTokens(response, userId);
|
|
37
|
+
response.redirect(redirectUrl);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
async logout(req, response) {
|
|
41
|
+
this.cookieTokenService.removeCookies(response);
|
|
42
|
+
await this.util.revokeRefreshTokenFrom(req.userId, this.cookieTokenService.hashToken(req.cookies[this.config.refreshToken.cookieKey]));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, common_1.UseGuards)(request_magic_link_guard_1.RequestMagicLinkGuard)
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
48
|
+
,
|
|
49
|
+
__metadata("design:type", Function),
|
|
50
|
+
__metadata("design:paramtypes", []),
|
|
51
|
+
__metadata("design:returntype", void 0)
|
|
52
|
+
], LoginController.prototype, "requestMagicLink", null);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, common_1.UseGuards)(validate_magic_link_guard_1.ValidateMagicLinkGuard),
|
|
55
|
+
__param(0, (0, common_1.Res)({ passthrough: true })),
|
|
56
|
+
__param(1, (0, extract_email_from_magic_link_decorator_1.ExtractEmailFromMagicLink)()),
|
|
57
|
+
__metadata("design:type", Function),
|
|
58
|
+
__metadata("design:paramtypes", [Object, String]),
|
|
59
|
+
__metadata("design:returntype", Promise)
|
|
60
|
+
], LoginController.prototype, "validate", null);
|
|
61
|
+
__decorate([
|
|
62
|
+
__param(0, (0, common_1.Req)()),
|
|
63
|
+
__param(1, (0, common_1.Res)({ passthrough: true })),
|
|
64
|
+
__metadata("design:type", Function),
|
|
65
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
66
|
+
__metadata("design:returntype", Promise)
|
|
67
|
+
], LoginController.prototype, "logout", null);
|
|
68
|
+
exports.LoginController = LoginController = __decorate([
|
|
69
|
+
(0, common_1.Controller)(),
|
|
70
|
+
__param(1, (0, module_util_1.InjectAuthMagicLinkConfig)()),
|
|
71
|
+
__param(2, (0, module_util_1.InjectAuthMagicLinkUtil)()),
|
|
72
|
+
__metadata("design:paramtypes", [cookie_token_service_1.CookieTokenService, Object, Object])
|
|
73
|
+
], LoginController);
|
|
74
|
+
//# sourceMappingURL=login.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.controller.js","sourceRoot":"","sources":["../../../src/magic-link/login.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAiE;AAEjE,uEAAkE;AAClE,yEAAmE;AACnE,2EAAqE;AACrE,uGAAsF;AACtF,gDAGwB;AAKjB,IAAM,eAAe,6BAArB,MAAM,eAAe;IAEP;IACoB;IACF;IAHrC,YACmB,kBAAsC,EAClB,MAA+B,EACjC,IAAuB;QAFzC,uBAAkB,GAAlB,kBAAkB,CAAoB;QAClB,WAAM,GAAN,MAAM,CAAyB;QACjC,SAAI,GAAJ,IAAI,CAAmB;IACzD,CAAC;IAIJ,AADA,gEAAgE;IAChE,gBAAgB,KAAI,CAAC;IAGf,AAAN,KAAK,CAAC,QAAQ,CACgB,QAAkB,EACjB,KAAa;QAE1C,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAEpC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAElE,MAAM,IAAI,CAAC,kBAAkB,CAAC,4BAA4B,CACxD,QAAQ,EACR,MAAM,CACP,CAAC;QAEF,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC/B,OAAO;IACT,CAAC;IAEK,AAAN,KAAK,CAAC,MAAM,CACH,GAAQ,EACa,QAAkB;QAE9C,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,IAAI,CAAC,IAAI,CAAC,sBAAsB,CACpC,GAAG,CAAC,MAAM,EACV,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAC/B,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAChD,CACF,CAAC;IACJ,CAAC;CACF,CAAA;AAhCC;IAFC,IAAA,kBAAS,EAAC,gDAAqB,CAAC;IACjC,gEAAgE;;;;;uDAC3C;AAGf;IADL,IAAA,kBAAS,EAAC,kDAAsB,CAAC;IAE/B,WAAA,IAAA,YAAG,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1B,WAAA,IAAA,mEAAyB,GAAE,CAAA;;;;+CAa7B;AAEK;IACH,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,YAAG,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;;;;6CAS5B;0BAxCU,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,uCAAyB,GAAE,CAAA;IAC3B,WAAA,IAAA,qCAAuB,GAAE,CAAA;qCAFW,yCAAkB;GAF9C,eAAe,CAyC3B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AuthMagicLinkUtil } from './export.types';
|
|
2
|
+
import { FullAuthMagicLinkConfig } from '../types';
|
|
3
|
+
declare const MagicLinkStrategy_base: new (...args: any[]) => any;
|
|
4
|
+
export declare class MagicLinkStrategy extends MagicLinkStrategy_base {
|
|
5
|
+
private config;
|
|
6
|
+
private util;
|
|
7
|
+
constructor(config: FullAuthMagicLinkConfig, util: AuthMagicLinkUtil);
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=magic-link.strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magic-link.strategy.d.ts","sourceRoot":"","sources":["../../../src/magic-link/magic-link.strategy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAMnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;;AAInD,qBACa,iBAAkB,SAAQ,sBAA0B;IAEhC,OAAO,CAAC,MAAM;IAChB,OAAO,CAAC,IAAI;gBADF,MAAM,EAAE,uBAAuB,EACjC,IAAI,EAAE,iBAAiB;CA+B7D"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.MagicLinkStrategy = void 0;
|
|
19
|
+
const common_1 = require("@nestjs/common");
|
|
20
|
+
const passport_1 = require("@nestjs/passport");
|
|
21
|
+
const passport_magic_link_1 = require("passport-magic-link");
|
|
22
|
+
const module_util_1 = require("../module.util");
|
|
23
|
+
const urijs_1 = __importDefault(require("urijs"));
|
|
24
|
+
// this strategy is executed when calling the "VerifyMagicLinkGuard"
|
|
25
|
+
let MagicLinkStrategy = exports.MagicLinkStrategy = class MagicLinkStrategy extends (0, passport_1.PassportStrategy)(passport_magic_link_1.Strategy) {
|
|
26
|
+
config;
|
|
27
|
+
util;
|
|
28
|
+
constructor(config, util) {
|
|
29
|
+
const { magicLinkToken } = config;
|
|
30
|
+
super({
|
|
31
|
+
secret: magicLinkToken.secret,
|
|
32
|
+
userFields: ['email'],
|
|
33
|
+
tokenField: 'token',
|
|
34
|
+
ttl: magicLinkToken.ttl,
|
|
35
|
+
}, async (user, token) => {
|
|
36
|
+
this.util.sendMagicLink(user, (frontendUrl) => (0, urijs_1.default)(frontendUrl)
|
|
37
|
+
.segment([
|
|
38
|
+
this.config.paths.proxy ?? '',
|
|
39
|
+
this.config.paths.magicLink.validate,
|
|
40
|
+
])
|
|
41
|
+
.query({ token })
|
|
42
|
+
.toString(), token);
|
|
43
|
+
},
|
|
44
|
+
// this is the first function which is executed
|
|
45
|
+
// the return value is provided to the function above
|
|
46
|
+
(user) => {
|
|
47
|
+
return { ...user, email: user.email.toLowerCase() };
|
|
48
|
+
});
|
|
49
|
+
this.config = config;
|
|
50
|
+
this.util = util;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
exports.MagicLinkStrategy = MagicLinkStrategy = __decorate([
|
|
54
|
+
(0, common_1.Injectable)(),
|
|
55
|
+
__param(0, (0, module_util_1.InjectAuthMagicLinkConfig)()),
|
|
56
|
+
__param(1, (0, module_util_1.InjectAuthMagicLinkUtil)()),
|
|
57
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
58
|
+
], MagicLinkStrategy);
|
|
59
|
+
//# sourceMappingURL=magic-link.strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magic-link.strategy.js","sourceRoot":"","sources":["../../../src/magic-link/magic-link.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAAoD;AACpD,6DAA+C;AAE/C,gDAGwB;AAGxB,kDAAwB;AAExB,oEAAoE;AAE7D,IAAM,iBAAiB,+BAAvB,MAAM,iBAAkB,SAAQ,IAAA,2BAAgB,EAAC,8BAAQ,CAAC;IAExB;IACF;IAFrC,YACuC,MAA+B,EACjC,IAAuB;QAE1D,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;QAClC,KAAK,CACH;YACE,MAAM,EAAE,cAAc,CAAC,MAAM;YAC7B,UAAU,EAAE,CAAC,OAAO,CAAC;YACrB,UAAU,EAAE,OAAO;YACnB,GAAG,EAAE,cAAc,CAAC,GAAG;SACxB,EACD,KAAK,EAAE,IAAmB,EAAE,KAAa,EAAiB,EAAE;YAC1D,IAAI,CAAC,IAAI,CAAC,aAAa,CACrB,IAAI,EACJ,CAAC,WAAW,EAAE,EAAE,CACd,IAAA,eAAG,EAAC,WAAW,CAAC;iBACb,OAAO,CAAC;gBACP,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;gBAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ;aACrC,CAAC;iBACD,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;iBAChB,QAAQ,EAAE,EACf,KAAK,CACN,CAAC;QACJ,CAAC;QACD,+CAA+C;QAC/C,qDAAqD;QACrD,CAAC,IAAmB,EAAiB,EAAE;YACrC,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;QACtD,CAAC,CACF,CAAC;QA9BmC,WAAM,GAAN,MAAM,CAAyB;QACjC,SAAI,GAAJ,IAAI,CAAmB;IA8B5D,CAAC;CACF,CAAA;4BAlCY,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,uCAAyB,GAAE,CAAA;IAC3B,WAAA,IAAA,qCAAuB,GAAE,CAAA;;GAHjB,iBAAiB,CAkC7B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const RequestMagicLinkGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
|
|
2
|
+
export declare class RequestMagicLinkGuard extends RequestMagicLinkGuard_base {
|
|
3
|
+
constructor();
|
|
4
|
+
}
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=request-magic-link.guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-magic-link.guard.d.ts","sourceRoot":"","sources":["../../../src/magic-link/request-magic-link.guard.ts"],"names":[],"mappings":";AAIA,qBACa,qBAAsB,SAAQ,0BAAkC;;CAQ5E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.RequestMagicLinkGuard = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const passport_1 = require("@nestjs/passport");
|
|
15
|
+
const constants_1 = require("../constants");
|
|
16
|
+
let RequestMagicLinkGuard = exports.RequestMagicLinkGuard = class RequestMagicLinkGuard extends (0, passport_1.AuthGuard)(constants_1.strategyNames.magicLink) {
|
|
17
|
+
constructor() {
|
|
18
|
+
super({
|
|
19
|
+
action: 'requestToken',
|
|
20
|
+
// any other options can be provided here
|
|
21
|
+
allowReuse: false,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.RequestMagicLinkGuard = RequestMagicLinkGuard = __decorate([
|
|
26
|
+
(0, common_1.Injectable)(),
|
|
27
|
+
__metadata("design:paramtypes", [])
|
|
28
|
+
], RequestMagicLinkGuard);
|
|
29
|
+
//# sourceMappingURL=request-magic-link.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-magic-link.guard.js","sourceRoot":"","sources":["../../../src/magic-link/request-magic-link.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA6C;AAC7C,4CAA6C;AAGtC,IAAM,qBAAqB,mCAA3B,MAAM,qBAAsB,SAAQ,IAAA,oBAAS,EAAC,yBAAa,CAAC,SAAS,CAAC;IAC3E;QACE,KAAK,CAAC;YACJ,MAAM,EAAE,cAAc;YACtB,yCAAyC;YACzC,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;gCARY,qBAAqB;IADjC,IAAA,mBAAU,GAAE;;GACA,qBAAqB,CAQjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/magic-link/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/magic-link/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const ValidateMagicLinkGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
|
|
2
|
+
export declare class ValidateMagicLinkGuard extends ValidateMagicLinkGuard_base {
|
|
3
|
+
constructor();
|
|
4
|
+
}
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=validate-magic-link.guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-magic-link.guard.d.ts","sourceRoot":"","sources":["../../../src/magic-link/validate-magic-link.guard.ts"],"names":[],"mappings":";AAIA,qBACa,sBAAuB,SAAQ,2BAAkC;;CAQ7E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.ValidateMagicLinkGuard = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const passport_1 = require("@nestjs/passport");
|
|
15
|
+
const constants_1 = require("../constants");
|
|
16
|
+
let ValidateMagicLinkGuard = exports.ValidateMagicLinkGuard = class ValidateMagicLinkGuard extends (0, passport_1.AuthGuard)(constants_1.strategyNames.magicLink) {
|
|
17
|
+
constructor() {
|
|
18
|
+
super({
|
|
19
|
+
action: 'acceptToken',
|
|
20
|
+
// any other options can be provided here
|
|
21
|
+
allowReuse: false,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.ValidateMagicLinkGuard = ValidateMagicLinkGuard = __decorate([
|
|
26
|
+
(0, common_1.Injectable)(),
|
|
27
|
+
__metadata("design:paramtypes", [])
|
|
28
|
+
], ValidateMagicLinkGuard);
|
|
29
|
+
//# sourceMappingURL=validate-magic-link.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-magic-link.guard.js","sourceRoot":"","sources":["../../../src/magic-link/validate-magic-link.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA6C;AAC7C,4CAA6C;AAGtC,IAAM,sBAAsB,oCAA5B,MAAM,sBAAuB,SAAQ,IAAA,oBAAS,EAAC,yBAAa,CAAC,SAAS,CAAC;IAC5E;QACE,KAAK,CAAC;YACJ,MAAM,EAAE,aAAa;YACrB,yCAAyC;YACzC,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;iCARY,sBAAsB;IADlC,IAAA,mBAAU,GAAE;;GACA,sBAAsB,CAQlC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const AuthMagicLinkOptionsInjectionToken: unique symbol;
|
|
2
|
+
export declare const AuthMagicLinkUtilInjectionToken: unique symbol;
|
|
3
|
+
export declare const AuthMagicLinkConfigInjectionToken: unique symbol;
|
|
4
|
+
export declare const InjectAuthMagicLinkUtil: () => ParameterDecorator;
|
|
5
|
+
export declare const InjectAuthMagicLinkConfig: () => ParameterDecorator;
|
|
6
|
+
//# sourceMappingURL=module.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.util.d.ts","sourceRoot":"","sources":["../../src/module.util.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kCAAkC,eAE9C,CAAC;AACF,eAAO,MAAM,+BAA+B,eAE3C,CAAC;AACF,eAAO,MAAM,iCAAiC,eAE7C,CAAC;AAEF,eAAO,MAAM,uBAAuB,0BAEnC,CAAC;AAEF,eAAO,MAAM,yBAAyB,0BAErC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InjectAuthMagicLinkConfig = exports.InjectAuthMagicLinkUtil = exports.AuthMagicLinkConfigInjectionToken = exports.AuthMagicLinkUtilInjectionToken = exports.AuthMagicLinkOptionsInjectionToken = void 0;
|
|
4
|
+
const nestjs_common_1 = require("@golevelup/nestjs-common");
|
|
5
|
+
exports.AuthMagicLinkOptionsInjectionToken = Symbol('AuthMagicLinkOptionsInjectionToken');
|
|
6
|
+
exports.AuthMagicLinkUtilInjectionToken = Symbol('AuthMagicLinkUtilInjectionToken');
|
|
7
|
+
exports.AuthMagicLinkConfigInjectionToken = Symbol('AuthMagicLinkUtilInjectionToken');
|
|
8
|
+
exports.InjectAuthMagicLinkUtil = (0, nestjs_common_1.makeInjectableDecorator)(exports.AuthMagicLinkUtilInjectionToken);
|
|
9
|
+
exports.InjectAuthMagicLinkConfig = (0, nestjs_common_1.makeInjectableDecorator)(exports.AuthMagicLinkConfigInjectionToken);
|
|
10
|
+
//# sourceMappingURL=module.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.util.js","sourceRoot":"","sources":["../../src/module.util.ts"],"names":[],"mappings":";;;AAAA,4DAAmE;AAEtD,QAAA,kCAAkC,GAAG,MAAM,CACtD,oCAAoC,CACrC,CAAC;AACW,QAAA,+BAA+B,GAAG,MAAM,CACnD,iCAAiC,CAClC,CAAC;AACW,QAAA,iCAAiC,GAAG,MAAM,CACrD,iCAAiC,CAClC,CAAC;AAEW,QAAA,uBAAuB,GAAG,IAAA,uCAAuB,EAC5D,uCAA+B,CAChC,CAAC;AAEW,QAAA,yBAAyB,GAAG,IAAA,uCAAuB,EAC9D,yCAAiC,CAClC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DeepRequired, Merge } from 'ts-essentials';
|
|
2
|
+
import { AuthMagicLinkConfig, AuthMagicLinkPathsConfig } from './environment.types';
|
|
3
|
+
export type FullAuthMagicLinkConfig = Merge<DeepRequired<Omit<AuthMagicLinkConfig, 'paths'>>, {
|
|
4
|
+
paths: AuthMagicLinkPathsConfig;
|
|
5
|
+
}>;
|
|
6
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,uBAAuB,GAAG,KAAK,CACzC,YAAY,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,EAChD;IAAE,KAAK,EAAE,wBAAwB,CAAA;CAAE,CACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|