@riocrypto/common-server 1.0.2181 → 1.0.2183
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.
|
@@ -0,0 +1,31 @@
|
|
|
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.getIsFireblocksWebhookValid = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const publicKey = `-----BEGIN PUBLIC KEY-----
|
|
9
|
+
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0+6wd9OJQpK60ZI7qnZG
|
|
10
|
+
jjQ0wNFUHfRv85Tdyek8+ahlg1Ph8uhwl4N6DZw5LwLXhNjzAbQ8LGPxt36RUZl5
|
|
11
|
+
YlxTru0jZNKx5lslR+H4i936A4pKBjgiMmSkVwXD9HcfKHTp70GQ812+J0Fvti/v
|
|
12
|
+
4nrrUpc011Wo4F6omt1QcYsi4GTI5OsEbeKQ24BtUd6Z1Nm/EP7PfPxeb4CP8KOH
|
|
13
|
+
clM8K7OwBUfWrip8Ptljjz9BNOZUF94iyjJ/BIzGJjyCntho64ehpUYP8UJykLVd
|
|
14
|
+
CGcu7sVYWnknf1ZGLuqqZQt4qt7cUUhFGielssZP9N9x7wzaAIFcT3yQ+ELDu1SZ
|
|
15
|
+
dE4lZsf2uMyfj58V8GDOLLE233+LRsRbJ083x+e2mW5BdAGtGgQBusFfnmv5Bxqd
|
|
16
|
+
HgS55hsna5725/44tvxll261TgQvjGrTxwe7e5Ia3d2Syc+e89mXQaI/+cZnylNP
|
|
17
|
+
SwCCvx8mOM847T0XkVRX3ZrwXtHIA25uKsPJzUtksDnAowB91j7RJkjXxJcz3Vh1
|
|
18
|
+
4k182UFOTPRW9jzdWNSyWQGl/vpe9oQ4c2Ly15+/toBo4YXJeDdDnZ5c/O+KKadc
|
|
19
|
+
IMPBpnPrH/0O97uMPuED+nI6ISGOTMLZo35xJ96gPBwyG5s2QxIkKPXIrhgcgUnk
|
|
20
|
+
tSM7QYNhlftT4/yVvYnk0YcCAwEAAQ==
|
|
21
|
+
-----END PUBLIC KEY-----`.replace(/\\n/g, "\n");
|
|
22
|
+
const getIsFireblocksWebhookValid = (req) => {
|
|
23
|
+
const message = JSON.stringify(req.body);
|
|
24
|
+
const signature = req.headers["fireblocks-signature"];
|
|
25
|
+
const verifier = crypto_1.default.createVerify("RSA-SHA512");
|
|
26
|
+
verifier.write(message);
|
|
27
|
+
verifier.end();
|
|
28
|
+
const isVerified = verifier.verify(publicKey, signature, "base64");
|
|
29
|
+
return isVerified;
|
|
30
|
+
};
|
|
31
|
+
exports.getIsFireblocksWebhookValid = getIsFireblocksWebhookValid;
|
package/build/index.d.ts
CHANGED
|
@@ -114,3 +114,4 @@ export * from "./helpers/get-order-from-reference";
|
|
|
114
114
|
export * from "./helpers/send-with-xss-guard";
|
|
115
115
|
export * from "./helpers/generate-idempotency-key-from-mongo-id";
|
|
116
116
|
export * from "./helpers/generate-idempotency-key-from-order";
|
|
117
|
+
export * from "./helpers/get-is-fireblocks-signature-valid";
|
package/build/index.js
CHANGED
|
@@ -130,3 +130,4 @@ __exportStar(require("./helpers/get-order-from-reference"), exports);
|
|
|
130
130
|
__exportStar(require("./helpers/send-with-xss-guard"), exports);
|
|
131
131
|
__exportStar(require("./helpers/generate-idempotency-key-from-mongo-id"), exports);
|
|
132
132
|
__exportStar(require("./helpers/generate-idempotency-key-from-order"), exports);
|
|
133
|
+
__exportStar(require("./helpers/get-is-fireblocks-signature-valid"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2183",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@google-cloud/secret-manager": "^5.3.0",
|
|
29
29
|
"@google-cloud/storage": "^6.9.5",
|
|
30
30
|
"@hyperdx/node-opentelemetry": "^0.7.0",
|
|
31
|
-
"@riocrypto/common": "^1.0.
|
|
31
|
+
"@riocrypto/common": "^1.0.1926",
|
|
32
32
|
"@types/express": "^4.17.13",
|
|
33
33
|
"axios": "^1.7.4",
|
|
34
34
|
"crypto-js": "^4.2.0",
|