@indra.ai/deva.security 0.0.33 → 0.0.35
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 +26 -1
- package/package.json +1 -1
package/feature/methods.js
CHANGED
|
@@ -66,8 +66,21 @@ export default {
|
|
|
66
66
|
describe: Return system md5 hash for the based deva.
|
|
67
67
|
***************/
|
|
68
68
|
hash(packet) {
|
|
69
|
+
const transport = packet.id;
|
|
69
70
|
this.feature('security');
|
|
70
|
-
|
|
71
|
+
this.action('method', `hash:${transport}`);
|
|
72
|
+
|
|
73
|
+
this.state('set', `meta:${transport}`); //set the meta state for the proxy
|
|
74
|
+
const {meta} = packet.q; // set the meta information from the packet question.
|
|
75
|
+
|
|
76
|
+
this.state('set', `params:${transport}`); //set the meta state for the proxy
|
|
77
|
+
const {params} = meta; // set params from the meta information.
|
|
78
|
+
|
|
79
|
+
this.state('set', `algo:${transport}`); //set the meta state for the proxy
|
|
80
|
+
const algo = params[1] ? params[1] : 'md5'
|
|
81
|
+
|
|
82
|
+
this.state('set', `hash:${transport}`); //set the meta state for the proxy
|
|
83
|
+
const hash = this.lib.hash(packet.q.text, algo);
|
|
71
84
|
return Promise.resolve(hash);
|
|
72
85
|
},
|
|
73
86
|
|
|
@@ -93,6 +106,18 @@ export default {
|
|
|
93
106
|
const theDate = this.lib.formatDate(Date.now(), 'long', true);
|
|
94
107
|
return Promise.resolve(theDate);
|
|
95
108
|
},
|
|
109
|
+
/**************
|
|
110
|
+
method: time
|
|
111
|
+
params: packet
|
|
112
|
+
describe: Return system date for today.
|
|
113
|
+
***************/
|
|
114
|
+
time(packet) {
|
|
115
|
+
this.feature('security');
|
|
116
|
+
this.action('method', 'time')
|
|
117
|
+
this.state('get', 'time')
|
|
118
|
+
const theTime = Date.now();
|
|
119
|
+
return Promise.resolve(theTime);
|
|
120
|
+
},
|
|
96
121
|
|
|
97
122
|
|
|
98
123
|
//TODO: build the write feature so it can write commands into the system.
|