@indra.ai/deva 1.6.19 β 1.6.21
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/index.js +3 -3
- package/lib/index.js +55 -0
- package/package.json +15 -12
package/index.js
CHANGED
|
@@ -1889,7 +1889,7 @@ class Deva {
|
|
|
1889
1889
|
describe: This function will enable fast loading of Deva into the system.
|
|
1890
1890
|
***************/
|
|
1891
1891
|
load(key, client) {
|
|
1892
|
-
this.zone('
|
|
1892
|
+
this.zone('load', key);
|
|
1893
1893
|
this.action('load', key);
|
|
1894
1894
|
this.state('load', key);
|
|
1895
1895
|
return this.devas[key].init(client);
|
|
@@ -1905,12 +1905,12 @@ class Deva {
|
|
|
1905
1905
|
this.zone('unload', key);
|
|
1906
1906
|
return new Promise((resolve, reject) => {
|
|
1907
1907
|
try {
|
|
1908
|
-
this.action('
|
|
1908
|
+
this.action('unload', key);
|
|
1909
1909
|
this.devas[key].stop().then(exit => {
|
|
1910
1910
|
delete this.devas[key];
|
|
1911
1911
|
this.talk(config.events.unload, key);
|
|
1912
1912
|
});
|
|
1913
|
-
this.state('unload', key)
|
|
1913
|
+
this.state('unload', key);
|
|
1914
1914
|
return resolve(`${this._states.unload}:${key}`);
|
|
1915
1915
|
} catch (e) {
|
|
1916
1916
|
return this.err(e, this.devas[key], reject)
|
package/lib/index.js
CHANGED
|
@@ -113,6 +113,61 @@ class LIB {
|
|
|
113
113
|
return data; // return the complete uid data.
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
sign(packet, concerns) {
|
|
117
|
+
const {q, id} = packet;
|
|
118
|
+
|
|
119
|
+
const {meta, agent, client, text} = q;
|
|
120
|
+
const agent_hash = this.hash(agent, 'sha256');
|
|
121
|
+
const client_hash = this.hash(client, 'sha256');
|
|
122
|
+
|
|
123
|
+
const {key, method, params} = meta;
|
|
124
|
+
const opts = this.lib.copy(params); // copy the params and set as opts.
|
|
125
|
+
|
|
126
|
+
const transport = id.uid; // set the transport id from the packet id.
|
|
127
|
+
const created = this.formatDate(time, 'long', true); // Formatted created date.
|
|
128
|
+
const expires = time + (client.expires || agent.expires || 10000); // signature expires in milliseconds
|
|
129
|
+
const command = opts.shift(); // extract the command first array item out of opts.
|
|
130
|
+
const container = `O:${key.toUpperCase()}:${transport}`; // set container string.
|
|
131
|
+
const {write} = client.profile; // set write string.
|
|
132
|
+
const packet_hash = this.hash(packet, 'sha256');
|
|
133
|
+
const laws_hash = this.hash(agent.laws || client.laws, 'sha256');
|
|
134
|
+
const token = this.hash(`${key} client:${client.profile.id} fullname:${client.profile.fullname} transport:${transport}`, 'sha256');
|
|
135
|
+
|
|
136
|
+
const data = {
|
|
137
|
+
id,
|
|
138
|
+
key,
|
|
139
|
+
method,
|
|
140
|
+
transport,
|
|
141
|
+
time,
|
|
142
|
+
expires,
|
|
143
|
+
container,
|
|
144
|
+
write,
|
|
145
|
+
message,
|
|
146
|
+
caseid: client.profile.caseid || false,
|
|
147
|
+
opts: opts.length? `.${opts.join('.')}` : '',
|
|
148
|
+
name: client.profile.name,
|
|
149
|
+
fullname: client.profile.fullname,
|
|
150
|
+
emojis: client.profile.emojis,
|
|
151
|
+
company: client.profile.company,
|
|
152
|
+
client: client_hash,
|
|
153
|
+
agent: agent_hash,
|
|
154
|
+
packet: packet_hash,
|
|
155
|
+
laws: laws_hash,
|
|
156
|
+
warning: client.warning || agent.warning || 'none',
|
|
157
|
+
token,
|
|
158
|
+
concerns,
|
|
159
|
+
meta,
|
|
160
|
+
params,
|
|
161
|
+
command,
|
|
162
|
+
created,
|
|
163
|
+
copyright: client.copyright || agent.copyright,
|
|
164
|
+
};
|
|
165
|
+
data.md5 = this.lib.hash(data, 'md5'); // hash data packet into md5 and inert into data.
|
|
166
|
+
data.sha256 = this.lib.hash(data, 'sha256'); // hash data into sha 256 then set in data.
|
|
167
|
+
data.sha512 = this.lib.hash(data, 'sha512'); // hash data into sha 512 then set in data.
|
|
168
|
+
return data;
|
|
169
|
+
}
|
|
170
|
+
|
|
116
171
|
/**************
|
|
117
172
|
func: hash
|
|
118
173
|
params:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": 55286864875635310000,
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.21",
|
|
5
5
|
"description": "The Deva Core",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"license": "VLA:15127963876514842820 LICENSE.md",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
"question": "πββοΈ Question",
|
|
113
113
|
"answer": "π¨βπ« Answer",
|
|
114
114
|
"ask": "π£ Ask",
|
|
115
|
-
"load": "
|
|
116
|
-
"unload": "
|
|
115
|
+
"load": "π¦ Load",
|
|
116
|
+
"unload": "π₯‘ Unload",
|
|
117
117
|
"init": "π Init",
|
|
118
118
|
"start": "π’ Start",
|
|
119
119
|
"enter": "πͺ Enter",
|
|
@@ -185,10 +185,8 @@
|
|
|
185
185
|
"close": "π¦ Close",
|
|
186
186
|
"begin": "πΊοΈ Begin",
|
|
187
187
|
"end": "π¬ End",
|
|
188
|
-
"load": "
|
|
189
|
-
"unload": "
|
|
190
|
-
"resolve": "π€ Resolve",
|
|
191
|
-
"reject": "π§± Reject",
|
|
188
|
+
"load": "π¦ Load",
|
|
189
|
+
"unload": "π₯‘ Unload",
|
|
192
190
|
"create": "π¨ Create",
|
|
193
191
|
"destroy": "π£ Destroy",
|
|
194
192
|
"write": "π Write",
|
|
@@ -222,10 +220,6 @@
|
|
|
222
220
|
"try": "πΈ Try",
|
|
223
221
|
"catch": "βΎοΈ Catch",
|
|
224
222
|
"view": "π View",
|
|
225
|
-
"insert": "π Insert",
|
|
226
|
-
"update": "π Update",
|
|
227
|
-
"delete": "ποΈ Delete",
|
|
228
|
-
"return": "π€Ώ Return",
|
|
229
223
|
"hash": "#οΈβ£ Hash",
|
|
230
224
|
"license": "πͺͺ License",
|
|
231
225
|
"indra": "π« Indra",
|
|
@@ -309,7 +303,14 @@
|
|
|
309
303
|
"done": "βοΈ Done",
|
|
310
304
|
"ready": "βοΈ Ready",
|
|
311
305
|
"complete": "β
Complete",
|
|
312
|
-
"
|
|
306
|
+
"insert": "π Insert",
|
|
307
|
+
"update": "π Update",
|
|
308
|
+
"delete": "ποΈ Delete",
|
|
309
|
+
"return": "π€Ώ Return",
|
|
310
|
+
"parse": "π© Parse",
|
|
311
|
+
"resolve": "π€ Resolve",
|
|
312
|
+
"reject": "π§± Reject",
|
|
313
|
+
"sign": "βοΈοΈ Sign"
|
|
313
314
|
},
|
|
314
315
|
"feature": false,
|
|
315
316
|
"features": {
|
|
@@ -355,6 +356,8 @@
|
|
|
355
356
|
"nopacket": "βοΈ NO PACKET PROVIDED",
|
|
356
357
|
"method_not_found": "βοΈ METHOD NOT FOUND",
|
|
357
358
|
"help_not_found": "βοΈ HELP NOT FOUND",
|
|
359
|
+
"load": "π¦ Load",
|
|
360
|
+
"unload": "π₯‘ Unload",
|
|
358
361
|
"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."
|
|
359
362
|
}
|
|
360
363
|
}
|