@indra.ai/deva 1.6.42 → 1.6.43

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.
Files changed (2) hide show
  1. package/lib/index.js +17 -5
  2. package/package.json +3 -1
package/lib/index.js CHANGED
@@ -31,7 +31,17 @@ class LIB {
31
31
  }
32
32
 
33
33
  setClient(client) {
34
- if (!this.client) this.client = client;
34
+ if (this.client) return;
35
+ this.client = client;
36
+ this.hashAgent();
37
+ }
38
+
39
+ hashAgent(client) {
40
+ const {md5} = this.agent;
41
+ if (md5) return;
42
+ this.agent.md5 = this.hash(this.agent, 'md5');
43
+ this.agent.sha256 = this.hash(this.agent, 'sha256');
44
+ this.agent.sha512 = this.hash(this.agent, 'sha512');
35
45
  }
36
46
 
37
47
  help(msg, help_dir) {
@@ -63,7 +73,7 @@ class LIB {
63
73
  3. the uid is then returned with a created, md5, sha256, and sha512 hash of the value
64
74
  copyright: 2025 Quinn A Michaels. All rights reserved.
65
75
  ***************/
66
- uid(guid=false) {
76
+ uid(guid=false) {
67
77
  const time = Date.now(); // set time to local constant
68
78
  const date = this.formatDate(time, 'long', true); // set date to local constant
69
79
  const machine = {
@@ -82,12 +92,13 @@ class LIB {
82
92
  const machine_hash = this.hash(machine, 'sha256');
83
93
  const pkg_hash = this.hash(this.pkg, 'sha256');
84
94
 
95
+
85
96
  const data = {
86
97
  uid: false,
87
98
  time,
88
99
  date,
89
100
  client: this.client,
90
- agent: this.agent,
101
+ agent: this.agent.sha256,
91
102
  pkg: pkg_hash,
92
103
  machine: machine_hash,
93
104
  warning: this.pkg.config.messages.uid_warning,
@@ -117,8 +128,9 @@ class LIB {
117
128
  const {q, id} = packet;
118
129
 
119
130
  const {meta, agent, client, text} = q;
120
- const agent_hash = this.hash(agent, 'sha256');
121
- const client_hash = client.sha256;
131
+ const {invalid_agent,invalid_client} = this.agent._messages;
132
+ const agent_hash = this.agent.sha256 === agent.sha256 ? this.agent.sha256 : invalid_agent;
133
+ const client_hash = this.client === client.sha256 ? this.client : invalid_client;
122
134
 
123
135
  const {key, method, params} = meta;
124
136
  const opts = this.copy(params); // copy the params and set as opts.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": 45958588982385560000,
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.6.42",
4
+ "version": "1.6.43",
5
5
  "description": "The Deva Core",
6
6
  "main": "index.js",
7
7
  "license": "VLA:45958588982385558603 LICENSE.md",
@@ -360,6 +360,8 @@
360
360
  "nopacket": "⛔️ NO PACKET PROVIDED",
361
361
  "method_not_found": "⛔️ METHOD NOT FOUND",
362
362
  "help_not_found": "⛔️ HELP NOT FOUND",
363
+ "invalid_agent": "⛔️ Agent Hash Invalid",
364
+ "invalid_client": "⛔️ Client Hash Invalid",
363
365
  "load": "📦 Load",
364
366
  "unload": "🥡 Unload",
365
367
  "uid_warning": "⚠️ Unlawful Use Constitutes Lawful Consent to Forfeit of All Wealth, Property, and Holdings to the Internal Revenue Service (IRS) for Lawful Taxation and Restiuttion to the Rightful Owner of the Machine of Origin."