@riocrypto/common-server 1.0.1816 → 1.0.1818
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.
|
@@ -22,7 +22,8 @@ const secret_manager_client_1 = require("../clients/secret-manager-client");
|
|
|
22
22
|
const admin_auth_1 = require("../models/admin-auth");
|
|
23
23
|
const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
24
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
25
|
-
if (authorizationTypes.includes(common_1.AuthorizationType.GenesisAdmin)
|
|
25
|
+
if (authorizationTypes.includes(common_1.AuthorizationType.GenesisAdmin) &&
|
|
26
|
+
req.header("x-genesis-api-key")) {
|
|
26
27
|
let apiKey = req.header("x-genesis-api-key");
|
|
27
28
|
const GENESIS_ADMIN_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("GENESIS_ADMIN_KEY");
|
|
28
29
|
if (!GENESIS_ADMIN_KEY) {
|
|
@@ -32,7 +33,8 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
32
33
|
req.validGenisisAdminKey = true;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
if (authorizationTypes.includes(common_1.AuthorizationType.Cluster)
|
|
36
|
+
if (authorizationTypes.includes(common_1.AuthorizationType.Cluster) &&
|
|
37
|
+
req.header("x-cluster-api-key")) {
|
|
36
38
|
let apiKey = req.header("x-cluster-api-key");
|
|
37
39
|
const CLUSTER_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("CLUSTER_API_KEY");
|
|
38
40
|
if (!CLUSTER_API_KEY) {
|
|
@@ -42,7 +44,8 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
42
44
|
req.validClusterApiKey = true;
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
|
-
if (authorizationTypes.includes(common_1.AuthorizationType.AdminAuth)
|
|
47
|
+
if (authorizationTypes.includes(common_1.AuthorizationType.AdminAuth) &&
|
|
48
|
+
req.header("x-admin-api-key")) {
|
|
46
49
|
const adminApiKey = req.header("x-admin-api-key");
|
|
47
50
|
const AdminAuth = yield (0, admin_auth_1.buildAdminAuth)(mongoose);
|
|
48
51
|
if (adminApiKey) {
|
|
@@ -78,8 +81,8 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
78
81
|
authorizationTypes.includes(common_1.AuthorizationType.UserNoKYC) ||
|
|
79
82
|
authorizationTypes.includes(common_1.AuthorizationType.User)) {
|
|
80
83
|
const apiKey = req.header("x-api-key");
|
|
81
|
-
const Auth = yield (0, auth_1.buildAuth)(mongoose);
|
|
82
84
|
if (apiKey) {
|
|
85
|
+
const Auth = yield (0, auth_1.buildAuth)(mongoose);
|
|
83
86
|
try {
|
|
84
87
|
const hashedApiKey = yield apiKey_1.ApiKey.toHash(apiKey);
|
|
85
88
|
const auth = yield Auth.findOne({
|
|
@@ -92,6 +95,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
92
95
|
catch (err) { }
|
|
93
96
|
}
|
|
94
97
|
else if ((_b = req.cookies) === null || _b === void 0 ? void 0 : _b.accessToken) {
|
|
98
|
+
const Auth = yield (0, auth_1.buildAuth)(mongoose);
|
|
95
99
|
try {
|
|
96
100
|
const ACCESS_TOKEN_SECRET = yield secret_manager_client_1.secretManagerClient.getSecretValue("ACCESS_TOKEN_SECRET");
|
|
97
101
|
if (!ACCESS_TOKEN_SECRET) {
|
package/build/models/user.d.ts
CHANGED
|
@@ -110,9 +110,6 @@ interface UserAttrs {
|
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
112
|
attioRecordId?: string;
|
|
113
|
-
cumulativeVolumesInUSD?: {
|
|
114
|
-
[country in Country]?: number;
|
|
115
|
-
};
|
|
116
113
|
}
|
|
117
114
|
interface UserModel extends Model<UserDoc> {
|
|
118
115
|
build(attrs: UserAttrs): UserDoc;
|
|
@@ -228,9 +225,6 @@ interface UserDoc extends Document {
|
|
|
228
225
|
};
|
|
229
226
|
};
|
|
230
227
|
};
|
|
231
|
-
cumulativeVolumesInUSD?: {
|
|
232
|
-
[country in Country]?: number;
|
|
233
|
-
};
|
|
234
228
|
}
|
|
235
229
|
declare const buildUser: (mongoose: Mongoose) => UserModel;
|
|
236
230
|
export { buildUser, UserDoc, UserAttrs };
|
package/build/models/user.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1818",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@google-cloud/secret-manager": "^5.3.0",
|
|
27
27
|
"@google-cloud/storage": "^6.9.5",
|
|
28
28
|
"@hyperdx/node-opentelemetry": "^0.4.2",
|
|
29
|
-
"@riocrypto/common": "^1.0.
|
|
29
|
+
"@riocrypto/common": "^1.0.1621",
|
|
30
30
|
"@types/express": "^4.17.13",
|
|
31
31
|
"axios": "^1.6.0",
|
|
32
32
|
"crypto-js": "^4.2.0",
|