@indra.ai/deva.security 0.4.0 → 0.5.0
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 +66 -36
- package/package.json +2 -2
package/feature/methods.js
CHANGED
|
@@ -33,7 +33,7 @@ export default {
|
|
|
33
33
|
const showJSON = packet.q.meta.params[1] || false;
|
|
34
34
|
const status = `${key}:uid:${id.uid}`;
|
|
35
35
|
const text = [
|
|
36
|
-
|
|
36
|
+
`${this.box.begin}${status}`,
|
|
37
37
|
`uid: ${id.uid}`,
|
|
38
38
|
`time: ${id.time}`,
|
|
39
39
|
`date: ${id.date}`,
|
|
@@ -43,7 +43,7 @@ export default {
|
|
|
43
43
|
`md5: ${id.md5}`,
|
|
44
44
|
`sha256: ${id.sha256}`,
|
|
45
45
|
`sha512: ${id.sha512}`,
|
|
46
|
-
|
|
46
|
+
`${this.box.end}${status}`,
|
|
47
47
|
];
|
|
48
48
|
const data = {
|
|
49
49
|
uid: id.uid,
|
|
@@ -57,9 +57,9 @@ export default {
|
|
|
57
57
|
sha512: id.sha512,
|
|
58
58
|
}
|
|
59
59
|
if (showJSON) {
|
|
60
|
-
text.push(
|
|
60
|
+
text.push(`${this.box.begin}${key}:uid:json:${data.uid}`);
|
|
61
61
|
text.push(JSON.stringify(data, null, 2));
|
|
62
|
-
text.push(
|
|
62
|
+
text.push(`${this.box.end}${key}:uid:json:${data.uid}`);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
this.question(`${this.askChr}feecting parse ${text.join('\n')}`).then(parsed => {
|
|
@@ -86,7 +86,7 @@ export default {
|
|
|
86
86
|
const text = [
|
|
87
87
|
`write: #${data.key}.${data.method}.${data.opts} ${data.text}`,
|
|
88
88
|
'\n',
|
|
89
|
-
|
|
89
|
+
`${this.box.begin}${data.method}:${data.id.uid}`,
|
|
90
90
|
`sign: ${data.client.fullname} ${data.client.emojis}`,
|
|
91
91
|
`uid: ${data.id.uid}`,
|
|
92
92
|
`time: ${data.time}`,
|
|
@@ -104,7 +104,7 @@ export default {
|
|
|
104
104
|
`md5: ${data.md5}`,
|
|
105
105
|
`sha256: ${data.sha256}`,
|
|
106
106
|
`sha512: ${data.sha512}`,
|
|
107
|
-
|
|
107
|
+
`${this.box.end}${data.method}:${data.id.uid}`,
|
|
108
108
|
].join('\n').trim();
|
|
109
109
|
|
|
110
110
|
// send the text data to #feecting to parse and return valid text, html, and data.
|
|
@@ -126,7 +126,8 @@ export default {
|
|
|
126
126
|
describe: Return system md5, sha256, sha512 hash from value.
|
|
127
127
|
***************/
|
|
128
128
|
async hash(packet) {
|
|
129
|
-
const
|
|
129
|
+
const id = this.uid();
|
|
130
|
+
const {q} = packet;
|
|
130
131
|
this.feature('security', `hash:${id.uid}`);
|
|
131
132
|
const {global, personal} = this.security();
|
|
132
133
|
const agent = this.agent()
|
|
@@ -143,36 +144,31 @@ export default {
|
|
|
143
144
|
this.state('set', `hash:${id.uid}`); //set the meta state for the proxy
|
|
144
145
|
const hash = this.hash(q.text, algo);
|
|
145
146
|
|
|
146
|
-
const time = Date.now();
|
|
147
|
-
const date = this.lib.formatDate(time, 'long', true);
|
|
148
|
-
const copyright = client.profile.copyright || agent.profile.copyright || this.info().copyright
|
|
149
147
|
const data = {
|
|
150
148
|
id,
|
|
151
149
|
algo,
|
|
152
150
|
text: q.text,
|
|
153
151
|
hash,
|
|
154
|
-
time,
|
|
155
|
-
date,
|
|
156
|
-
copyright,
|
|
157
152
|
};
|
|
158
153
|
|
|
159
|
-
const status = `${agent.key}:${data.
|
|
154
|
+
const status = `${agent.key}:hash:${data.id.uid}`;
|
|
160
155
|
|
|
161
156
|
const text = [
|
|
162
|
-
|
|
157
|
+
`${this.box.begin}${status}`,
|
|
163
158
|
`uid: ${data.id.uid}`,
|
|
164
159
|
`algo: ${data.algo}`,
|
|
165
160
|
`text: ${data.text}`,
|
|
166
161
|
`hash: ${data.hash}`,
|
|
167
|
-
`time: ${data.time}`,
|
|
168
|
-
`date: ${data.date}`,
|
|
169
|
-
`
|
|
170
|
-
|
|
162
|
+
`time: ${data.id.time}`,
|
|
163
|
+
`date: ${data.id.date}`,
|
|
164
|
+
`warning: ${data.id.warning}`,
|
|
165
|
+
`copyright: ${data.id.copyright}`,
|
|
166
|
+
`${this.box.end}${status}`,
|
|
171
167
|
].join('\n');
|
|
172
168
|
|
|
173
|
-
this.action('return', `hash:${id.uid}`);
|
|
174
|
-
this.state('valid', `hash:${id.uid}`);
|
|
175
|
-
this.intent('good', `hash:${id.uid}`);
|
|
169
|
+
this.action('return', `hash:${data.id.uid}`);
|
|
170
|
+
this.state('valid', `hash:${data.id.uid}`);
|
|
171
|
+
this.intent('good', `hash:${data.id.uid}`);
|
|
176
172
|
return {
|
|
177
173
|
text,
|
|
178
174
|
html: false,
|
|
@@ -209,7 +205,7 @@ export default {
|
|
|
209
205
|
|
|
210
206
|
this.state('set', `encrypt:text:${id.uid}`)
|
|
211
207
|
const text = [
|
|
212
|
-
|
|
208
|
+
`${this.box.begin}${status}`,
|
|
213
209
|
`uid: ${id.uid}`,
|
|
214
210
|
`text: ${q.text}`,
|
|
215
211
|
`iv: ${data.iv}`,
|
|
@@ -222,7 +218,7 @@ export default {
|
|
|
222
218
|
`md5: ${data.md5}`,
|
|
223
219
|
`sha256: ${data.sha256}`,
|
|
224
220
|
`sha512: ${data.sha512}`,
|
|
225
|
-
|
|
221
|
+
`${this.box.end}${status}`,
|
|
226
222
|
].join('\n');
|
|
227
223
|
|
|
228
224
|
this.action('return', `encrypt:${id.uid}`); // set action return
|
|
@@ -277,7 +273,7 @@ export default {
|
|
|
277
273
|
|
|
278
274
|
this.state('set', `decrypt:text:${id.uid}`); // set state set
|
|
279
275
|
const text = [
|
|
280
|
-
|
|
276
|
+
`${this.box.begin}:${status}`,
|
|
281
277
|
`uid: ${data.id.uid}`,
|
|
282
278
|
`decrypted: ${data.decrypt}`,
|
|
283
279
|
`time: ${data.id.time}`,
|
|
@@ -287,7 +283,7 @@ export default {
|
|
|
287
283
|
`md5: ${data.md5}`,
|
|
288
284
|
`sha256: ${data.sha256}`,
|
|
289
285
|
`sha512: ${data.sha512}`,
|
|
290
|
-
|
|
286
|
+
`${this.box.end}${status}`,
|
|
291
287
|
].join('\n');
|
|
292
288
|
|
|
293
289
|
|
|
@@ -302,19 +298,53 @@ export default {
|
|
|
302
298
|
},
|
|
303
299
|
|
|
304
300
|
/**************
|
|
305
|
-
method:
|
|
301
|
+
method: date
|
|
306
302
|
params: packet
|
|
307
303
|
describe: Return system date for today.
|
|
308
304
|
***************/
|
|
309
|
-
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
this.
|
|
313
|
-
|
|
314
|
-
this.
|
|
315
|
-
|
|
316
|
-
this.
|
|
317
|
-
|
|
305
|
+
async date(packet) {
|
|
306
|
+
const id = this.uid();
|
|
307
|
+
const {params} = packet.q.meta;
|
|
308
|
+
const {key} = this.agent();
|
|
309
|
+
|
|
310
|
+
this.zone('security', `date:${id.uid}`);
|
|
311
|
+
this.feature('security', `date:${id.uid}`);
|
|
312
|
+
this.action('method', `date:${id.uid}`);
|
|
313
|
+
|
|
314
|
+
const format = params[1] ? params[1] : 'long';
|
|
315
|
+
const time = params[2] ? packet.q.meta.params[2] : false;
|
|
316
|
+
|
|
317
|
+
this.state('set', `date:${id.uid}`);
|
|
318
|
+
const date = this.lib.formatDate(Date.now(), format, time);
|
|
319
|
+
|
|
320
|
+
const data = {
|
|
321
|
+
id,
|
|
322
|
+
date,
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
this.action('hash', `date:data:md5:${id.uid}`); // set action hash
|
|
326
|
+
data.md5 = this.hash(date, 'md5');
|
|
327
|
+
this.action('hash', `date:data:sha256:${id.uid}`); // set action hash
|
|
328
|
+
data.sha256 = this.hash(date, 'sha256');
|
|
329
|
+
this.action('hash', `date:data:sha512:${id.uid}`); // set action hash
|
|
330
|
+
data.sha512 = this.hash(date, 'sha512');
|
|
331
|
+
|
|
332
|
+
const text = [
|
|
333
|
+
`${this.box.begin}${key}:date:${data.id.uid}`,
|
|
334
|
+
`date: ${data.date}`,
|
|
335
|
+
`md5: ${data.md5}`,
|
|
336
|
+
`sha256: ${data.sha256}`,
|
|
337
|
+
`sha512: ${data.sha512}`,
|
|
338
|
+
`${this.box.end}${key}:date:${data.id.uid}`
|
|
339
|
+
].join('\n');
|
|
340
|
+
this.action('return', `date:${id.uid}`);
|
|
341
|
+
this.state('valid', `date:${id.uid}`);
|
|
342
|
+
this.intent('good', `date:${id.uid}`);
|
|
343
|
+
return {
|
|
344
|
+
text,
|
|
345
|
+
html: false,
|
|
346
|
+
data,
|
|
347
|
+
};
|
|
318
348
|
},
|
|
319
349
|
/**************
|
|
320
350
|
method: time
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "45249771785697968797",
|
|
3
3
|
"name": "@indra.ai/deva.security",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"license": "VLA:45249771785697968797 LICENSE.md",
|
|
6
6
|
"VLA": {
|
|
7
7
|
"uid": "45249771785697968797",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"homepage": "https://deva.space/devas/security",
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@indra.ai/deva": "^1.
|
|
63
|
+
"@indra.ai/deva": "^1.23.0",
|
|
64
64
|
"mongodb": "^6.20.0"
|
|
65
65
|
},
|
|
66
66
|
"data": {
|