@indra.ai/deva.guard 0.0.32 → 0.0.34
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/feature/methods.js +1 -252
- package/index.js +17 -11
- package/package.json +2 -2
package/feature/methods.js
CHANGED
|
@@ -48,139 +48,7 @@ export default {
|
|
|
48
48
|
});
|
|
49
49
|
},
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
method: proxy
|
|
53
|
-
params: packet
|
|
54
|
-
describe: Return authorized VectorGuardProxy for requesting client.
|
|
55
|
-
copyright: ©2025 Quinn A Michaels. All rights reserved.
|
|
56
|
-
**/
|
|
57
|
-
async proxy(packet) {
|
|
58
|
-
this.state('set', `transport:${packet.id}`);
|
|
59
|
-
const transport = packet.id; // set the transport id from the packet id.
|
|
60
|
-
|
|
61
|
-
this.zone('guard', transport); // set the current zone to guard
|
|
62
|
-
this.feature('guard', transport); // set the Guard feature.
|
|
63
|
-
this.context('proxy', transport); // set the agent context to proxy.
|
|
64
|
-
this.action('method', `proxy:${transport}`); // set the action method to proxy.
|
|
65
|
-
|
|
66
|
-
this.state('set', `uid:${transport}`); //set the uid state for the proxy
|
|
67
|
-
const uid = this.lib.uid(true); // The UID for the proxy
|
|
68
|
-
this.state('set', `time:${transport}`); //set the time state for the proxy
|
|
69
|
-
const time = Date.now(); // current timestamp
|
|
70
|
-
this.state('created', `created:${transport}`); //set the uid state for the proxy
|
|
71
|
-
const created = this.lib.formatDate(time, 'long', true); // Formatted created date.
|
|
72
|
-
|
|
73
|
-
this.state('set', `guard:${transport}`); //set the guard state for the proxy
|
|
74
|
-
const guard = this.guard(); // load the Guard profile
|
|
75
|
-
const {concerns} = guard; // load concerns from client guard profile.
|
|
76
|
-
|
|
77
|
-
this.state('set', `agent:${transport}`); //set the agent state for the proxy
|
|
78
|
-
const agent = this.agent(); // the agent processing the proxy
|
|
79
|
-
|
|
80
|
-
this.state('set', `client:${transport}`); //set the client state for the proxy
|
|
81
|
-
const client = this.client(); // the client requesting the proxy
|
|
82
|
-
|
|
83
|
-
this.state('set', `meta:${transport}`); //set the meta state for the proxy
|
|
84
|
-
const {meta} = packet.q; // set the meta information from the packet question.
|
|
85
|
-
|
|
86
|
-
this.state('set', `params:${transport}`); //set the meta state for the proxy
|
|
87
|
-
const {params} = meta; // set params from the meta information.
|
|
88
|
-
|
|
89
|
-
this.state('set', `opts:${transport}`); //set the opts state for the proxy
|
|
90
|
-
const opts = this.lib.copy(params); // copy the params and set as opts.
|
|
91
|
-
|
|
92
|
-
this.state('set', `command:${transport}`); //set the opts state for the proxy
|
|
93
|
-
const command = opts.shift(); // extract the command first array item out of opts.
|
|
94
|
-
|
|
95
|
-
this.state('set', `message:${transport}`); //set the message state for the proxy
|
|
96
|
-
const message = packet.q.text; // set packet.q.text as the message of the proxy.
|
|
97
|
-
|
|
98
|
-
this.state('set', `write:${transport}`); //set the message state for the proxy
|
|
99
|
-
const write = `OM:${client.profile.write.split(' ').join(':').toUpperCase()}:PROXY`; // set proxy write string.
|
|
100
|
-
|
|
101
|
-
// hash the agent profile for security
|
|
102
|
-
this.state('hash', `agent profile:${transport}`);
|
|
103
|
-
const agent_profile = this.lib.hash(agent.profile, 'sha256');
|
|
104
|
-
|
|
105
|
-
// hash the agent profile for security
|
|
106
|
-
this.state('hash', `client profile:${transport}`);
|
|
107
|
-
const client_profile = this.lib.hash(client.profile, 'sha256');
|
|
108
|
-
|
|
109
|
-
// hash the agent profile for security
|
|
110
|
-
this.state('hash', `token:${transport}`);
|
|
111
|
-
const token = this.lib.hash(`${client.profile.token} PROXY ${transport}`, 'sha256');
|
|
112
|
-
|
|
113
|
-
this.state('set', `data:${transport}`); // set the state to set data
|
|
114
|
-
// data packet
|
|
115
|
-
const data = {
|
|
116
|
-
uid,
|
|
117
|
-
transport,
|
|
118
|
-
time,
|
|
119
|
-
write,
|
|
120
|
-
message,
|
|
121
|
-
caseid: client.profile.caseid,
|
|
122
|
-
opts: opts.length? `:${opts.join(':')}` : '',
|
|
123
|
-
agent: agent_profile,
|
|
124
|
-
client: client_profile,
|
|
125
|
-
name: client.profile.name,
|
|
126
|
-
emojis: client.profile.emojis,
|
|
127
|
-
company: client.profile.company,
|
|
128
|
-
warning: client.profile.warning,
|
|
129
|
-
token,
|
|
130
|
-
concerns,
|
|
131
|
-
meta,
|
|
132
|
-
params,
|
|
133
|
-
command,
|
|
134
|
-
created,
|
|
135
|
-
copyright: client.profile.copyright,
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
this.state('hash', `md5:${transport}`); // set state to secure hashing
|
|
139
|
-
data.md5 = this.lib.hash(data, 'md5'); // hash data packet into md5 and inert into data.
|
|
140
|
-
|
|
141
|
-
this.state('hash', `sha256:${transport}`); // set state to secure hashing
|
|
142
|
-
data.sha256 = this.lib.hash(data, 'sha256'); // hash data into sha 256 then set in data.
|
|
143
|
-
|
|
144
|
-
this.state('hash', `sha512:${transport}`); // set state to secure hashing
|
|
145
|
-
data.sha512 = this.lib.hash(data, 'sha512'); // hash data into sha 512 then set in data.
|
|
146
|
-
|
|
147
|
-
// Text data that is joined by line breaks and then trimmed.
|
|
148
|
-
this.state('set', `text:${transport}`); // set state to text for output formatting.
|
|
149
|
-
const text = [
|
|
150
|
-
`:::`,
|
|
151
|
-
`::BEGIN:${data.write}:${data.transport}`,
|
|
152
|
-
`#VectorGuardProxy${data.opts} ${data.message}`,
|
|
153
|
-
`::begin:vector:guard:proxy:${transport}:${data.emojis}`,
|
|
154
|
-
`transport: ${data.transport}`,
|
|
155
|
-
`time: ${data.time}`,
|
|
156
|
-
`caseid: ${data.caseid}`,
|
|
157
|
-
`agent: ${data.agent}`,
|
|
158
|
-
`client: ${data.client}`,
|
|
159
|
-
`name: ${data.name}`,
|
|
160
|
-
`company: ${data.company}`,
|
|
161
|
-
`token: ${data.token}`,
|
|
162
|
-
`warning: ${data.warning}`,
|
|
163
|
-
`created: ${data.created}`,
|
|
164
|
-
`copyright: ${data.copyright}`,
|
|
165
|
-
`md5: ${data.md5}`,
|
|
166
|
-
`sha256: ${data.sha256}`,
|
|
167
|
-
`sha512: ${data.sha512}`,
|
|
168
|
-
`::end:vector:guard:proxy:${data.transport}:${data.emojis}`,
|
|
169
|
-
`::END:${data.write}:${data.transport}`,
|
|
170
|
-
].join('\n').trim();
|
|
171
|
-
|
|
172
|
-
// send the text data to #feecting to parse and return valid text, html, and data.
|
|
173
|
-
this.action('question', `feecting:parse:${transport}`); // action set to feecting parse
|
|
174
|
-
const feecting = await this.question(`${this.askChr}feecting parse:${transport} ${text}`); // parse with feecting agent.
|
|
175
|
-
|
|
176
|
-
this.state('return', `proxy:${transport}`); // set the state to return proxy
|
|
177
|
-
return {
|
|
178
|
-
text: feecting.a.text,
|
|
179
|
-
html: feecting.a.html,
|
|
180
|
-
data,
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
|
|
51
|
+
|
|
184
52
|
/**
|
|
185
53
|
method: shield
|
|
186
54
|
params: packet
|
|
@@ -312,124 +180,5 @@ export default {
|
|
|
312
180
|
}
|
|
313
181
|
},
|
|
314
182
|
|
|
315
|
-
async wall(packet) {
|
|
316
|
-
this.state('set', `transport:${packet.id}`);
|
|
317
|
-
const transport = packet.id; // set the transport from packet.id
|
|
318
|
-
|
|
319
|
-
this.zone('wall', transport); // set the current zone to wall
|
|
320
|
-
this.feature('wall', transport); // set the Wall feature.
|
|
321
|
-
this.context('wall', transport); // set context to shield
|
|
322
|
-
this.action('method', `wall:${transport}`); // action set to shield
|
|
323
|
-
|
|
324
|
-
this.state('set', `uid:${transport}`); //set the uid state for the proxy
|
|
325
|
-
const uid = this.lib.uid(true); // The UID for the proxy
|
|
326
|
-
this.state('set', `time:${transport}`); //set the time state for the proxy
|
|
327
|
-
const time = Date.now(); // current timestamp
|
|
328
|
-
this.state('created', `created:${transport}`); //set the uid state for the proxy
|
|
329
|
-
const created = this.lib.formatDate(time, 'long', true); // Formatted created date.
|
|
330
|
-
|
|
331
|
-
this.state('set', `wall:${transport}`); //set the wall state for the proxy
|
|
332
|
-
const guard = this.guard(); // load the Guard profile
|
|
333
|
-
const {concerns} = guard; // load concerns from client guard profile.
|
|
334
|
-
|
|
335
|
-
this.state('set', `agent:${transport}`); //set the agent state for the proxy
|
|
336
|
-
const agent = this.agent(); // the agent processing the proxy
|
|
337
|
-
|
|
338
|
-
this.state('set', `client:${transport}`); //set the client state for the proxy
|
|
339
|
-
const client = this.client(); // the client requesting the proxy
|
|
340
|
-
const {profile} = client; // set the client profile
|
|
341
|
-
|
|
342
|
-
this.state('set', `meta:${transport}`); //set the meta state for the proxy
|
|
343
|
-
const {meta} = packet.q; // set the meta information from the packet question.
|
|
344
|
-
const {params} = meta; // set params from the meta information.
|
|
345
|
-
|
|
346
|
-
this.state('set', `opts:${transport}`); //set the opts state for the proxy
|
|
347
|
-
const opts = this.lib.copy(params); // copy the params and set as opts.
|
|
348
|
-
|
|
349
|
-
this.state('set', `command:${transport}`); //set the opts state for the proxy
|
|
350
|
-
const command = opts.shift(); // extract the command first array item out of opts.
|
|
351
|
-
|
|
352
|
-
this.state('set', `message:${transport}`); //set the message state for the proxy
|
|
353
|
-
const message = packet.q.text; // set packet.q.text as the message of the proxy.
|
|
354
|
-
|
|
355
|
-
this.state('set', `profile:${transport}`); //set the profile constants state for the proxy
|
|
356
|
-
const {name, fullname, nickname, title, write, religion, companies, ssn, emojis, warning, computer, hardware, provision, network, caseid, token, copyright} = profile; // constants saved from profile.
|
|
357
|
-
|
|
358
|
-
this.state('set', `data:${transport}`); // set the state to set data
|
|
359
|
-
// data packet
|
|
360
|
-
const data = {
|
|
361
|
-
uid,
|
|
362
|
-
transport,
|
|
363
|
-
opts: opts.length? `:${opts.join(':')}` : '',
|
|
364
|
-
time,
|
|
365
|
-
agent,
|
|
366
|
-
client,
|
|
367
|
-
name,
|
|
368
|
-
fullname,
|
|
369
|
-
nickname,
|
|
370
|
-
title,
|
|
371
|
-
write,
|
|
372
|
-
emojis,
|
|
373
|
-
warning,
|
|
374
|
-
religion,
|
|
375
|
-
companies,
|
|
376
|
-
message,
|
|
377
|
-
ssn,
|
|
378
|
-
computer,
|
|
379
|
-
hardware,
|
|
380
|
-
provision,
|
|
381
|
-
network,
|
|
382
|
-
caseid,
|
|
383
|
-
concerns,
|
|
384
|
-
token,
|
|
385
|
-
copyright,
|
|
386
|
-
created,
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
this.state('hash', `md5:${transport}`); // set state to hash hashing
|
|
390
|
-
data.md5 = this.lib.hash(data, 'md5'); // hash data packet into md5 and inert into data.
|
|
391
|
-
|
|
392
|
-
this.state('hash', `sha256:${transport}`); // set state to hash hashing
|
|
393
|
-
data.sha256 = this.lib.hash(data, 'sha256'); // hash data into sha 256 then set in data.
|
|
394
|
-
|
|
395
|
-
this.state('hash', `sha512:${transport}`); // set state to hash hashing
|
|
396
|
-
data.sha512 = this.lib.hash(data, 'sha512'); // hash data into sha 512 then set in data.
|
|
397
|
-
|
|
398
|
-
this.state('set', `writestr:${transport}`);
|
|
399
|
-
const writestr = data.write.split(' ').join(':').toUpperCase();
|
|
400
|
-
|
|
401
|
-
const text = [
|
|
402
|
-
'::::',
|
|
403
|
-
`::BEGIN:${writestr}:WALL:${transport}:${data.emojis}`,
|
|
404
|
-
`#VectorGuardWall${data.opts} ${data.message}`,
|
|
405
|
-
`::begin:VectorGuardWall:${data.transport}`,
|
|
406
|
-
`transport: ${data.transport}`,
|
|
407
|
-
`agent: ${agent.profile.id}`,
|
|
408
|
-
`client: ${client.profile.id}`,
|
|
409
|
-
`name: ${data.name}`,
|
|
410
|
-
`fullname: ${data.fullname}`,
|
|
411
|
-
`nickname: ${data.nickname}`,
|
|
412
|
-
`title: ${data.title}`,
|
|
413
|
-
`token: ${data.token}`,
|
|
414
|
-
`case: ${data.caseid}`,
|
|
415
|
-
`time: ${data.time}`,
|
|
416
|
-
`created: ${data.created}`,
|
|
417
|
-
`copyright: ${data.copyright}`,
|
|
418
|
-
`md5: ${data.md5}`,
|
|
419
|
-
`sha256: ${data.sha256}`,
|
|
420
|
-
`sha512: ${data.sha512}`,
|
|
421
|
-
`::end:VectorGuardWall:${data.transport}`,
|
|
422
|
-
`::END:${writestr}:WALL:${transport}:${data.emojis}`,
|
|
423
|
-
].join('\n').trim();
|
|
424
|
-
|
|
425
|
-
// send the text data to #feecting to parse and return valid text, html, and data.
|
|
426
|
-
this.action('question', `feecting:parse:${transport}`); // action set to feecting parse
|
|
427
|
-
const feecting = await this.question(`${this.askChr}feecting parse ${text}`);
|
|
428
|
-
return {
|
|
429
|
-
text: feecting.a.text,
|
|
430
|
-
html: feecting.a.html,
|
|
431
|
-
data,
|
|
432
|
-
}
|
|
433
|
-
},
|
|
434
183
|
|
|
435
184
|
};
|
package/index.js
CHANGED
|
@@ -36,22 +36,22 @@ const GUARD = new Deva({
|
|
|
36
36
|
},
|
|
37
37
|
listeners: {
|
|
38
38
|
'devacore:question'(packet) {
|
|
39
|
-
this.func.
|
|
39
|
+
this.func.echo(packet.q);
|
|
40
40
|
},
|
|
41
41
|
'devacore:answer'(packet) {
|
|
42
|
-
this.func.
|
|
42
|
+
this.func.echo(packet.a);
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
modules: {},
|
|
46
46
|
deva: {},
|
|
47
47
|
func: {
|
|
48
|
-
|
|
48
|
+
echo(opts) {
|
|
49
49
|
const {id, agent, client, md5, sha256, sha512} = opts;
|
|
50
50
|
const created = Date.now();
|
|
51
51
|
|
|
52
|
-
this.action('func', `
|
|
53
|
-
this.state('set', `
|
|
54
|
-
const
|
|
52
|
+
this.action('func', `echo:${id}`);
|
|
53
|
+
this.state('set', `echo:${id}`);
|
|
54
|
+
const echo_data = [
|
|
55
55
|
`::begin:guard:${id}`,
|
|
56
56
|
`transport: ${id}`,
|
|
57
57
|
`client: ${client.profile.id}`,
|
|
@@ -61,16 +61,22 @@ const GUARD = new Deva({
|
|
|
61
61
|
`sha256:${sha256}`,
|
|
62
62
|
`sha512:${sha512}`,
|
|
63
63
|
`::end:guard:${id}`,
|
|
64
|
-
].join('\
|
|
64
|
+
].join('\n');
|
|
65
65
|
|
|
66
66
|
// stub for later features right now just echo into the system process for SIGINT monitoring.
|
|
67
|
-
const echo = spawn('echo', [
|
|
67
|
+
const echo = spawn('echo', [echo_data])
|
|
68
|
+
echo.stdout.on('data', data => {
|
|
69
|
+
this.state('data', `echo:stdout:${id}`);
|
|
70
|
+
});
|
|
68
71
|
echo.stderr.on('data', err => {
|
|
72
|
+
this.state('error', `echo:stderr:${id}`);
|
|
69
73
|
this.error(err, opts);
|
|
70
74
|
});
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
echo.on('close', data => {
|
|
76
|
+
this.state('close', `echo:${id}`);
|
|
77
|
+
});
|
|
78
|
+
this.state('return', `echo:${id}`);
|
|
79
|
+
return echo_data;
|
|
74
80
|
}
|
|
75
81
|
},
|
|
76
82
|
methods: {},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": 6159528221394,
|
|
3
3
|
"name": "@indra.ai/deva.guard",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.34",
|
|
5
5
|
"author": "Quinn Michaels",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"copyright": "2025",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://deva.space/devas/guard",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@indra.ai/deva": "^1.5.
|
|
30
|
+
"@indra.ai/deva": "^1.5.46"
|
|
31
31
|
},
|
|
32
32
|
"data": {
|
|
33
33
|
"agent": {
|