@indra.ai/deva.security 0.37.5 → 0.37.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Security Deva
2
2
 
3
- Security Deva is the security agent for Indra.ai and Deva.world. Its agent key is `security`. It keeps a chain-of-custody log of `devacore:finish` and `devacore:complete` packets in a MongoDB log database, and it ships the security feature methods that the feature loader binds at runtime: `security`, `uid`, `sign`, `hash`, `encrypt`, `decrypt`, `date`, and `time`. Commands talk to it directly with `/uid` or, from another Deva, with `#security uid`.
3
+ Security Deva is the security agent for Indra.ai and Deva.world. Its agent key is `security`. It keeps a chain-of-custody log of `devacore:finish` and `devacore:complete` packets in a MongoDB log database, and it ships the security feature methods that the feature loader binds at runtime: `uid`, `sign`, `hash`, `encrypt`, `decrypt`, `date`, and `time`. Commands talk to it directly with `/uid` or, from another Deva, with `#security uid`.
4
4
 
5
5
  ## Requirements
6
6
 
@@ -127,7 +127,7 @@ Talk to Security Deva with `/uid` when it is the current agent, or with `#securi
127
127
 
128
128
  ## Feature methods
129
129
 
130
- `feature/methods.js` exports `security`, `uid`, `sign`, `hash`, `encrypt`, `decrypt`, `date`, and `time`. The feature loader binds them at runtime from `client.features.security.methods` onto the Deva's `methods`. `index.js` itself ships `methods: {}`. The `security(packet)` method is the global security feature that installs with every agent.
130
+ `feature/methods.js` exports `uid`, `sign`, `hash`, `encrypt`, `decrypt`, `date`, and `time`. The feature loader binds them at runtime from `client.features.security.methods` onto the Deva's `methods`. `index.js` itself ships `methods: {}`. The `security(packet)` method is the global security feature that installs with every agent.
131
131
 
132
132
  ## Help
133
133
 
@@ -7,375 +7,375 @@
7
7
 
8
8
  export default {
9
9
 
10
- /**************
11
- method: uid
12
- params: packet
13
- describe: Return a system id to the user from the Log Buddy.
14
- ***************/
15
- async uid(packet) {
16
- return new Promise((resolve, reject) => {
17
- const uuid = packet.q.text ? true : false
18
- const id = this.uid(uuid);
19
- this.context('uid', packet.id.uid);
20
- this.feature('security', `uid:${id.uid}`);
21
- this.zone('security', `uid:${id.uid}`);
22
- this.belief('security', `uid:${id.uid}`)
10
+ /**************
11
+ method: uid
12
+ params: packet
13
+ describe: Return a system id to the user from the Log Buddy.
14
+ ***************/
15
+ async uid(packet) {
16
+ return new Promise((resolve, reject) => {
17
+ const uuid = packet.q.text ? true : false
18
+ const id = this.uid(uuid);
19
+ this.context('uid', packet.id.uid);
20
+ this.feature('security', `uid:${id.uid}`);
21
+ this.zone('security', `uid:${id.uid}`);
22
+ this.belief('security', `uid:${id.uid}`)
23
23
 
24
- const agent = this.agent();
25
- const {key} = agent;
24
+ const agent = this.agent();
25
+ const {key} = agent;
26
26
 
27
- const client = this.client();
28
-
29
- const showJSON = packet.q.meta.params[1] || false;
30
- const status = `${key}:uid:${id.uid}`;
27
+ const client = this.client();
28
+
29
+ const showJSON = packet.q.meta.params[1] || false;
30
+ const status = `${key}:uid:${id.uid}`;
31
31
 
32
- this.state('set', `${key}:uid:text:${id.uid}`); // set state set
33
- const text = [
34
- `${this.box.begin}:om:${status}`,
35
- `uid: ${id.uid}`,
36
- `time: ${id.time}`,
37
- `utc: ${id.utc}`,
38
- `iso: ${id.iso}`,
39
- `date: ${id.date}`,
40
- `warning: ${id.warning}`,
41
- `notice: ${id.notice}`,
42
- `vectors: ${id.vectors}`,
43
- `agent: ${agent.profile.name} (${agent.profile.pronouns})`,
44
- `client: ${client.profile.name} (${client.profile.pronouns})`,
45
- `creator: ${id.creator}`,
46
- `owner: ${id.owner}`,
47
- `salute: ${id.salute}`,
48
- `license: ${id.license}`,
49
- `fingerprint: ${id.fingerprint}`,
50
- `copyright: ${id.copyright}`,
51
- `md5: ${id.md5}`,
52
- `sha256: ${id.sha256}`,
53
- `sha512: ${id.sha512}`,
54
- `${this.box.end}:om:${status}`,
55
- ];
56
-
57
- if (showJSON) {
58
- text.push(`${this.box.begin}:${key}:uid:json:${id.uid}`);
59
- text.push(JSON.stringify(id, null, 2));
60
- text.push(`${this.box.end}:${key}:uid:json:${id.uid}`);
61
- }
62
-
63
- this.question(`${this.askChr}feecting parse ${text.join('\n')}`, {vars:this.vars}).then(parsed => {
64
- this.belief('vedic', `uid:${packet.id.uid}`);
65
- this.action('resolve', `uid:${packet.id.uid}`);
66
- return resolve({
67
- text: parsed.a.text,
68
- html: parsed.a.html,
69
- data: id,
70
- });
71
- }).catch(err => {
72
- return this.err(err, packet, reject);
73
- });
74
- });
75
- },
32
+ this.state('set', `${key}:uid:text:${id.uid}`); // set state set
33
+ const text = [
34
+ `${this.box.begin}:om:${status}`,
35
+ `uid: ${id.uid}`,
36
+ `time: ${id.time}`,
37
+ `utc: ${id.utc}`,
38
+ `iso: ${id.iso}`,
39
+ `date: ${id.date}`,
40
+ `warning: ${id.warning}`,
41
+ `notice: ${id.notice}`,
42
+ `vectors: ${id.vectors}`,
43
+ `agent: ${agent.profile.name} (${agent.profile.pronouns})`,
44
+ `client: ${client.profile.name} (${client.profile.pronouns})`,
45
+ `creator: ${id.creator}`,
46
+ `owner: ${id.owner}`,
47
+ `salute: ${id.salute}`,
48
+ `license: ${id.license}`,
49
+ `fingerprint: ${id.fingerprint}`,
50
+ `copyright: ${id.copyright}`,
51
+ `md5: ${id.md5}`,
52
+ `sha256: ${id.sha256}`,
53
+ `sha512: ${id.sha512}`,
54
+ `${this.box.end}:om:${status}`,
55
+ ];
56
+
57
+ if (showJSON) {
58
+ text.push(`${this.box.begin}:${key}:uid:json:${id.uid}`);
59
+ text.push(JSON.stringify(id, null, 2));
60
+ text.push(`${this.box.end}:${key}:uid:json:${id.uid}`);
61
+ }
62
+
63
+ this.question(`${this.askChr}feecting parse ${text.join('\n')}`, {vars:this.vars}).then(parsed => {
64
+ this.belief('vedic', `uid:${packet.id.uid}`);
65
+ this.action('resolve', `uid:${packet.id.uid}`);
66
+ return resolve({
67
+ text: parsed.a.text,
68
+ html: parsed.a.html,
69
+ data: id,
70
+ });
71
+ }).catch(err => {
72
+ return this.err(err, packet, reject);
73
+ });
74
+ });
75
+ },
76
76
 
77
- async sign(packet) {
78
- const data = this.sign(packet);
79
-
80
- // Text data that is joined by line breaks and then trimmed.
81
- this.state('set', `${data.key}:${data.method}:text:${data.id.uid}`); // set state to text for output formatting.
82
- const text = [
83
- `write: #${data.key}.${data.method}.${data.opts} ${data.text}`,
84
- '\n',
85
- `${this.box.begin}:${data.method}:${data.id.uid}`,
86
- `sign: ${data.client.fullname} ${data.client.emojis}`,
87
- `uid: ${data.id.uid}`,
88
- `time: ${data.time}`,
89
- `expires: ${data.client.expires}`,
90
- `fingerprint: ${data.id.fingerprint}`,
91
- `name: ${data.client.name}`,
92
- `fullname: ${data.client.fullname}`,
93
- `company: ${data.client.company}`,
94
- `caseid: ${data.client.caseid}`,
95
- `agent: ${data.agent.sha256}`,
96
- `token: ${data.client.token}`,
97
- `warning: ${data.warning}`,
98
- `created: ${data.created}`,
99
- `copyright: ${data.copyright}`,
100
- `md5: ${data.md5}`,
101
- `sha256: ${data.sha256}`,
102
- `sha512: ${data.sha512}`,
103
- `${this.box.end}${data.method}:${data.id.uid}`,
104
- ].join('\n').trim();
105
-
106
- // send the text data to #feecting to parse and return valid text, html, and data.
107
- this.action('parse', `${data.key}:${data.method}:parse:${data.id.uid}`); // action set to feecting parse
108
- const feecting = await this.question(`${this.askChr}feecting parse:${data.id.uid} ${text}`); // parse with feecting agent.
109
-
110
- this.action('return', `${data.key}:${data.method}:${data.id.uid}`); // set the state to return proxy
111
- return {
112
- text: feecting.a.text,
113
- html: feecting.a.html,
114
- data,
115
- }
116
-
117
- },
77
+ async sign(packet) {
78
+ const data = this.sign(packet);
79
+
80
+ // Text data that is joined by line breaks and then trimmed.
81
+ this.state('set', `${data.key}:${data.method}:text:${data.id.uid}`); // set state to text for output formatting.
82
+ const text = [
83
+ `write: #${data.key}.${data.method}.${data.opts} ${data.text}`,
84
+ '\n',
85
+ `${this.box.begin}:${data.method}:${data.id.uid}`,
86
+ `sign: ${data.client.fullname} ${data.client.emojis}`,
87
+ `uid: ${data.id.uid}`,
88
+ `time: ${data.time}`,
89
+ `expires: ${data.client.expires}`,
90
+ `fingerprint: ${data.id.fingerprint}`,
91
+ `name: ${data.client.name}`,
92
+ `fullname: ${data.client.fullname}`,
93
+ `company: ${data.client.company}`,
94
+ `caseid: ${data.client.caseid}`,
95
+ `agent: ${data.agent.sha256}`,
96
+ `token: ${data.client.token}`,
97
+ `warning: ${data.warning}`,
98
+ `created: ${data.created}`,
99
+ `copyright: ${data.copyright}`,
100
+ `md5: ${data.md5}`,
101
+ `sha256: ${data.sha256}`,
102
+ `sha512: ${data.sha512}`,
103
+ `${this.box.end}${data.method}:${data.id.uid}`,
104
+ ].join('\n').trim();
105
+
106
+ // send the text data to #feecting to parse and return valid text, html, and data.
107
+ this.action('parse', `${data.key}:${data.method}:parse:${data.id.uid}`); // action set to feecting parse
108
+ const feecting = await this.question(`${this.askChr}feecting parse:${data.id.uid} ${text}`); // parse with feecting agent.
109
+
110
+ this.action('return', `${data.key}:${data.method}:${data.id.uid}`); // set the state to return proxy
111
+ return {
112
+ text: feecting.a.text,
113
+ html: feecting.a.html,
114
+ data,
115
+ }
116
+
117
+ },
118
118
 
