@riocrypto/common 1.0.368 → 1.0.370
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/build/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * from "./middlewares/require-auth";
|
|
|
26
26
|
export * from "./middlewares/verify-admin-api-key";
|
|
27
27
|
export * from "./middlewares/require-admin-api-key";
|
|
28
28
|
export * from "./middlewares/current-admin-auth";
|
|
29
|
+
export * from "./middlewares/validate-auth";
|
|
29
30
|
export * from "./events/base-listener";
|
|
30
31
|
export * from "./events/base-publisher";
|
|
31
32
|
export * from "./events/subjects";
|
package/build/index.js
CHANGED
|
@@ -42,6 +42,7 @@ __exportStar(require("./middlewares/require-auth"), exports);
|
|
|
42
42
|
__exportStar(require("./middlewares/verify-admin-api-key"), exports);
|
|
43
43
|
__exportStar(require("./middlewares/require-admin-api-key"), exports);
|
|
44
44
|
__exportStar(require("./middlewares/current-admin-auth"), exports);
|
|
45
|
+
__exportStar(require("./middlewares/validate-auth"), exports);
|
|
45
46
|
__exportStar(require("./events/base-listener"), exports);
|
|
46
47
|
__exportStar(require("./events/base-publisher"), exports);
|
|
47
48
|
__exportStar(require("./events/subjects"), exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.validateKYC = void 0;
|
|
13
|
+
const missing_password_error_1 = require("../errors/missing-password-error");
|
|
14
|
+
const missing_security_question_error_1 = require("../errors/missing-security-question-error");
|
|
15
|
+
const validateKYC = (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const auth = req.currentAuth;
|
|
17
|
+
if (auth) {
|
|
18
|
+
if (auth.missing.includes("password")) {
|
|
19
|
+
throw new missing_password_error_1.MissingPasswordError();
|
|
20
|
+
}
|
|
21
|
+
if (auth.missing.includes("securityQuestion")) {
|
|
22
|
+
throw new missing_security_question_error_1.MissingSecurityQuestionError();
|
|
23
|
+
}
|
|
24
|
+
if (auth.missing.includes("securityAnswer")) {
|
|
25
|
+
throw new missing_security_question_error_1.MissingSecurityQuestionError();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
next();
|
|
29
|
+
});
|
|
30
|
+
exports.validateKYC = validateKYC;
|