@indra.ai/deva.security 0.0.31 → 0.0.33
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 +13 -81
- package/package.json +1 -1
package/feature/methods.js
CHANGED
|
@@ -71,17 +71,6 @@ export default {
|
|
|
71
71
|
return Promise.resolve(hash);
|
|
72
72
|
},
|
|
73
73
|
|
|
74
|
-
/**************
|
|
75
|
-
method: today
|
|
76
|
-
params: packet
|
|
77
|
-
describe: Return system date for today.
|
|
78
|
-
***************/
|
|
79
|
-
today(packet) {
|
|
80
|
-
this.feature('security');
|
|
81
|
-
const theDate = this.lib.formatDate(Date.now(), 'long', true);
|
|
82
|
-
return Promise.resolve(theDate);
|
|
83
|
-
},
|
|
84
|
-
|
|
85
74
|
/**************
|
|
86
75
|
method: md5 cipher
|
|
87
76
|
params: packet
|
|
@@ -94,75 +83,18 @@ export default {
|
|
|
94
83
|
return Promise.resolve(cipher);
|
|
95
84
|
},
|
|
96
85
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (!params[1] || params[1] === 'client') type = `#${meta.key}.${params.join('.')}`;
|
|
108
|
-
else type = `#${meta.key}.${params.join('.')}`;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const signer = !params[1] || params[1] === 'client' ? this.client() : this.agent();
|
|
112
|
-
const signer_type = !params[1] || params[1] === 'client' ? 'client_id' : 'agent_id';
|
|
113
|
-
const timestamp = Date.now();
|
|
114
|
-
const created = this.lib.formatDate(timestamp, 'long', true);
|
|
115
|
-
const message = packet.q.text || '';
|
|
116
|
-
const client = this.client();
|
|
117
|
-
const {profile} = signer;
|
|
118
|
-
|
|
119
|
-
console.log(client.profile.token);
|
|
120
|
-
|
|
121
|
-
const data = {
|
|
122
|
-
uid,
|
|
123
|
-
transport,
|
|
124
|
-
type,
|
|
125
|
-
signer: signer.id,
|
|
126
|
-
name: profile.name,
|
|
127
|
-
identity: profile.identity || 'not provided',
|
|
128
|
-
caseid: profile.caseid,
|
|
129
|
-
message,
|
|
130
|
-
token: client.profile.token,
|
|
131
|
-
copyright: profile.copyright,
|
|
132
|
-
created,
|
|
133
|
-
timestamp,
|
|
134
|
-
};
|
|
135
|
-
data.md5 = this.lib.hash(data, 'md5');
|
|
136
|
-
data.sha256 = this.lib.hash(data, 'sha256');
|
|
137
|
-
data.sha512 = this.lib.hash(data, 'sha512');
|
|
138
|
-
|
|
139
|
-
const text = [
|
|
140
|
-
'',
|
|
141
|
-
`::begin:signature:VectorGuardShield:${data.transport}`,
|
|
142
|
-
`type: ${type}`,
|
|
143
|
-
`name: ${data.name}`,
|
|
144
|
-
`identity: ${data.identity}`,
|
|
145
|
-
`message: ${data.message}`,
|
|
146
|
-
`token: ${data.token}`,
|
|
147
|
-
`---`,
|
|
148
|
-
`id: ${data.uid}`,
|
|
149
|
-
`${signer_type}: ${data.signer}`,
|
|
150
|
-
`transport_id: ${data.transport}`,
|
|
151
|
-
`case_id: ${data.caseid}`,
|
|
152
|
-
`copyright: ${data.copyright}`,
|
|
153
|
-
`created: ${data.created}`,
|
|
154
|
-
`timestamp: ${data.timestamp}`,
|
|
155
|
-
`md5: ${data.md5}`,
|
|
156
|
-
`sha256: ${data.sha256}`,
|
|
157
|
-
`sha512: ${data.sha512}`,
|
|
158
|
-
`::end:signature:VectorGuardShield:${data.transport}`,
|
|
159
|
-
'',
|
|
160
|
-
].join('\n').trim();
|
|
161
|
-
const feecting = await this.question(`${this.askChr}feecting parse ${text}`);
|
|
162
|
-
return {
|
|
163
|
-
text: feecting.a.text,
|
|
164
|
-
html: feecting.a.html,
|
|
165
|
-
data,
|
|
166
|
-
}
|
|
86
|
+
/**************
|
|
87
|
+
method: today
|
|
88
|
+
params: packet
|
|
89
|
+
describe: Return system date for today.
|
|
90
|
+
***************/
|
|
91
|
+
today(packet) {
|
|
92
|
+
this.feature('security');
|
|
93
|
+
const theDate = this.lib.formatDate(Date.now(), 'long', true);
|
|
94
|
+
return Promise.resolve(theDate);
|
|
167
95
|
},
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
//TODO: build the write feature so it can write commands into the system.
|
|
99
|
+
|
|
168
100
|
}
|