119
- /**************
120
- method: md5, sha256, sha512 hash
121
- params: packet
122
- describe: Return system md5, sha256, sha512 hash from value.
123
- ***************/
124
- async hash(packet) {
125
- const id = this.uid();
126
- const {q} = packet;
127
- this.feature('security', `hash:${id.uid}`);
128
- this.belief('security', `hash:${id.uid}`)
129
- this.zone('security', `hash:${id.uid}`);
130
- this.action('method', `hash:${id.uid}`);
119
+ /**************
120
+ method: md5, sha256, sha512 hash
121
+ params: packet
122
+ describe: Return system md5, sha256, sha512 hash from value.
123
+ ***************/
124
+ async hash(packet) {
125
+ const id = this.uid();
126
+ const {q} = packet;
127
+ this.feature('security', `hash:${id.uid}`);
128
+ this.belief('security', `hash:${id.uid}`)
129
+ this.zone('security', `hash:${id.uid}`);
130
+ this.action('method', `hash:${id.uid}`);
131
131
 
132
- return new Promise((resolve, reject) => {
133
- const {global, personal} = this.security();
132
+ return new Promise((resolve, reject) => {
133
+ const {global, personal} = this.security();
134
134
 
135
- const agent = this.agent()
136
- const client = this.client();
137
-
138
- const {params} = q.meta; // set params from the meta information.
139
-
140
- this.state('set', `hash:${id.uid}`); //set the meta state for the proxy
141
- const algo = params[1] || personal.hash || global.hash
142
-
143
- this.state('set', `hash:${id.uid}`); //set the meta state for the proxy
144
- const hash = this.hash(q.text, algo);
145
-
146
- const data = {
147
- id,
148
- algo,
149
- text: q.text,
150
- hash,
151
- };
152
-
153
- const status = `${agent.key}:hash:${data.id.uid}`;
154
-
155
- const text = [
156
- `${this.box.begin}:${status}`,
157
- `uid: ${data.id.uid}`,
158
- `time: ${data.id.time}`,
159
- `utc: ${data.id.utc}`,
160
- `iso: ${data.id.iso}`,
161
- `date: ${data.id.date}`,
162
- `text: ${data.text}`,
163
- `${data.algo}: ${data.hash}`,
164
- `license: ${data.id.license}`,
165
- // `warning: ${data.id.warning}`,
166
- `copyright: ${data.id.copyright}`,
167
- `${this.box.end}:${status}`,
168
- ].join('\n');
169
-
170
- this.question(`${this.askChr}feecting parse ${text}`, {vars:this.vars}).then(parsed => {
171
- this.belief('vedic', `hash:${id.uid}`);
172
- this.state('valid', `hash:${id.uid}`);
173
- this.action('resolve', `hash:${id.uid}`);
174
- this.intent('good', `hash:${id.uid}`);
175
- return resolve({
176
- text: parsed.a.text,
177
- html: parsed.a.html,
178
- data,
179
- });
180
- }).catch(err => {
181
- return this.err(err, packet, reject);
182
- });
183
- });
184
- },
135
+ const agent = this.agent()
136
+ const client = this.client();
137
+
138
+ const {params} = q.meta; // set params from the meta information.
139
+
140
+ this.state('set', `hash:${id.uid}`); //set the meta state for the proxy
141
+ const algo = params[1] || personal.hash || global.hash
142
+
143
+ this.state('set', `hash:${id.uid}`); //set the meta state for the proxy
144
+ const hash = this.hash(q.text, algo);
145
+
146
+ const data = {
147
+ id,
148
+ algo,
149
+ text: q.text,
150
+ hash,
151
+ };
152
+
153
+ const status = `${agent.key}:hash:${data.id.uid}`;
154
+
155
+ const text = [
156
+ `${this.box.begin}:${status}`,
157
+ `uid: ${data.id.uid}`,
158
+ `time: ${data.id.time}`,
159
+ `utc: ${data.id.utc}`,
160
+ `iso: ${data.id.iso}`,
161
+ `date: ${data.id.date}`,
162
+ `text: ${data.text}`,
163
+ `${data.algo}: ${data.hash}`,
164
+ `license: ${data.id.license}`,
165
+ // `warning: ${data.id.warning}`,
166
+ `copyright: ${data.id.copyright}`,
167
+ `${this.box.end}:${status}`,
168
+ ].join('\n');
169
+
170
+ this.question(`${this.askChr}feecting parse ${text}`, {vars:this.vars}).then(parsed => {
171
+ this.belief('vedic', `hash:${id.uid}`);
172
+ this.state('valid', `hash:${id.uid}`);
173
+ this.action('resolve', `hash:${id.uid}`);
174
+ this.intent('good', `hash:${id.uid}`);
175
+ return resolve({
176
+ text: parsed.a.text,
177
+ html: parsed.a.html,
178
+ data,
179
+ });
180
+ }).catch(err => {
181
+ return this.err(err, packet, reject);
182
+ });
183
+ });
184
+ },
185
185
 
