@indra.ai/deva.security 0.37.6 → 0.37.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/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
 
@@ -357,7 +357,7 @@ export default {
357
357
  data,
358
358
  });
359
359
  }).catch(err => {
360
- return this.err(err, data, reject);
360
+ return this.err(err, packet, reject);
361
361
  })
362
362
 
363
363
  });
package/index.js CHANGED
@@ -17,84 +17,84 @@ import {fileURLToPath} from 'node:url';
17
17
  const __dirname = dirname(fileURLToPath(import.meta.url));
18
18
 
19
19
  const info = {
20
- id: pkg.id,
21
- name: pkg.name,
22
- describe: pkg.description,
23
- version: pkg.version,
24
- url: pkg.homepage,
25
- dir: __dirname,
26
- git: pkg.repository.url,
27
- bugs: pkg.bugs.url,
28
- author: pkg.author,
29
- license: pkg.license,
30
- VLA: pkg.VLA,
31
- copyright: pkg.copyright,
20
+ id: pkg.id,
21
+ name: pkg.name,
22
+ describe: pkg.description,
23
+ version: pkg.version,
24
+ url: pkg.homepage,
25
+ dir: __dirname,
26
+ git: pkg.repository.url,
27
+ bugs: pkg.bugs.url,
28
+ author: pkg.author,
29
+ license: pkg.license,
30
+ VLA: pkg.VLA,
31
+ copyright: pkg.copyright,
32
32
  };
33
33
 
34
34
  const SecurityDeva = new Deva({
35
- info,
36
- agent,
37
- vars,
38
- utils: {
39
- translate(input) {return input.trim();},
40
- parse(input) {return input.trim();},
41
- process(input) {return input.trim();}
42
- },
43
- listeners: {
44
- // log the answer on finish
45
- 'devacore:finish'(packet) {
46
- if (!this._active) return;
47
- this.func.write_log('finish', this.lib.copy(packet));
48
- },
49
- // log the answer on complete
50
- 'devacore:complete'(packet) {
51
- if (!this._active) return;
52
- this.func.write_log('complete', this.lib.copy(packet));
53
- },
54
- },
55
- modules: {},
56
- devas: {},
57
- func: {
58
- /**************
59
- func: write_log
60
- params: type, packet
61
- describe: this is the log file writer function that handles
62
- writing for finish and complete for complete chain of custody.
63
- ***************/
64
- async write_log(type, packet) {
65
- let result = false;
66
- if (!this.modules.client) return;
67
- try {
68
- const database = this.modules.client.db(this.vars.log);
69
- const collection = database.collection(type);
70
- result = await collection.insertOne(packet);
71
- return result;
72
- }
73
- catch (err) {
74
- return this.err(err, packet);
75
- }
76
- },
77
-
78
- },
79
- methods: {},
80
- onReady(data, resolve) {
81
- const {VLA} = this.info();
82
- const {uri, database, log} = this.security().global?.mongo || {};
83
- if (database) this.vars.database = database; // set the main database
84
- if (log) this.vars.log = log; // set the logging database
85
- if (uri) this.modules.client = new MongoClient(uri); // build the client if uri is set
86
- this.prompt(`${this.vars.messages.ready} > VLA:${VLA.uid}`);
87
- return resolve(data);
88
- },
89
- onStop(data, resolve) {
90
- const {client} = this.modules;
91
- if (!client) return this.close(data, resolve);
92
- return client.close().then(() => this.close(data, resolve)); // close the database before shutdown
93
- },
94
- onError(err, data, reject) {
95
- this.prompt(this.vars.messages.error);
96
- console.error(err);
97
- return reject ? reject(err) : Promise.reject(err);
98
- }
35
+ info,
36
+ agent,
37
+ vars,
38
+ utils: {
39
+ translate(input) {return input.trim();},
40
+ parse(input) {return input.trim();},
41
+ process(input) {return input.trim();}
42
+ },
43
+ listeners: {
44
+ // log the answer on finish
45
+ 'devacore:finish'(packet) {
46
+ if (!this._active) return;
47
+ this.func.write_log('finish', this.lib.copy(packet));
48
+ },
49
+ // log the answer on complete
50
+ 'devacore:complete'(packet) {
51
+ if (!this._active) return;
52
+ this.func.write_log('complete', this.lib.copy(packet));
53
+ },
54
+ },
55
+ modules: {},
56
+ devas: {},
57
+ func: {
58
+ /**************
59
+ func: write_log
60
+ params: type, packet
61
+ describe: this is the log file writer function that handles
62
+ writing for finish and complete for complete chain of custody.
63
+ ***************/
64
+ async write_log(type, packet) {
65
+ let result = false;
66
+ if (!this.modules.client) return;
67
+ try {
68
+ const database = this.modules.client.db(this.vars.log);
69
+ const collection = database.collection(type);
70
+ result = await collection.insertOne(packet);
71
+ return result;
72
+ }
73
+ catch (err) {
74
+ return this.err(err, packet);
75
+ }
76
+ },
77
+
78
+ },
79
+ methods: {},
80
+ onReady(data, resolve) {
81
+ const {VLA} = this.info();
82
+ const {uri, database, log} = this.security().global?.mongo || {};
83
+ if (database) this.vars.database = database; // set the main database
84
+ if (log) this.vars.log = log; // set the logging database
85
+ if (uri) this.modules.client = new MongoClient(uri); // build the client if uri is set
86
+ this.prompt(`${this.vars.messages.ready} > VLA:${VLA.uid}`);
87
+ return resolve(data);
88
+ },
89
+ onStop(data, resolve) {
90
+ const {client} = this.modules;
91
+ if (!client) return this.close(data, resolve);
92
+ return client.close().then(() => this.close(data, resolve)); // close the database before shutdown
93
+ },
94
+ onError(err, data, reject) {
95
+ this.prompt(this.vars.messages.error);
96
+ console.error(err);
97
+ return reject ? reject(err) : Promise.reject(err);
98
+ }
99
99
  });
100
100
  export default SecurityDeva
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.6",
4
+ "version": "0.37.8",
5
5
  "license": "VLA:15266350905933520771 LICENSE.md",
6
6
  "VLA": {
7
7
  "uid": "15266350905933520771",
@@ -113,7 +113,7 @@
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
118
  "background": "/assets/background.jpg",
119
119
  "owner": "Quinn Michaels",