godprotocol 2.3.43 → 2.3.45
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/README.md +0 -0
- package/package.json +1 -1
- package/server/Routable/Route_table.js +1 -5
- package/server/Utils_.js +11 -0
- package/server/utils.js +10 -1
package/README.md
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -198,11 +198,7 @@ class Route_table extends Headers {
|
|
|
198
198
|
|
|
199
199
|
let actual;
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
actual = Array.isArray(data_value) ? "array" : typeof data_value;
|
|
203
|
-
} else {
|
|
204
|
-
actual = typeof data_value;
|
|
205
|
-
}
|
|
201
|
+
let actual = Array.isArray(data_value) ? "array" : typeof data_value;
|
|
206
202
|
|
|
207
203
|
if (actual !== expected) {
|
|
208
204
|
return {
|
package/server/Utils_.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
import { debug, decryptToken, encryptToken, hash } from "./utils.js";
|
|
2
|
+
|
|
1
3
|
class Utils {
|
|
4
|
+
constructor() {}
|
|
5
|
+
|
|
6
|
+
hash = hash;
|
|
7
|
+
debug = debug;
|
|
8
|
+
cypher = {
|
|
9
|
+
encrypt: encryptToken,
|
|
10
|
+
decrypt: decryptToken,
|
|
11
|
+
};
|
|
12
|
+
|
|
2
13
|
validateService = (names, services) => {
|
|
3
14
|
let hasErrors = false;
|
|
4
15
|
|
package/server/utils.js
CHANGED
|
@@ -51,4 +51,13 @@ const encryptToken = (payload, secret) => {
|
|
|
51
51
|
return `${iv.toString("base64")}:${tag.toString("base64")}:${encrypted.toString("base64")}`;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
const hash = (value, alg = "sha256") =>
|
|
55
|
+
crypto.createHash(alg).update(value).digest("hex");
|
|
56
|
+
|
|
57
|
+
const debug = (...args) => {
|
|
58
|
+
if (process.env.DEV) {
|
|
59
|
+
console.log(...args);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export { encryptToken, decryptToken, hash, debug };
|