186
- /**************
187
- method: encrypt
188
- params: packet
189
- describe: Return system md5 hash for the based deva.
190
- ***************/
191
- async encrypt(packet) {
192
- const id = this.uid();
193
- const {q} = packet;
194
- this.feature('security', `encrypt:${id.uid}`);
195
- const {global,personal} = this.security();
196
- const agent = this.agent();
197
- this.zone('security', `encrypt:${id.uid}`);
198
- this.action('encrypt', id.uid);
186
+ /**************
187
+ method: encrypt
188
+ params: packet
189
+ describe: Return system md5 hash for the based deva.
190
+ ***************/
191
+ async encrypt(packet) {
192
+ const id = this.uid();
193
+ const {q} = packet;
194
+ this.feature('security', `encrypt:${id.uid}`);
195
+ const {global,personal} = this.security();
196
+ const agent = this.agent();
197
+ this.zone('security', `encrypt:${id.uid}`);
198
+ this.action('encrypt', id.uid);
199
199
 
200
- this.state('set', `encrypt:data:${id.uid}`); // set state data
201
- const data = this.lib.encrypt(q.text, global.encrypt);
202
- data.id = id;
203
-
204
- this.action('hash', `encrypt:data:md5:${id.uid}`); // set action hash
205
- data.md5 = this.hash(data.encrypted, 'md5');
206
- this.action('hash', `encrypt:data:sha256:${id.uid}`); // set action hash
207
- data.sha256 = this.hash(data.encrypted, 'sha256');
208
- this.action('hash', `encrypt:data:sha512:${id.uid}`); // set action hash
209
- data.sha512 = this.hash(data.encrypted, 'sha512');
200
+ this.state('set', `encrypt:data:${id.uid}`); // set state data
201
+ const data = this.lib.encrypt(q.text, global.encrypt);
202
+ data.id = id;
203
+
204
+ this.action('hash', `encrypt:data:md5:${id.uid}`); // set action hash
205
+ data.md5 = this.hash(data.encrypted, 'md5');
206
+ this.action('hash', `encrypt:data:sha256:${id.uid}`); // set action hash
207
+ data.sha256 = this.hash(data.encrypted, 'sha256');
208
+ this.action('hash', `encrypt:data:sha512:${id.uid}`); // set action hash
209
+ data.sha512 = this.hash(data.encrypted, 'sha512');
210
210
 
211
- const status = `${agent.key}:encrypt:${id.uid}`;
212
-
213
- this.state('set', `encrypt:text:${id.uid}`)
214
- const text = [
215
- `${this.box.begin}:${status}`,
216
- `uid: ${id.uid}`,
217
- `text: ${q.text}`,
218
- `iv: ${data.iv}`,
219
- `key: ${data.key}`,
220
- `encrypted: ${data.encrypted}`,
221
- `time: ${id.time}`,
222
- `date: ${id.date}`,
223
- `warning: ${id.warning}`,
224
- `copyright: ${id.copyright}`,
225
- `md5: ${data.md5}`,
226
- `sha256: ${data.sha256}`,
227
- `sha512: ${data.sha512}`,
228
- `${this.box.end}:${status}`,
229
- ].join('\n');
230
-
231
- this.action('return', `encrypt:${id.uid}`); // set action return
232
- this.state('valid', `encrypt:${id.uid}`); // set action return
233
- this.intent('good', `encrypt:${id.uid}`); // set action return
234
- return {
235
- text,
236
- html: false,
237
- data,
238
- };
239
- },
211
+ const status = `${agent.key}:encrypt:${id.uid}`;
212
+
213
+ this.state('set', `encrypt:text:${id.uid}`)
214
+ const text = [
215
+ `${this.box.begin}:${status}`,
216
+ `uid: ${id.uid}`,
217
+ `text: ${q.text}`,
218
+ `iv: ${data.iv}`,
219
+ `key: ${data.key}`,
220
+ `encrypted: ${data.encrypted}`,
221
+ `time: ${id.time}`,
222
+ `date: ${id.date}`,
223
+ `warning: ${id.warning}`,
224
+ `copyright: ${id.copyright}`,
225
+ `md5: ${data.md5}`,
226
+ `sha256: ${data.sha256}`,
227
+ `sha512: ${data.sha512}`,
228
+ `${this.box.end}:${status}`,
229
+ ].join('\n');
230
+
231
+ this.action('return', `encrypt:${id.uid}`); // set action return
232
+ this.state('valid', `encrypt:${id.uid}`); // set action return
233
+ this.intent('good', `encrypt:${id.uid}`); // set action return
234
+ return {
235
+ text,
236
+ html: false,
237
+ data,
238
+ };
239
+ },
240
240
 
