godprotocol 2.3.44 → 2.3.46

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godprotocol",
3
- "version": "2.3.44",
3
+ "version": "2.3.46",
4
4
  "description": "A distributed computing environment for Web 4.0 — integrating AI, decentralisation, and virtual computation.",
5
5
  "main": "Index.js",
6
6
  "type": "module",
@@ -198,11 +198,7 @@ class Route_table extends Headers {
198
198
 
199
199
  let actual;
200
200
 
201
- if (expected === "array") {
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
- export { encryptToken, decryptToken };
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 };