1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | exports.passwordHash = exports.LocalStrategy = exports.hooks = void 0;
|
7 | const hash_password_1 = __importDefault(require("./hooks/hash-password"));
|
8 | const protect_1 = __importDefault(require("./hooks/protect"));
|
9 | const strategy_1 = require("./strategy");
|
10 | Object.defineProperty(exports, "LocalStrategy", { enumerable: true, get: function () { return strategy_1.LocalStrategy; } });
|
11 | exports.hooks = { hashPassword: hash_password_1.default, protect: protect_1.default };
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | const passwordHash = (options) => async (value, _data, context) => {
|
20 | if (value === undefined) {
|
21 | return value;
|
22 | }
|
23 | const { app, params } = context;
|
24 | const authService = app.defaultAuthentication(options.service);
|
25 | const localStrategy = authService.getStrategy(options.strategy);
|
26 | return localStrategy.hashPassword(value, params);
|
27 | };
|
28 | exports.passwordHash = passwordHash;
|
29 |
|
\ | No newline at end of file |