241
- async decrypt(packet) {
242
- const id = this.uid();
243
- const {q} = packet
244
- this.feature('security', `decrypt:${id.uid}`);
245
- this.zone('security', `decrypt:${id.uid}`);
246
- const {global,personal} = this.security();
241
+ async decrypt(packet) {
242
+ const id = this.uid();
243
+ const {q} = packet
244
+ this.feature('security', `decrypt:${id.uid}`);
245
+ this.zone('security', `decrypt:${id.uid}`);
246
+ const {global,personal} = this.security();
247
247
 
248
- this.state('set', `decrypt:agent:${id.uid}`); // set state set
249
- const agent = this.agent();
250
- this.state('set', `decrypt:client:${id.uid}`); // set state set
251
- const client = this.client();
248
+ this.state('set', `decrypt:agent:${id.uid}`); // set state set
249
+ const agent = this.agent();
250
+ this.state('set', `decrypt:client:${id.uid}`); // set state set
251
+ const client = this.client();
252
252
 
253
- this.state('set', `decrypt:encrypt:${id.uid}`); // set state set
254
- const encrypt = {
255
- iv: q.meta.params[1],
256
- key: q.meta.params[2],
257
- encrypted: q.text,
258
- algorithm: global.encrypt.algorithm,
259
- }
260
-
261
- this.action('decrypt', id.uid); // set action hash
262
- const decrypt = this.lib.decrypt(encrypt);
263
-
264
- this.state('set', `decrypt:data:${id.uid}`); // set state set
265
- const data = {
266
- id,
267
- agent,
268
- decrypt,
269
- encrypt,
270
- };
253
+ this.state('set', `decrypt:encrypt:${id.uid}`); // set state set
254
+ const encrypt = {
255
+ iv: q.meta.params[1],
256
+ key: q.meta.params[2],
257
+ encrypted: q.text,
258
+ algorithm: global.encrypt.algorithm,
259
+ }
260
+
261
+ this.action('decrypt', id.uid); // set action hash
262
+ const decrypt = this.lib.decrypt(encrypt);
263
+
264
+ this.state('set', `decrypt:data:${id.uid}`); // set state set
265
+ const data = {
266
+ id,
267
+ agent,
268
+ decrypt,
269
+ encrypt,
270
+ };
271
271
 
272
- this.action('hash', `decrypt:data:md5:${id.uid}`); // set action hash
273
- data.md5 = this.hash(decrypt, 'md5');
274
- this.action('hash', `decrypt:data:sha256:${id.uid}`); // set action hash
275
- data.sha256 = this.hash(decrypt, 'sha256');
276
- this.action('hash', `decrypt:data:sha512:${id.uid}`); // set action hash
277
- data.sha512 = this.hash(decrypt, 'sha512');
278
-
279
- const status = `${agent.key}:decrypt:${data.id.uid}`;
280
-
281
- this.state('set', `decrypt:text:${id.uid}`); // set state set
282
- const text = [
283
- `${this.box.begin}:${status}`,
284
- `uid: ${data.id.uid}`,
285
- `decrypted: ${data.decrypt}`,
286
- `time: ${data.id.time}`,
287
- `date: ${data.id.date}`,
288
- `warning: ${data.id.warning}`,
289
- `copyright: ${data.id.copyright}`,
290
- `md5: ${data.md5}`,
291
- `sha256: ${data.sha256}`,
292
- `sha512: ${data.sha512}`,
293
- `${this.box.end}${status}`,
294
- ].join('\n');
295
-
272
+ this.action('hash', `decrypt:data:md5:${id.uid}`); // set action hash
273
+ data.md5 = this.hash(decrypt, 'md5');
274
+ this.action('hash', `decrypt:data:sha256:${id.uid}`); // set action hash
275
+ data.sha256 = this.hash(decrypt, 'sha256');
276
+ this.action('hash', `decrypt:data:sha512:${id.uid}`); // set action hash
277
+ data.sha512 = this.hash(decrypt, 'sha512');
278
+
279
+ const status = `${agent.key}:decrypt:${data.id.uid}`;
280
+
281
+ this.state('set', `decrypt:text:${id.uid}`); // set state set
282
+ const text = [
283
+ `${this.box.begin}:${status}`,
284
+ `uid: ${data.id.uid}`,
285
+ `decrypted: ${data.decrypt}`,
286
+ `time: ${data.id.time}`,
287
+ `date: ${data.id.date}`,
288
+ `warning: ${data.id.warning}`,
289
+ `copyright: ${data.id.copyright}`,
290
+ `md5: ${data.md5}`,
291
+ `sha256: ${data.sha256}`,
292
+ `sha512: ${data.sha512}`,
293
+ `${this.box.end}${status}`,
294
+ ].join('\n');
295
+
296
296
 
297
- this.action('return', `decrypt:${id.uid}`); // set action return
298
- this.state('valid', `decrypt:${id.uid}`); // set action return
299
- this.intent('good', `decrypt:${id.uid}`); // set action return
300
- return {
301
- text,
302
- html: false,
303
- data,
304
- };
305
- },
306
-
307
- /**************
308
- method: date
309
- params: packet
310
- describe: Return system date for today.
311
- ***************/
312
- async date(packet) {
313
- return new Promise((resolve, reject) => {
314
- const id = this.uid();
315
- const time = Date.now();
316
- const {params} = packet.q.meta;
317
- const {key} = this.agent();
318
- this.zone('security', `date:${id.uid}`);
319
- this.feature('security', `date:${id.uid}`);
320
- this.action('method', `date:${id.uid}`);
321
-
322
- this.state('set', `date:setFormat:${id.uid}`); // set state set
323
- const setFormat = params[1] ? params[1] : 'long';
324
- this.state('set', `date:setTime:${id.uid}`); // set state set
325
- const setTime = params[2] ? packet.q.meta.params[2] : false;
326
-
327
- this.state('set', `date:${id.uid}`);
328
- const date = this.lib.formatDate(time, setFormat, setTime);
329
-
330
- const data = {
331
- id,
332
- time,
333
- date,
334
- }
335
-
336
- this.action('hash', `date:data:sha256:${id.uid}`); // set action hash
337
- data.sha256 = this.hash(date, 'sha256');
338
-
339
- const text = [
340
- `${this.box.begin}:om:${key}:date:${data.id.uid}`,
341
- `uid: ${data.id.uid}`,
342
- `time: ${data.time}`,
343
- `date: ${data.date}`,
344
- `copyright: ${data.id.copyright}`,
345
- `sha256: ${data.sha256}`,
346
- `${this.box.end}:om:${key}:date:${data.id.uid}`
347
- ].join('\n');
348
-
349
- this.question(`${this.askChr}feecting parse ${text}`).then(feecting => {
350
- data.feecting = feecting;
351
- this.action('return', `date:${id.uid}`);
352
- this.state('valid', `date:${id.uid}`);
353
- this.intent('good', `date:${id.uid}`);
354
- return resolve({
355
- text: feecting.a.text,
356
- html: feecting.a.html,
357
- data,
358
- });
359
- }).catch(err => {
360
- return this.err(err, data, reject);
361
- })
297
+ this.action('return', `decrypt:${id.uid}`); // set action return
298
+ this.state('valid', `decrypt:${id.uid}`); // set action return
299
+ this.intent('good', `decrypt:${id.uid}`); // set action return
300
+ return {
301
+ text,
302
+ html: false,
303
+ data,
304
+ };
305
+ },
306
+
307
+ /**************
308
+ method: date
309
+ params: packet
310
+ describe: Return system date for today.
311
+ ***************/
312
+ async date(packet) {
313
+ return new Promise((resolve, reject) => {
314
+ const id = this.uid();
315
+ const time = Date.now();
316
+ const {params} = packet.q.meta;
317
+ const {key} = this.agent();
318
+ this.zone('security', `date:${id.uid}`);
319
+ this.feature('security', `date:${id.uid}`);
320
+ this.action('method', `date:${id.uid}`);
321
+
322
+ this.state('set', `date:setFormat:${id.uid}`); // set state set
323
+ const setFormat = params[1] ? params[1] : 'long';
324
+ this.state('set', `date:setTime:${id.uid}`); // set state set
325
+ const setTime = params[2] ? packet.q.meta.params[2] : false;
326
+
327
+ this.state('set', `date:${id.uid}`);
328
+ const date = this.lib.formatDate(time, setFormat, setTime);
329
+
330
+ const data = {
331
+ id,
332
+ time,
333
+ date,
334
+ }
335
+
336
+ this.action('hash', `date:data:sha256:${id.uid}`); // set action hash
337
+ data.sha256 = this.hash(date, 'sha256');
338
+
339
+ const text = [
340
+ `${this.box.begin}:om:${key}:date:${data.id.uid}`,
341
+ `uid: ${data.id.uid}`,
342
+ `time: ${data.time}`,
343
+ `date: ${data.date}`,
344
+ `copyright: ${data.id.copyright}`,
345
+ `sha256: ${data.sha256}`,
346
+ `${this.box.end}:om:${key}:date:${data.id.uid}`
347
+ ].join('\n');
348
+
349
+ this.question(`${this.askChr}feecting parse ${text}`).then(feecting => {
350
+ data.feecting = feecting;
351
+ this.action('return', `date:${id.uid}`);
352
+ this.state('valid', `date:${id.uid}`);
353
+ this.intent('good', `date:${id.uid}`);
354
+ return resolve({
355
+ text: feecting.a.text,
356
+ html: feecting.a.html,
357
+ data,
358
+ });
359
+ }).catch(err => {
360
+ return this.err(err, packet, reject);
361
+ })
362
362
 
363
- });
364
- },
365
- /**************
366
- method: time
367
- params: packet
368
- describe: Return system date for today.
369
- ***************/
370
- time(packet) {
371
- const transport = packet.id;
372
- this.zone('security', `time:${transport}`);
373
- this.feature('security', `time:${transport}`);
374
- this.action('method', `time:${transport}`);
375
- this.state('get', `time:${transport}`);
376
- const theTime = Date.now();
377
- this.state('return', `time:${transport}`);
378
- return Promise.resolve(theTime);
379
- },
380
-
363
+ });
364
+ },
365
+ /**************
366
+ method: time
367
+ params: packet
368
+ describe: Return system date for today.
369
+ ***************/
370
+ time(packet) {
371
+ const transport = packet.id;
372
+ this.zone('security', `time:${transport}`);
373
+ this.feature('security', `time:${transport}`);
374
+ this.action('method', `time:${transport}`);
375
+ this.state('get', `time:${transport}`);
376
+ const theTime = Date.now();
377
+ this.state('return', `time:${transport}`);
378
+ return Promise.resolve(theTime);
379
+ },
380
+
381
381
  }
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  // Wednesday, November 25, 2026 - 9:44:25 AM PST
7
7
 
