@indra.ai/deva 1.6.42 → 1.6.44

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 (3) hide show
  1. package/index.js +2 -2
  2. package/lib/index.js +16 -7
  3. package/package.json +3 -1
package/index.js CHANGED
@@ -1126,8 +1126,8 @@ class Deva {
1126
1126
  data.sha256 = this.lib.hash(data, 'sha256');
1127
1127
  data.sha512 = this.lib.hash(data, 'sha512');
1128
1128
 
1129
- const client = this.client();
1130
- this.lib.setClient(client.sha256);
1129
+ this.lib.setClient(this.client());
1130
+ this.lib.setAgent(this.agent());
1131
1131
 
1132
1132
  this.state('ready', data.id.uid);
1133
1133
  this.talk(config.events.ready, data);
package/lib/index.js CHANGED
@@ -18,7 +18,7 @@ class Node {
18
18
  class LIB {
19
19
  constructor(opts) {
20
20
  this.pkg = opts.pkg || {};
21
- this.agent = opts.agent || false;
21
+ this.agent = false;
22
22
  this.client = false;
23
23
  this.lang = opts.lang || 'en';
24
24
  this.locale = opts.locale || 'US';
@@ -31,7 +31,13 @@ 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
+ }
37
+
38
+ setAgent(agent) {
39
+ if (this.agent) return;
40
+ this.agent = agent;
35
41
  }
36
42
 
37
43
  help(msg, help_dir) {
@@ -63,7 +69,7 @@ class LIB {
63
69
  3. the uid is then returned with a created, md5, sha256, and sha512 hash of the value
64
70
  copyright: 2025 Quinn A Michaels. All rights reserved.
65
71
  ***************/
66
- uid(guid=false) {
72
+ uid(guid=false) {
67
73
  const time = Date.now(); // set time to local constant
68
74
  const date = this.formatDate(time, 'long', true); // set date to local constant
69
75
  const machine = {
@@ -82,12 +88,14 @@ class LIB {
82
88
  const machine_hash = this.hash(machine, 'sha256');
83
89
  const pkg_hash = this.hash(this.pkg, 'sha256');
84
90
 
91
+ console.log('uid client', this.client);
92
+
85
93
  const data = {
86
94
  uid: false,
87
95
  time,
88
96
  date,
89
- client: this.client,
90
- agent: this.agent,
97
+ client: this.client.sha256,
98
+ agent: this.agent.sha256,
91
99
  pkg: pkg_hash,
92
100
  machine: machine_hash,
93
101
  warning: this.pkg.config.messages.uid_warning,
@@ -117,8 +125,9 @@ class LIB {
117
125
  const {q, id} = packet;
118
126
 
119
127
  const {meta, agent, client, text} = q;
120
- const agent_hash = this.hash(agent, 'sha256');
121
- const client_hash = client.sha256;
128
+ const {invalid_agent,invalid_client} = this.agent._messages;
129
+ const agent_hash = this.agent.sha256 === agent.sha256 ? this.agent.sha256 : invalid_agent;
130
+ const client_hash = this.client === client.sha256 ? this.client : invalid_client;
122
131
 
123
132
  const {key, method, params} = meta;
124
133
  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.44",
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."