@indra.ai/deva.vector 0.0.7 → 0.0.8
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 +59 -41
- package/package.json +1 -1
package/feature/methods.js
CHANGED
|
@@ -1,61 +1,69 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
async vector(packet) {
|
|
3
|
-
this.
|
|
3
|
+
const vector = await this.methods.sign('vector', 'default', packet);
|
|
4
|
+
return vector;
|
|
5
|
+
},
|
|
6
|
+
|
|
7
|
+
async sign(key, type, packet) {
|
|
8
|
+
this.state('set', `${key}:sign:${type}:${packet.id}`);
|
|
4
9
|
const transport = packet.id; // set the transport id from the packet id.
|
|
10
|
+
|
|
11
|
+
this.prompt(`sign ${key}`);
|
|
12
|
+
|
|
13
|
+
this.zone(key, `${key}:sign:${type}:${transport}`); // set the zone
|
|
14
|
+
this.feature(key, `${key}:sign:${type}:${transport}`); // set the feature
|
|
15
|
+
this.context(key, `${key}:sign:${type}:${transport}`); // set the agent context to proxy.
|
|
16
|
+
this.action('method', `${key}:sign:${type}:${transport}`); // set the action method to proxy.
|
|
5
17
|
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
8
|
-
this.context('vector', transport); // set the agent context to proxy.
|
|
9
|
-
this.action('method', `proxy:${transport}`); // set the action method to proxy.
|
|
18
|
+
this.state('set', `${key}:sign:${type}:uid:${transport}`); //set the uid state
|
|
19
|
+
const uid = this.lib.uid(true); // The UID
|
|
10
20
|
|
|
11
|
-
this.state('set',
|
|
12
|
-
const uid = this.lib.uid(true); // The UID for the proxy
|
|
13
|
-
this.state('set', `time:${transport}`); //set the time state for the proxy
|
|
21
|
+
this.state('set', `${key}:sign:${type}:time:${transport}`); //set the time state
|
|
14
22
|
const time = Date.now(); // current timestamp
|
|
15
|
-
|
|
23
|
+
|
|
24
|
+
this.state('created', `${key}:sign:${type}:created:${transport}`); //set the created state
|
|
16
25
|
const created = this.lib.formatDate(time, 'long', true); // Formatted created date.
|
|
17
26
|
|
|
18
|
-
this.state('set',
|
|
19
|
-
const
|
|
20
|
-
const {concerns} = vector; // load concerns from client guard profile.
|
|
27
|
+
this.state('set', `${key}:sign:${type}:concerns:${transport}`); //set the concerns
|
|
28
|
+
const {concerns} = this[key](); // load the Guard profile
|
|
21
29
|
|
|
22
|
-
this.state('set',
|
|
30
|
+
this.state('set', `${key}:sign:${type}:agent:${transport}`); //set the agent state
|
|
23
31
|
const agent = this.agent(); // the agent processing the proxy
|
|
24
32
|
|
|
25
|
-
this.state('set',
|
|
33
|
+
this.state('set', `${key}:sign:${type}:client:${transport}`); //set the client state
|
|
26
34
|
const client = this.client(); // the client requesting the proxy
|
|
27
35
|
|
|
28
|
-
this.state('set',
|
|
36
|
+
this.state('set', `${key}:sign:${type}:meta:${transport}`); //set the meta state
|
|
29
37
|
const {meta} = packet.q; // set the meta information from the packet question.
|
|
30
38
|
|
|
31
|
-
this.state('set',
|
|
39
|
+
this.state('set', `${key}:sign:${type}:params:${transport}`); //set the meta state
|
|
32
40
|
const {params} = meta; // set params from the meta information.
|
|
33
41
|
|
|
34
|
-
this.state('set',
|
|
42
|
+
this.state('set', `${key}:sign:${type}:opts:${transport}`); //set the opts state
|
|
35
43
|
const opts = this.lib.copy(params); // copy the params and set as opts.
|
|
36
44
|
|
|
37
|
-
this.state('set',
|
|
45
|
+
this.state('set', `${key}:sign:${type}:command:${transport}`); //set the opts state
|
|
38
46
|
const command = opts.shift(); // extract the command first array item out of opts.
|
|
39
47
|
|
|
40
|
-
this.state('set',
|
|
48
|
+
this.state('set', `${key}:sign:${type}:message:${transport}`); //set the message state
|
|
41
49
|
const message = packet.q.text; // set packet.q.text as the message of the proxy.
|
|
42
50
|
|
|
43
|
-
this.state('set',
|
|
44
|
-
const write = `OM
|
|
51
|
+
this.state('set', `${key}:sign:${type}:write:${transport}`); //set the message state
|
|
52
|
+
const write = `OM:${key.toUpperCase()}:${client.profile.write.split(' ').join(':').toUpperCase()}`; // set proxy write string.
|
|
45
53
|
|
|
46
54
|
// hash the agent profile for security
|
|
47
|
-
this.state('hash',
|
|
55
|
+
this.state('hash', `${key}:sign:${type}:write:${transport}`);
|
|
48
56
|
const agent_hash = this.lib.hash(agent, 'sha256');
|
|
49
57
|
|
|
50
58
|
// hash the agent profile for security
|
|
51
|
-
this.state('hash',
|
|
59
|
+
this.state('hash', `${key}:sign:${type}:write:${transport}`);
|
|
52
60
|
const client_hash = this.lib.hash(client, 'sha256');
|
|
53
61
|
|
|
54
62
|
// hash the agent profile for security
|
|
55
|
-
this.state('hash',
|
|
56
|
-
const token = this.lib.hash(
|
|
63
|
+
this.state('hash', `${key}:sign:${type}:write:${transport}`);
|
|
64
|
+
const token = this.lib.hash(`${key} ${client.profile.token} ${transport}`, 'sha256');
|
|
57
65
|
|
|
58
|
-
this.state('set',
|
|
66
|
+
this.state('set', `${key}:sign:${type}:write:${transport}`); // set the state to set data
|
|
59
67
|
// data packet
|
|
60
68
|
const data = {
|
|
61
69
|
uid,
|
|
@@ -80,22 +88,22 @@ export default {
|
|
|
80
88
|
copyright: client.profile.copyright,
|
|
81
89
|
};
|
|
82
90
|
|
|
83
|
-
this.state('hash',
|
|
91
|
+
this.state('hash', `${key}:sign:${type}:md5:${transport}`); // set state to secure hashing
|
|
84
92
|
data.md5 = this.lib.hash(data, 'md5'); // hash data packet into md5 and inert into data.
|
|
85
93
|
|
|
86
|
-
this.state('hash',
|
|
94
|
+
this.state('hash', `${key}:sign:${type}:sha256:${transport}`); // set state to secure hashing
|
|
87
95
|
data.sha256 = this.lib.hash(data, 'sha256'); // hash data into sha 256 then set in data.
|
|
88
96
|
|
|
89
|
-
this.state('hash',
|
|
97
|
+
this.state('hash', `${key}:sign:${type}:sha512:${transport}`); // set state to secure hashing
|
|
90
98
|
data.sha512 = this.lib.hash(data, 'sha512'); // hash data into sha 512 then set in data.
|
|
91
99
|
|
|
92
100
|
// Text data that is joined by line breaks and then trimmed.
|
|
93
|
-
this.state('set',
|
|
101
|
+
this.state('set', `${key}:sign:${type}:text:${transport}`); // set state to text for output formatting.
|
|
94
102
|
const text = [
|
|
95
103
|
`::::`,
|
|
96
104
|
`::BEGIN:${data.write}:${data.transport}`,
|
|
97
|
-
|
|
98
|
-
`::begin
|
|
105
|
+
`#${key}:${type}${data.opts} ${data.message}`,
|
|
106
|
+
`::begin:${key}:${transport}:${data.emojis}`,
|
|
99
107
|
`transport: ${data.transport}`,
|
|
100
108
|
`time: ${data.time}`,
|
|
101
109
|
`caseid: ${data.caseid}`,
|
|
@@ -110,46 +118,56 @@ export default {
|
|
|
110
118
|
`md5: ${data.md5}`,
|
|
111
119
|
`sha256: ${data.sha256}`,
|
|
112
120
|
`sha512: ${data.sha512}`,
|
|
113
|
-
`::end
|
|
121
|
+
`::end:${key}:${type}${data.transport}:${data.emojis}`,
|
|
114
122
|
`::END:${data.write}:${data.transport}`,
|
|
115
123
|
`::::`
|
|
116
124
|
].join('\n').trim();
|
|
117
125
|
|
|
118
126
|
// send the text data to #feecting to parse and return valid text, html, and data.
|
|
119
|
-
this.action('question',
|
|
127
|
+
this.action('question', `${key}:sign:${type}:write:${transport}`); // action set to feecting parse
|
|
120
128
|
const feecting = await this.question(`${this.askChr}feecting parse:${transport} ${text}`); // parse with feecting agent.
|
|
121
129
|
|
|
122
|
-
this.state('return',
|
|
130
|
+
this.state('return', `${key}:sign:${type}:return:${transport}`); // set the state to return proxy
|
|
123
131
|
return {
|
|
124
132
|
text: feecting.a.text,
|
|
125
133
|
html: feecting.a.html,
|
|
126
134
|
data,
|
|
127
135
|
}
|
|
136
|
+
|
|
128
137
|
},
|
|
129
|
-
|
|
138
|
+
|
|
139
|
+
async echo(key, type, opts) {
|
|
130
140
|
const {id, agent, client, text, created, md5, sha256, sha512} = opts;
|
|
131
141
|
|
|
132
|
-
this.prompt('ECHO ECHO ECHO')
|
|
133
142
|
this.state('set', `${key}:echo:${type}:time:${id}`);
|
|
134
143
|
const echo_time = Date.now();
|
|
135
144
|
|
|
136
145
|
this.action('func', `${key}:echo:${type}:${id}`);
|
|
137
146
|
|
|
147
|
+
this.state('hash', `${key}:echo:${type}:hash:message:${id}`);
|
|
148
|
+
const message_hash = this.lib.hash(text || 'blank', 'sha256');
|
|
149
|
+
|
|
150
|
+
this.state('hash', `${key}:echo:${type}:hash:agent:${id}`);
|
|
151
|
+
const agent_hash = this.lib.hash(agent, 'sha256');
|
|
152
|
+
|
|
153
|
+
this.state('hash', `${key}:echo:${type}:hash:client:${id}`);
|
|
154
|
+
const client_hash = this.lib.hash(client, 'sha256');
|
|
155
|
+
|
|
138
156
|
this.state('set', `${key}:echo:${type}:keystr:${id}`);
|
|
139
157
|
const keystr = `${key.toUpperCase()}:${type.toUpperCase()}:${id}`;
|
|
140
158
|
|
|
141
159
|
this.state('set', `${key}:echo:${type}:data:${id}`);
|
|
142
160
|
const echo_data = [
|
|
143
|
-
|
|
161
|
+
`::::`,
|
|
144
162
|
`::BEGIN:${keystr}`,
|
|
145
163
|
`key: ${key}`,
|
|
146
164
|
`type: ${type}`,
|
|
147
165
|
`transport: ${id}`,
|
|
148
166
|
`created: ${created}`,
|
|
149
167
|
`echo: ${echo_time}`,
|
|
150
|
-
`message: ${
|
|
151
|
-
`agent: ${
|
|
152
|
-
`client: ${
|
|
168
|
+
`message: ${message_hash}`,
|
|
169
|
+
`agent: ${agent_hash}`,
|
|
170
|
+
`client: ${client_hash}`,
|
|
153
171
|
`md5: ${md5}`,
|
|
154
172
|
`sha256:${sha256}`,
|
|
155
173
|
`sha512:${sha512}`,
|