8
8
  import Deva from '@indra.ai/deva';
9
- import { MongoClient, ObjectId } from 'mongodb';
9
+ import { MongoClient } from 'mongodb';
10
10
 
11
11
  import pkg from './package.json' with {type:'json'};
12
12
  const {agent,vars} = pkg.data;
@@ -80,8 +80,8 @@ const SecurityDeva = new Deva({
80
80
  onReady(data, resolve) {
81
81
  const {VLA} = this.info();
82
82
  const {uri, database, log} = this.security().global?.mongo || {};
83
- this.vars.database = database; // set the main database
84
- this.vars.log = log; // set the logging database
83
+ if (database) this.vars.database = database; // set the main database
84
+ if (log) this.vars.log = log; // set the logging database
85
85
  if (uri) this.modules.client = new MongoClient(uri); // build the client if uri is set
86
86
  this.prompt(`${this.vars.messages.ready} > VLA:${VLA.uid}`);
87
87
  return resolve(data);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "15266350905933520771",
3
3
  "name": "@indra.ai/deva.security",
4
- "version": "0.37.5",
4
+ "version": "0.37.7",
5
5
  "license": "VLA:15266350905933520771 LICENSE.md",
6
6
  "VLA": {
7
7
  "uid": "15266350905933520771",
@@ -113,9 +113,9 @@
113
113
  "color": "rgb(251,177,78)",
114
114
  "bgcolor": "rgb(0,0,0)",
115
115
  "emoji": "/assets/emoji.png",
116
- "avatar": "/assets/avatar.png",
116
+ "avatar": "/assets/avatar.jpg",
117
117
  "image": "/assets/image.png",
118
- "background": "/assets/background.png",
118
+ "background": "/assets/background.jpg",
119
119
  "owner": "Quinn Michaels",
120
120
  "creator": "Quinn Michaels",
121
121
  "company": "Inside The Net, Inc.",