@indra.ai/deva.security 0.0.34 → 0.0.36
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 +32 -8
- package/package.json +1 -1
package/feature/methods.js
CHANGED
|
@@ -61,13 +61,29 @@ export default {
|
|
|
61
61
|
},
|
|
62
62
|
|
|
63
63
|
/**************
|
|
64
|
-
method: md5 hash
|
|
64
|
+
method: md5, sha256, sha512 hash
|
|
65
65
|
params: packet
|
|
66
|
-
describe: Return system md5
|
|
66
|
+
describe: Return system md5, sha256, sha512 hash from value.
|
|
67
67
|
***************/
|
|
68
68
|
hash(packet) {
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
const transport = packet.id;
|
|
70
|
+
this.zone('security', `hash:${transport}`);
|
|
71
|
+
this.feature('security', `hash:${transport}`);
|
|
72
|
+
this.action('method', `hash:${transport}`);
|
|
73
|
+
|
|
74
|
+
this.state('set', `meta:${transport}`); //set the meta state for the proxy
|
|
75
|
+
const {meta} = packet.q; // set the meta information from the packet question.
|
|
76
|
+
|
|
77
|
+
this.state('set', `params:${transport}`); //set the meta state for the proxy
|
|
78
|
+
const {params} = meta; // set params from the meta information.
|
|
79
|
+
|
|
80
|
+
this.state('set', `algo:${transport}`); //set the meta state for the proxy
|
|
81
|
+
const algo = params[1] ? params[1] : 'md5'
|
|
82
|
+
|
|
83
|
+
this.state('set', `hash:${transport}`); //set the meta state for the proxy
|
|
84
|
+
const hash = this.lib.hash(packet.q.text, algo);
|
|
85
|
+
|
|
86
|
+
this.state('return', `hash:${transport}`);
|
|
71
87
|
return Promise.resolve(hash);
|
|
72
88
|
},
|
|
73
89
|
|
|
@@ -89,8 +105,13 @@ export default {
|
|
|
89
105
|
describe: Return system date for today.
|
|
90
106
|
***************/
|
|
91
107
|
today(packet) {
|
|
92
|
-
|
|
108
|
+
const transport = packet.id;
|
|
109
|
+
this.zone('security', `today:${transport}`);
|
|
110
|
+
this.feature('security', `today:${transport}`);
|
|
111
|
+
this.action('method', `today:${transport}`);
|
|
112
|
+
this.state('get', `today:${transport}`);
|
|
93
113
|
const theDate = this.lib.formatDate(Date.now(), 'long', true);
|
|
114
|
+
this.state('get', `today:${transport}`);
|
|
94
115
|
return Promise.resolve(theDate);
|
|
95
116
|
},
|
|
96
117
|
/**************
|
|
@@ -99,10 +120,13 @@ export default {
|
|
|
99
120
|
describe: Return system date for today.
|
|
100
121
|
***************/
|
|
101
122
|
time(packet) {
|
|
102
|
-
|
|
103
|
-
this.
|
|
104
|
-
this.
|
|
123
|
+
const transport = packet.id;
|
|
124
|
+
this.zone('security', `time:${transport}`);
|
|
125
|
+
this.feature('security', `time:${transport}`);
|
|
126
|
+
this.action('method', `time:${transport}`);
|
|
127
|
+
this.state('get', `time:${transport}`);
|
|
105
128
|
const theTime = Date.now();
|
|
129
|
+
this.state('return', `time:${transport}`);
|
|
106
130
|
return Promise.resolve(theTime);
|
|
107
131
|
},
|
|
108
132
|
|