@riocrypto/common-server 1.0.1056 → 1.0.1057
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.
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.buildWebhookRegistration = void 0;
|
|
27
|
-
const crypto = __importStar(require("crypto"));
|
|
28
4
|
const buildWebhookRegistration = (mongoose) => {
|
|
29
5
|
// if model is already defined, return it
|
|
30
6
|
if (mongoose.models.WebhookRegistration) {
|
|
@@ -59,17 +35,6 @@ const buildWebhookRegistration = (mongoose) => {
|
|
|
59
35
|
WebhookRegistrationSchema.statics.build = (attrs) => {
|
|
60
36
|
return new WebhookRegistration(attrs);
|
|
61
37
|
};
|
|
62
|
-
WebhookRegistrationSchema.pre("save", function (next) {
|
|
63
|
-
// Encrypt the shared secret before saving
|
|
64
|
-
const algorithm = "aes-256-cbc";
|
|
65
|
-
const iv = crypto.randomBytes(16);
|
|
66
|
-
const sharedSecret = this.get("encryptedSharedSecret");
|
|
67
|
-
const cipher = crypto.createCipheriv(algorithm, Buffer.from(sharedSecret), iv);
|
|
68
|
-
let encryptedSecret = cipher.update(sharedSecret, "utf8", "hex");
|
|
69
|
-
encryptedSecret += cipher.final("hex");
|
|
70
|
-
this.set("encryptedSharedSecret", encryptedSecret);
|
|
71
|
-
next();
|
|
72
|
-
});
|
|
73
38
|
const WebhookRegistration = mongoose.model("WebhookRegistration", WebhookRegistrationSchema);
|
|
74
39
|
return WebhookRegistration;
|
|
75
40
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1057",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
25
25
|
"@everapi/currencyapi-js": "^1.0.6",
|
|
26
26
|
"@google-cloud/storage": "^6.9.5",
|
|
27
|
-
"@riocrypto/common": "^1.0.
|
|
27
|
+
"@riocrypto/common": "^1.0.908",
|
|
28
28
|
"@types/express": "^4.17.13",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"ccxt": "^3.0.30",
|