@indra.ai/deva.license 0.0.4 → 0.0.5
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 +27 -0
- package/index.js +1 -1
- package/package.json +3 -2
package/feature/methods.js
CHANGED
|
@@ -7,5 +7,32 @@ export default {
|
|
|
7
7
|
async license(packet) {
|
|
8
8
|
const license = await this.methods.sign('license', 'default', packet);
|
|
9
9
|
return license;
|
|
10
|
+
},
|
|
11
|
+
async license_check(personal, package) {
|
|
12
|
+
this.state('license', `check:personal:${package.uid}`);
|
|
13
|
+
if !(personal) return false;
|
|
14
|
+
this.state('license', `check:package:${package.uid}`);
|
|
15
|
+
if !(package) return false;
|
|
16
|
+
this.state('license', `check:uid:${package.uid}`);
|
|
17
|
+
if (personal.uid !== package.uid) ? return false;
|
|
18
|
+
this.state('license', `check:time:${package.uid}`);
|
|
19
|
+
if (personal.time !== package.time) ? return false;
|
|
20
|
+
this.state('license', `check:date:${package.uid}`);
|
|
21
|
+
if (personal.date !== package.date) ? return false;
|
|
22
|
+
this.state('license', `check:md5:${package.uid}`);
|
|
23
|
+
if (personal.md5 !== package.md5) ? return false;
|
|
24
|
+
this.state('license', `check:sha256:${package.uid}`);
|
|
25
|
+
if (personal.sha256 !== package.sha256) ? return false;
|
|
26
|
+
this.state('license', `check:sha512:${package.uid}`);
|
|
27
|
+
if (personal.sha512 !== package.sha512) ? return false;
|
|
28
|
+
|
|
29
|
+
// this is to ensure no additional information is being transmitted.
|
|
30
|
+
this.state('license', `compare:sha256:${package.uid}`);
|
|
31
|
+
const personal_hash = this.lib.hash('sha256', personal);
|
|
32
|
+
const package_hash = this.lib.hash('sha256', package);
|
|
33
|
+
if (personal_hash !== package_hash) return false;
|
|
34
|
+
|
|
35
|
+
this.state('return', `license:${package.uid}`);
|
|
36
|
+
return personal;
|
|
10
37
|
}
|
|
11
38
|
};
|
package/index.js
CHANGED
|
@@ -216,7 +216,7 @@ const LICENSE = new Deva({
|
|
|
216
216
|
},
|
|
217
217
|
onReady(data, resolve) {
|
|
218
218
|
const {concerns, global, personal} = this.license(); // get the license config
|
|
219
|
-
this.vars.license = personal
|
|
219
|
+
this.vars.license = this.methods.license_check(personal, pkg.VLA);
|
|
220
220
|
|
|
221
221
|
const {uri,database} = global.mongo; // set the datase
|
|
222
222
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "41840925813499570000",
|
|
3
3
|
"name": "@indra.ai/deva.license",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"license": "VLA:20758568792947085964 LICENSE.md",
|
|
6
6
|
"VLA": {
|
|
7
7
|
"uid": "20758568792947085964",
|
|
@@ -112,7 +112,8 @@
|
|
|
112
112
|
"stop": "🔴 STOP",
|
|
113
113
|
"exit": "🟡 EXIT",
|
|
114
114
|
"done": "🟣 DONE",
|
|
115
|
-
"error": "
|
|
115
|
+
"error": "❌ ERROR!",
|
|
116
|
+
"invalid_license": "💣 Invalid License"
|
|
116
117
|
},
|
|
117
118
|
"context": {
|
|
118
119
|
"uid": "generating uid",
|