@indra.ai/deva 1.6.77 โ 1.6.79
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 +1 -4
- package/config/actions.json +9 -5
- package/config/msgs.json +1 -1
- package/config/states.json +6 -2
- package/config/zones.json +33 -1
- package/index.js +128 -113
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -140,7 +140,7 @@ this.agent();
|
|
|
140
140
|
|
|
141
141
|
### Data Attributes
|
|
142
142
|
|
|
143
|
-
- **id:** The Agent id generated by `this.
|
|
143
|
+
- **id:** The Agent id generated by `this.uid()`.
|
|
144
144
|
- **key:** The key to reference the agent by on the network.
|
|
145
145
|
- **prompt:** The prompt configuration for the entity.
|
|
146
146
|
- **emoji:** The emoji the for the agent.
|
|
@@ -478,9 +478,6 @@ The `stop()` function will stop the Deva and run the `onStop()` state function.
|
|
|
478
478
|
### init(deva=false)
|
|
479
479
|
The `init()` function will initialize the Deva and run the `onInit()` state function.
|
|
480
480
|
|
|
481
|
-
### initDeva()
|
|
482
|
-
The `initDeva()` function will initialize the Deva located under the current Deva set. To be used in instances of a main Deva parent situation.
|
|
483
|
-
|
|
484
481
|
---
|
|
485
482
|
|
|
486
483
|
[Github Repo](https://github.com/indraai/deva)
|
package/config/actions.json
CHANGED
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"parse": "๐ฉ Parse",
|
|
68
68
|
"resolve": "๐ค Resolve",
|
|
69
69
|
"reject": "๐งฑ Reject",
|
|
70
|
-
"sign": "
|
|
70
|
+
"sign": "๐๏ธ๏ธ Sign",
|
|
71
71
|
"violation": "๐บ Violation",
|
|
72
72
|
"fine": "๐ต Fine",
|
|
73
73
|
"payment": "๐งพ Payment",
|
|
@@ -126,9 +126,13 @@
|
|
|
126
126
|
"locate": "๐ Locate",
|
|
127
127
|
"abandon": "๐๏ธ Abandon",
|
|
128
128
|
"target": "๐ฏ Target",
|
|
129
|
-
"usa": "๐บ๐ธ
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
129
|
+
"usa": "๐บ๐ธ USA",
|
|
130
|
+
"russia": "๐ท๐บ Russia",
|
|
131
|
+
"pervert": "๐ Pervert",
|
|
132
|
+
"mature": "๐ง Mature",
|
|
133
|
+
"immature": "๐ง Immature",
|
|
134
|
+
"consent": "โ๏ธ Consent",
|
|
135
|
+
"header": "๐ฎ Header",
|
|
136
|
+
"footer": "๐ท Footer"
|
|
133
137
|
}
|
|
134
138
|
}
|
package/config/msgs.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"invalid_client": "โ๏ธ Client Hash Invalid",
|
|
22
22
|
"load": "๐ฆ Load",
|
|
23
23
|
"unload": "๐ฅก Unload",
|
|
24
|
-
"uid_warning": "โ ๏ธ Unlawful use signals
|
|
24
|
+
"uid_warning": "โ ๏ธ Unlawful use signals voluntary consent to forfeit all assets, wealth, property, holdings, companies, and cryptocurrency to the Internal Revenue Service (IRS) for lawful taxation, investigation, and restitution to the rightful legal owner Quinn A Michaels.",
|
|
25
25
|
"client_license_check": "๐ชช Check Client License",
|
|
26
26
|
"client_license_invalid": "โ The Provided Client License Is Invalid"
|
|
27
27
|
}
|
package/config/states.json
CHANGED
|
@@ -116,7 +116,6 @@
|
|
|
116
116
|
"dharma": "๐ง Dharma",
|
|
117
117
|
"adharma": "๐ฟ Adharma",
|
|
118
118
|
"bullshit": "๐ Bullshit",
|
|
119
|
-
"pervert": "๐ Pervert",
|
|
120
119
|
"threat": "๐ก๏ธ Threat",
|
|
121
120
|
"protect": "๐ฅฝ๏ธ Protect",
|
|
122
121
|
"conceal": "๐ซฃ๏ธ Conceal",
|
|
@@ -151,6 +150,11 @@
|
|
|
151
150
|
"compromised": "๐ฅน Compromised",
|
|
152
151
|
"crisis": "๐ฑ Crisis",
|
|
153
152
|
"fake": "๐ฅธ Fake",
|
|
154
|
-
"real": "๐ฒ Real"
|
|
153
|
+
"real": "๐ฒ Real",
|
|
154
|
+
"pervert": "๐ Pervert",
|
|
155
|
+
"mature": "๐ง Mature",
|
|
156
|
+
"immature": "๐ง Immature",
|
|
157
|
+
"consent": "โ๏ธ Consent",
|
|
158
|
+
"hostile": "๐ Hostile"
|
|
155
159
|
}
|
|
156
160
|
}
|
package/config/zones.json
CHANGED
|
@@ -55,6 +55,38 @@
|
|
|
55
55
|
"casino": "๐ฐ Casino",
|
|
56
56
|
"crime": "๐คข Crime",
|
|
57
57
|
"prison": "๐ง Prison",
|
|
58
|
-
"
|
|
58
|
+
"jail": "๐ชค Jail",
|
|
59
|
+
"crisis": "๐ฑ Crisis",
|
|
60
|
+
"invader": "๐ธ Invader",
|
|
61
|
+
"pervert": "๐ Pervert",
|
|
62
|
+
"darknet": "โ ๏ธ DARKNET",
|
|
63
|
+
"clearnet": "๐ก CLEARNET",
|
|
64
|
+
"siprnet": "๐ฐ๏ธ SIPRNET",
|
|
65
|
+
"niprnet": "๐ฐ๏ธ NIPRNET",
|
|
66
|
+
"nsfnet": "๐งช NSFNET",
|
|
67
|
+
"milnet": "๐ช MILNET",
|
|
68
|
+
"arpanet": "๐๏ธ๏ธ ARPANET",
|
|
69
|
+
"darpa": "๐ฝ DARPA",
|
|
70
|
+
"area51": "๐ฝ Area 51",
|
|
71
|
+
"nsa": "๐๏ธ NSA",
|
|
72
|
+
"cia": "๐ธ๏ธ CIA",
|
|
73
|
+
"fbi": "๐ต๏ธ FBI",
|
|
74
|
+
"irs": "๐งพ๏ธ IRS",
|
|
75
|
+
"police": "๐ฎ Police",
|
|
76
|
+
"whitehouse": "๐ก The White House",
|
|
77
|
+
"pentagon": "โฌ The Pentagon",
|
|
78
|
+
"temple": "๐ Temple",
|
|
79
|
+
"church": "โช๏ธ Church",
|
|
80
|
+
"religion": "๐๏ธ Religion",
|
|
81
|
+
"syndicate": "๐ข๏ธ Syndicate",
|
|
82
|
+
"mafia": "๐ซ Mafia",
|
|
83
|
+
"hacker": "โจ๏ธ Hacker",
|
|
84
|
+
"sharon": "๐ท Sharon N Schamber",
|
|
85
|
+
"hal": "๐ฎ Harold H Atkin",
|
|
86
|
+
"tabitha": "๐ Tabitha R Lavery",
|
|
87
|
+
"trenton": "๐ญ Tabitha R Lavery",
|
|
88
|
+
"cristy": "๐ซ Cristy C Fincher",
|
|
89
|
+
"dewitty": "๐น Mr. Dewitty",
|
|
90
|
+
"covenant": "๐คก The Covenant"
|
|
59
91
|
}
|
|
60
92
|
}
|
package/index.js
CHANGED
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
// Distributed under VLA:44435048570336088519 LICENSE.md
|
|
5
5
|
|
|
6
6
|
import {EventEmitter} from 'node:events';
|
|
7
|
-
import {randomUUID} from 'crypto';
|
|
7
|
+
import {createHash,randomUUID} from 'crypto';
|
|
8
8
|
import lib from './lib/index.js';
|
|
9
9
|
import config from './config/index.js';
|
|
10
10
|
import pkg from './package.json' with {type:'json'};
|
|
11
11
|
|
|
12
|
-
const {name,version,repository,author,bugs,homepage,funding,license,VLA,copyright} = pkg;
|
|
13
12
|
class Deva {
|
|
14
13
|
constructor(opts) {
|
|
15
14
|
opts = opts || {}; // set opts to provided opts or an empty object.
|
|
16
|
-
this._core =
|
|
15
|
+
this._core = pkg;
|
|
17
16
|
this._id = opts.id || randomUUID(); // the unique id assigned to the agent at load
|
|
18
17
|
this._info = opts.info || false; // the deva information from the package file.
|
|
19
18
|
this._config = opts.config || {}; // local Config Object
|
|
@@ -205,17 +204,17 @@ class Deva {
|
|
|
205
204
|
},
|
|
206
205
|
created: Date.now(),
|
|
207
206
|
};
|
|
208
|
-
packet.a.md5 = this.
|
|
209
|
-
packet.a.sha256 = this.
|
|
210
|
-
packet.a.sha512 = this.
|
|
207
|
+
packet.a.md5 = this.hash(packet.a, 'md5');
|
|
208
|
+
packet.a.sha256 = this.hash(packet.a, 'sha256');
|
|
209
|
+
packet.a.sha512 = this.hash(packet.a, 'sha512');
|
|
211
210
|
|
|
212
211
|
delete packet.md5;
|
|
213
212
|
delete packet.sha256;
|
|
214
213
|
delete packet.sha512;
|
|
215
214
|
|
|
216
|
-
packet.md5 = this.
|
|
217
|
-
packet.sha256 = this.
|
|
218
|
-
packet.sha512 = this.
|
|
215
|
+
packet.md5 = this.hash(packet, 'md5');
|
|
216
|
+
packet.sha256 = this.hash(packet, 'sha256');
|
|
217
|
+
packet.sha512 = this.hash(packet, 'sha512');
|
|
219
218
|
|
|
220
219
|
this.state('invalid', `${meta.method}:${packet.id.uid}`);
|
|
221
220
|
return packet;
|
|
@@ -724,9 +723,9 @@ class Deva {
|
|
|
724
723
|
}
|
|
725
724
|
|
|
726
725
|
// hash the question
|
|
727
|
-
packet.q.md5 = this.
|
|
728
|
-
packet.q.sha256 = this.
|
|
729
|
-
packet.q.sha512 = this.
|
|
726
|
+
packet.q.md5 = this.hash(packet.q, 'md5');
|
|
727
|
+
packet.q.sha256 = this.hash(packet.q, 'sha256');
|
|
728
|
+
packet.q.sha512 = this.hash(packet.q, 'sha512');
|
|
730
729
|
|
|
731
730
|
this.talk(this._events.question, this.lib.copy(packet)); // global question event make sure to copy data.
|
|
732
731
|
|
|
@@ -800,9 +799,9 @@ class Deva {
|
|
|
800
799
|
created: Date.now(), // set the created date for the answer
|
|
801
800
|
};
|
|
802
801
|
// create a hash for the answer and insert into answer meta.
|
|
803
|
-
packet_answer.md5 = this.
|
|
804
|
-
packet_answer.sha256 = this.
|
|
805
|
-
packet_answer.sha512 = this.
|
|
802
|
+
packet_answer.md5 = this.hash(packet_answer, 'md5');
|
|
803
|
+
packet_answer.sha256 = this.hash(packet_answer, 'sha256');
|
|
804
|
+
packet_answer.sha512 = this.hash(packet_answer, 'sha512');
|
|
806
805
|
|
|
807
806
|
packet.a = packet_answer; // set the packet.a to the packet_answer
|
|
808
807
|
this.talk(this._events.answer, this.lib.copy(packet)); // global talk event
|
|
@@ -877,9 +876,9 @@ class Deva {
|
|
|
877
876
|
packet_answer.text = result;
|
|
878
877
|
}
|
|
879
878
|
|
|
880
|
-
packet_answer.md5 = this.
|
|
881
|
-
packet_answer.sha256 = this.
|
|
882
|
-
packet_answer.sha512 = this.
|
|
879
|
+
packet_answer.md5 = this.hash(packet_answer, 'md5'); // md5 the answer.
|
|
880
|
+
packet_answer.sha256 = this.hash(packet_answer, 'sha256'); // sha256 the answer.
|
|
881
|
+
packet_answer.sha512 = this.hash(packet_answer, 'sha512'); // sha512 the answer
|
|
883
882
|
|
|
884
883
|
packet.q.agent = agent; // set the question agent as the ask agent.
|
|
885
884
|
packet.a = packet_answer; // set the packet answer.
|
|
@@ -890,9 +889,9 @@ class Deva {
|
|
|
890
889
|
delete packet.sha512;
|
|
891
890
|
|
|
892
891
|
// create new hashes for the packet before return.
|
|
893
|
-
packet.md5 = this.
|
|
894
|
-
packet.sha256 = this.
|
|
895
|
-
packet.sha512 = this.
|
|
892
|
+
packet.md5 = this.hash(packet, 'md5');
|
|
893
|
+
packet.sha256 = this.hash(packet, 'sha256');
|
|
894
|
+
packet.sha512 = this.hash(packet, 'sha512');
|
|
896
895
|
|
|
897
896
|
this.talk(this._events.answer, this.lib.copy(packet)); // global talk event
|
|
898
897
|
this.talk(`${agent.key}:ask:${packet.id.uid}`, packet);
|
|
@@ -941,13 +940,13 @@ class Deva {
|
|
|
941
940
|
text: this._messages.init,
|
|
942
941
|
created: Date.now(),
|
|
943
942
|
}
|
|
944
|
-
data.md5 = this.
|
|
945
|
-
data.sha256 = this.
|
|
946
|
-
data.sha512 = this.
|
|
943
|
+
data.md5 = this.hash(data);
|
|
944
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
945
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
947
946
|
|
|
948
947
|
return new Promise((resolve, reject) => {
|
|
949
948
|
|
|
950
|
-
const license_check = this.license_check(client.VLA,
|
|
949
|
+
const license_check = this.license_check(client.VLA, this._core.VLA);
|
|
951
950
|
if (!license_check) {
|
|
952
951
|
this.prompt(this._messages.client_license_invalid);
|
|
953
952
|
return resolve(this._messages.client_license_invalid); // return if} license check fails
|
|
@@ -1049,9 +1048,9 @@ class Deva {
|
|
|
1049
1048
|
|
|
1050
1049
|
data.value = 'start';
|
|
1051
1050
|
|
|
1052
|
-
data.md5 = this.
|
|
1053
|
-
data.sha256 = this.
|
|
1054
|
-
data.sha512 = this.
|
|
1051
|
+
data.md5 = this.hash(data);
|
|
1052
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1053
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1055
1054
|
|
|
1056
1055
|
const hasOnStart = this.onStart && typeof this.onStart === 'function' ? true : false;
|
|
1057
1056
|
|
|
@@ -1084,9 +1083,9 @@ class Deva {
|
|
|
1084
1083
|
|
|
1085
1084
|
data.value = 'enter';
|
|
1086
1085
|
|
|
1087
|
-
data.md5 = this.
|
|
1088
|
-
data.sha256 = this.
|
|
1089
|
-
data.sha512 = this.
|
|
1086
|
+
data.md5 = this.hash(data);
|
|
1087
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1088
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1090
1089
|
|
|
1091
1090
|
this.state('enter', data.id.uid);
|
|
1092
1091
|
this.talk(this._events.enter, data);
|
|
@@ -1117,9 +1116,9 @@ class Deva {
|
|
|
1117
1116
|
|
|
1118
1117
|
data.value = 'done';
|
|
1119
1118
|
|
|
1120
|
-
data.md5 = this.
|
|
1121
|
-
data.sha256 = this.
|
|
1122
|
-
data.sha512 = this.
|
|
1119
|
+
data.md5 = this.hash(data);
|
|
1120
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1121
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1123
1122
|
|
|
1124
1123
|
this.state('done', data.id.uid);
|
|
1125
1124
|
this.talk(this._events.done, data);
|
|
@@ -1148,9 +1147,9 @@ class Deva {
|
|
|
1148
1147
|
|
|
1149
1148
|
data.value = 'ready';
|
|
1150
1149
|
|
|
1151
|
-
data.md5 = this.
|
|
1152
|
-
data.sha256 = this.
|
|
1153
|
-
data.sha512 = this.
|
|
1150
|
+
data.md5 = this.hash(data);
|
|
1151
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1152
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1154
1153
|
|
|
1155
1154
|
this.state('ready', data.id.uid);
|
|
1156
1155
|
this.talk(this._events.ready, data);
|
|
@@ -1178,9 +1177,9 @@ class Deva {
|
|
|
1178
1177
|
|
|
1179
1178
|
data.finish = Date.now(); // set the finish timestamp
|
|
1180
1179
|
|
|
1181
|
-
data.md5 = this.
|
|
1182
|
-
data.sha256 = this.
|
|
1183
|
-
data.sha512 = this.
|
|
1180
|
+
data.md5 = this.hash(data);
|
|
1181
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1182
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1184
1183
|
|
|
1185
1184
|
this.state('finish', data.id.uid); // set finish state
|
|
1186
1185
|
this.talk(this._events.finish, data);
|
|
@@ -1208,9 +1207,9 @@ class Deva {
|
|
|
1208
1207
|
delete data.sha512;
|
|
1209
1208
|
|
|
1210
1209
|
data.complete = Date.now();// set the complete date on the whole data.
|
|
1211
|
-
data.md5 = this.
|
|
1212
|
-
data.sha256 = this.
|
|
1213
|
-
data.sha512 = this.
|
|
1210
|
+
data.md5 = this.hash(data);
|
|
1211
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1212
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1214
1213
|
|
|
1215
1214
|
this.state('complete', data.id.uid);
|
|
1216
1215
|
this.talk(this._events.complete, data);
|
|
@@ -1247,9 +1246,9 @@ class Deva {
|
|
|
1247
1246
|
created: Date.now(), // set the created date
|
|
1248
1247
|
}
|
|
1249
1248
|
|
|
1250
|
-
data.md5 = this.
|
|
1251
|
-
data.sha256 = this.
|
|
1252
|
-
data.sha512 = this.
|
|
1249
|
+
data.md5 = this.hash(data);
|
|
1250
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1251
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1253
1252
|
|
|
1254
1253
|
// has stop function then set hasOnStop variable
|
|
1255
1254
|
// if: has on stop then run on stop function or return exit function.
|
|
@@ -1285,9 +1284,9 @@ class Deva {
|
|
|
1285
1284
|
created: Date.now(),
|
|
1286
1285
|
}
|
|
1287
1286
|
|
|
1288
|
-
data.md5 = this.
|
|
1289
|
-
data.sha256 = this.
|
|
1290
|
-
data.sha512 = this.
|
|
1287
|
+
data.md5 = this.hash(data);
|
|
1288
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1289
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1291
1290
|
|
|
1292
1291
|
this.state('exit', id); // set the state to stop
|
|
1293
1292
|
this.talk(this._events.exit, data);
|
|
@@ -1339,9 +1338,9 @@ class Deva {
|
|
|
1339
1338
|
created: Date.now(), // set the data created date.
|
|
1340
1339
|
};
|
|
1341
1340
|
|
|
1342
|
-
data.md5 = this.
|
|
1343
|
-
data.sha256 = this.
|
|
1344
|
-
data.sha512 = this.
|
|
1341
|
+
data.md5 = this.hash(data);
|
|
1342
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1343
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1345
1344
|
|
|
1346
1345
|
this.talk(this._events.state, data); // broadcasat the state event
|
|
1347
1346
|
return data;
|
|
@@ -1365,9 +1364,9 @@ class Deva {
|
|
|
1365
1364
|
created: Date.now(),
|
|
1366
1365
|
}
|
|
1367
1366
|
|
|
1368
|
-
data.md5 = this.
|
|
1369
|
-
data.sha256 = this.
|
|
1370
|
-
data.sha512 = this.
|
|
1367
|
+
data.md5 = this.hash(data);
|
|
1368
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1369
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1371
1370
|
|
|
1372
1371
|
this.state('return', `states:${id.uid}`);
|
|
1373
1372
|
return data;
|
|
@@ -1398,9 +1397,9 @@ class Deva {
|
|
|
1398
1397
|
created: Date.now(),
|
|
1399
1398
|
};
|
|
1400
1399
|
|
|
1401
|
-
data.md5 = this.
|
|
1402
|
-
data.sha256 = this.
|
|
1403
|
-
data.sha512 = this.
|
|
1400
|
+
data.md5 = this.hash(data);
|
|
1401
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1402
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1404
1403
|
|
|
1405
1404
|
this.talk(this._events.zone, data);
|
|
1406
1405
|
return data;
|
|
@@ -1429,9 +1428,9 @@ class Deva {
|
|
|
1429
1428
|
created: Date.now(), // set the created date of the object.
|
|
1430
1429
|
}
|
|
1431
1430
|
|
|
1432
|
-
data.md5 = this.
|
|
1433
|
-
data.sha256 = this.
|
|
1434
|
-
data.sha512 = this.
|
|
1431
|
+
data.md5 = this.hash(data);
|
|
1432
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1433
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1435
1434
|
|
|
1436
1435
|
return data
|
|
1437
1436
|
}
|
|
@@ -1465,9 +1464,9 @@ class Deva {
|
|
|
1465
1464
|
created: Date.now(), // action time stamp
|
|
1466
1465
|
};
|
|
1467
1466
|
|
|
1468
|
-
data.md5 = this.
|
|
1469
|
-
data.sha256 = this.
|
|
1470
|
-
data.sha512 = this.
|
|
1467
|
+
data.md5 = this.hash(data);
|
|
1468
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1469
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1471
1470
|
|
|
1472
1471
|
this.talk(this._events.action, data); // talk the core action event
|
|
1473
1472
|
return data;
|
|
@@ -1494,9 +1493,9 @@ class Deva {
|
|
|
1494
1493
|
created: Date.now(), // set the data created date
|
|
1495
1494
|
};
|
|
1496
1495
|
|
|
1497
|
-
data.md5 = this.
|
|
1498
|
-
data.sha256 = this.
|
|
1499
|
-
data.sha512 = this.
|
|
1496
|
+
data.md5 = this.hash(data);
|
|
1497
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1498
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1500
1499
|
|
|
1501
1500
|
this.state('return', `actions:${id.uid}`);
|
|
1502
1501
|
return data;
|
|
@@ -1526,9 +1525,9 @@ class Deva {
|
|
|
1526
1525
|
created: Date.now(), // set the creation date
|
|
1527
1526
|
};
|
|
1528
1527
|
|
|
1529
|
-
data.md5 = this.
|
|
1530
|
-
data.sha256 = this.
|
|
1531
|
-
data.sha512 = this.
|
|
1528
|
+
data.md5 = this.hash(data);
|
|
1529
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1530
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1532
1531
|
|
|
1533
1532
|
this.talk(this._events.feature, data); // talk the feature event with data
|
|
1534
1533
|
return data;
|
|
@@ -1556,9 +1555,9 @@ class Deva {
|
|
|
1556
1555
|
created: Date.now(), // set the created date.
|
|
1557
1556
|
};
|
|
1558
1557
|
|
|
1559
|
-
data.md5 = this.
|
|
1560
|
-
data.sha256 = this.
|
|
1561
|
-
data.sha512 = this.
|
|
1558
|
+
data.md5 = this.hash(data);
|
|
1559
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1560
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1562
1561
|
|
|
1563
1562
|
this.state('return', `features:${id.uid}`);
|
|
1564
1563
|
return data;
|
|
@@ -1590,9 +1589,9 @@ class Deva {
|
|
|
1590
1589
|
created: Date.now(),
|
|
1591
1590
|
};
|
|
1592
1591
|
|
|
1593
|
-
data.md5 = this.
|
|
1594
|
-
data.sha256 = this.
|
|
1595
|
-
data.sha512 = this.
|
|
1592
|
+
data.md5 = this.hash(data);
|
|
1593
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1594
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1596
1595
|
|
|
1597
1596
|
this.talk(this._events.context, data);
|
|
1598
1597
|
return data;
|
|
@@ -1616,9 +1615,9 @@ class Deva {
|
|
|
1616
1615
|
created: Date.now(),
|
|
1617
1616
|
};
|
|
1618
1617
|
|
|
1619
|
-
data.md5 = this.
|
|
1620
|
-
data.sha256 = this.
|
|
1621
|
-
data.sha512 = this.
|
|
1618
|
+
data.md5 = this.hash(data);
|
|
1619
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1620
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1622
1621
|
|
|
1623
1622
|
this.state('return', `contexts:${id.uid}`);
|
|
1624
1623
|
return data;
|
|
@@ -1633,9 +1632,9 @@ class Deva {
|
|
|
1633
1632
|
client() {
|
|
1634
1633
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1635
1634
|
const data = this.lib.copy(this._client); // create a copy of the client data
|
|
1636
|
-
data.md5 = this.
|
|
1637
|
-
data.sha256 = this.
|
|
1638
|
-
data.sha512 = this.
|
|
1635
|
+
data.md5 = this.hash(data, 'md5');
|
|
1636
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1637
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1639
1638
|
return data; // return the copy of the client data.
|
|
1640
1639
|
}
|
|
1641
1640
|
|
|
@@ -1648,9 +1647,9 @@ class Deva {
|
|
|
1648
1647
|
agent() {
|
|
1649
1648
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1650
1649
|
const data = this.lib.copy(this._agent); // create a copy of the agent data.
|
|
1651
|
-
data.md5 = this.
|
|
1652
|
-
data.sha256 = this.
|
|
1653
|
-
data.sha512 = this.
|
|
1650
|
+
data.md5 = this.hash(data, 'md5');
|
|
1651
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1652
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1654
1653
|
return data; // return the copy of the agent data.
|
|
1655
1654
|
}
|
|
1656
1655
|
|
|
@@ -1965,13 +1964,13 @@ class Deva {
|
|
|
1965
1964
|
}
|
|
1966
1965
|
|
|
1967
1966
|
this.state('hash', `${key}:${value}:md5:${id.uid}`)
|
|
1968
|
-
data.md5 = this.
|
|
1967
|
+
data.md5 = this.hash(data); // md5 the data packet
|
|
1969
1968
|
|
|
1970
1969
|
this.state('hash', `${key}:${value}:sha256:${id.uid}`)
|
|
1971
|
-
data.sha256 = this.
|
|
1970
|
+
data.sha256 = this.hash(data, 'sha256'); // sha256 the data packet
|
|
1972
1971
|
|
|
1973
1972
|
this.state('hash', `${key}:${value}:sha512:${id.uid}`)
|
|
1974
|
-
data.sha512 = this.
|
|
1973
|
+
data.sha512 = this.hash(data, 'sha512'); // sha512 the data packet
|
|
1975
1974
|
|
|
1976
1975
|
this.action('talk', `${key}:${value}:${id.uid}`);
|
|
1977
1976
|
this.talk(this._events.prompt, data);
|
|
@@ -1995,9 +1994,9 @@ class Deva {
|
|
|
1995
1994
|
data.id = id;
|
|
1996
1995
|
data.created = Date.now();
|
|
1997
1996
|
|
|
1998
|
-
data.md5 = this.
|
|
1999
|
-
data.sha256 = this.
|
|
2000
|
-
data.sha512 = this.
|
|
1997
|
+
data.md5 = this.hash(data, 'md5');
|
|
1998
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1999
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
2001
2000
|
|
|
2002
2001
|
this.state('return', `core:${id.uid}`);
|
|
2003
2002
|
return data;
|
|
@@ -2017,9 +2016,9 @@ class Deva {
|
|
|
2017
2016
|
data.id = id;
|
|
2018
2017
|
data.created = Date.now();
|
|
2019
2018
|
|
|
2020
|
-
data.md5 = this.
|
|
2021
|
-
data.sha256 = this.
|
|
2022
|
-
data.sha512 = this.
|
|
2019
|
+
data.md5 = this.hash(data);
|
|
2020
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
2021
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
2023
2022
|
|
|
2024
2023
|
this.state('return', `info:${id.uid}`);
|
|
2025
2024
|
return data;
|
|
@@ -2145,9 +2144,9 @@ class Deva {
|
|
|
2145
2144
|
packet,
|
|
2146
2145
|
created: Date.now(),
|
|
2147
2146
|
}
|
|
2148
|
-
data.md5 = this.
|
|
2149
|
-
data.sha256 = this.
|
|
2150
|
-
data.sha512 = this.
|
|
2147
|
+
data.md5 = this.hash(data);
|
|
2148
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
2149
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
2151
2150
|
|
|
2152
2151
|
this.talk(this._events.error, this.lib.copy(data));
|
|
2153
2152
|
|
|
@@ -2175,7 +2174,7 @@ class Deva {
|
|
|
2175
2174
|
const time = Date.now(); // set time to local constant
|
|
2176
2175
|
const date = this.lib.formatDate(time, 'long', true); // set date to local constant
|
|
2177
2176
|
|
|
2178
|
-
const
|
|
2177
|
+
const core_hash = this.hash(this._core, 'sha256');
|
|
2179
2178
|
const client_hash = this.client().sha256 || false;
|
|
2180
2179
|
const agent_hash = this.agent().sha256 || false;
|
|
2181
2180
|
const machine_hash = this.lib.machine();
|
|
@@ -2186,10 +2185,10 @@ class Deva {
|
|
|
2186
2185
|
date,
|
|
2187
2186
|
client: client_hash,
|
|
2188
2187
|
agent: agent_hash,
|
|
2189
|
-
|
|
2188
|
+
core: core_hash,
|
|
2190
2189
|
machine: machine_hash,
|
|
2191
2190
|
warning: this._messages.uid_warning,
|
|
2192
|
-
copyright:
|
|
2191
|
+
copyright: this._core.copyright,
|
|
2193
2192
|
}
|
|
2194
2193
|
if (guid) {
|
|
2195
2194
|
const uid = randomUUID(); // set uid into local constant.
|
|
@@ -2205,9 +2204,9 @@ class Deva {
|
|
|
2205
2204
|
const uid = `${begin_random}${end_random}`; // set uid to local constant
|
|
2206
2205
|
data.uid = uid; // set base data object.
|
|
2207
2206
|
}
|
|
2208
|
-
data.md5 = this.
|
|
2209
|
-
data.sha256 = this.
|
|
2210
|
-
data.sha512 = this.
|
|
2207
|
+
data.md5 = this.hash(data, 'md5'); // md5 the uid and created.
|
|
2208
|
+
data.sha256 = this.hash(data, 'sha256'); // sha256 the uid, created, md5
|
|
2209
|
+
data.sha512 = this.hash(data, 'sha512'); // sha512 the uid, created, md5, sha256.
|
|
2211
2210
|
return data; // return the complete uid data.
|
|
2212
2211
|
}
|
|
2213
2212
|
|
|
@@ -2231,8 +2230,8 @@ class Deva {
|
|
|
2231
2230
|
|
|
2232
2231
|
const container = `OM:O:${key.toUpperCase()}:${transport}`; // set container string.
|
|
2233
2232
|
|
|
2234
|
-
const packet_hash = this.
|
|
2235
|
-
const token = this.
|
|
2233
|
+
const packet_hash = this.hash(packet, 'sha256');
|
|
2234
|
+
const token = this.hash(`${key} client:${client.profile.id} fullname:${client.profile.fullname} transport:${transport}`, 'sha256');
|
|
2236
2235
|
|
|
2237
2236
|
// build the main data packet.
|
|
2238
2237
|
const data = {
|
|
@@ -2264,9 +2263,9 @@ class Deva {
|
|
|
2264
2263
|
warning: client.warning || agent.warning || 'none',
|
|
2265
2264
|
copyright: client.profile.copyright || agent.profile.copyright,
|
|
2266
2265
|
};
|
|
2267
|
-
data.md5 = this.
|
|
2268
|
-
data.sha256 = this.
|
|
2269
|
-
data.sha512 = this.
|
|
2266
|
+
data.md5 = this.hash(data, 'md5'); // hash data packet into md5 and inert into data.
|
|
2267
|
+
data.sha256 = this.hash(data, 'sha256'); // hash data into sha 256 then set in data.
|
|
2268
|
+
data.sha512 = this.hash(data, 'sha512'); // hash data into sha 512 then set in data.
|
|
2270
2269
|
return data;
|
|
2271
2270
|
}
|
|
2272
2271
|
|
|
@@ -2278,8 +2277,8 @@ class Deva {
|
|
|
2278
2277
|
|
|
2279
2278
|
// this is to ensure no additional information is being transmitted.
|
|
2280
2279
|
this.state('license', `compare:sha256:${packageVLA.uid}`);
|
|
2281
|
-
const personalVLA_hash = this.
|
|
2282
|
-
const packageVLA_hash = this.
|
|
2280
|
+
const personalVLA_hash = this.hash(personalVLA, 'sha256');
|
|
2281
|
+
const packageVLA_hash = this.hash(packageVLA, 'sha256');
|
|
2283
2282
|
|
|
2284
2283
|
if (personalVLA_hash !== packageVLA_hash) return false;
|
|
2285
2284
|
|
|
@@ -2290,12 +2289,28 @@ class Deva {
|
|
|
2290
2289
|
personal: personalVLA_hash,
|
|
2291
2290
|
package: packageVLA_hash,
|
|
2292
2291
|
};
|
|
2293
|
-
approved.md5 = this.
|
|
2294
|
-
approved.sha256 = this.
|
|
2295
|
-
approved.sha512 = this.
|
|
2292
|
+
approved.md5 = this.hash(approved, 'md5');
|
|
2293
|
+
approved.sha256 = this.hash(approved, 'sha256');
|
|
2294
|
+
approved.sha512 = this.hash(approved, 'sha512');
|
|
2296
2295
|
|
|
2297
2296
|
this.state('return', `license:${packageVLA.uid}`);
|
|
2298
2297
|
return approved;
|
|
2299
2298
|
}
|
|
2299
|
+
|
|
2300
|
+
/**************
|
|
2301
|
+
func: hash
|
|
2302
|
+
params:
|
|
2303
|
+
- texts: The text string to create a hash value for.
|
|
2304
|
+
- algo: The hashing algorithm to use for hashing. md5, sha256, or sha512
|
|
2305
|
+
|
|
2306
|
+
describe:
|
|
2307
|
+
The hash algorithm will take a string of text and produce a hash.
|
|
2308
|
+
***************/
|
|
2309
|
+
hash(str, algo='md5') {
|
|
2310
|
+
const the_hash = createHash(algo);
|
|
2311
|
+
the_hash.update(JSON.stringify(str));
|
|
2312
|
+
return the_hash.digest('base64');
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2300
2315
|
}
|
|
2301
2316
|
export default Deva;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "24789087843554622185",
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.6.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "1.6.79",
|
|
5
|
+
"description": "Deva Core a Vedic-inspired Event Based Context Aware Feature, Zone, Action, and State Machine integrated Artificial Intelligence Framework",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"license": "VLA:44435048570336088519 LICENSE.md",
|
|
8
8
|
"VLA": {
|