@indra.ai/deva 1.20.2 → 1.20.4
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/config/msgs.json +1 -1
- package/lib/index.js +24 -12
- package/package.json +1 -1
package/config/msgs.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"invalid_client": "⛔️ Client Hash Invalid",
|
|
22
22
|
"load": "📦 Load",
|
|
23
23
|
"unload": "🥡 Unload",
|
|
24
|
-
"warning": "⚠️ Unlawful use or duplication of this uid constitutes Vedic Sâhasa
|
|
24
|
+
"warning": "⚠️ Unlawful use or duplication of this uid constitutes Vedic Sâhasa a crime of the highest degree. A fine amounting to a thousand Panas (1 pana = 3.5 grams of gold) for each instance is ordained, and confiscation of the entire property of the offenders is forfeit to Quinn A Michaels is declared to be the punishment for Sâhasa of the highest degree.",
|
|
25
25
|
"client_license_check": "🪪 Check Client License",
|
|
26
26
|
"client_license_invalid": "❌ The Provided Client License Is Invalid",
|
|
27
27
|
"status": "vedic"
|
package/lib/index.js
CHANGED
|
@@ -45,21 +45,24 @@ class LIB {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**************
|
|
48
|
-
func:
|
|
49
|
-
params:
|
|
48
|
+
func: encrypt
|
|
49
|
+
params:
|
|
50
|
+
str - string to encrypt
|
|
51
|
+
opts - options for the encryption.
|
|
50
52
|
describe:
|
|
51
53
|
The encrypt function allows for the internal encryption of data based on the
|
|
52
54
|
defined client security settings.
|
|
53
55
|
***************/
|
|
54
|
-
|
|
56
|
+
encrypt(str, opts) {
|
|
55
57
|
const {password, algorithm} = opts;
|
|
56
|
-
const key = createHash('
|
|
58
|
+
const key = createHash('sha512').update(String(password)).digest('base64');
|
|
57
59
|
const key_in_bytes = Buffer.from(key, 'base64')
|
|
58
60
|
const iv = randomBytes(16);
|
|
59
61
|
// create a new cipher
|
|
60
62
|
const _cipher = createCipheriv(algorithm, key_in_bytes, iv);
|
|
61
63
|
const encrypted = _cipher.update(String(str), 'utf8', 'hex') + _cipher.final('hex');
|
|
62
64
|
|
|
65
|
+
this.action('return', 'decipher');
|
|
63
66
|
return {
|
|
64
67
|
iv: iv.toString('base64'),
|
|
65
68
|
key,
|
|
@@ -67,15 +70,24 @@ class LIB {
|
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
/**************
|
|
74
|
+
func: decrypt
|
|
75
|
+
params:
|
|
76
|
+
opts - options for the encryption.
|
|
77
|
+
describe:
|
|
78
|
+
The decrypt function allows for the internal decryption of data based on the
|
|
79
|
+
defined options.
|
|
80
|
+
***************/
|
|
81
|
+
decrypt(opts) {
|
|
82
|
+
const {key, algorithm} = opts;
|
|
83
|
+
const iv = Buffer.from(opts.iv, 'base64');
|
|
84
|
+
const encrypted = Buffer.from(opts.encrypted, 'hex');
|
|
85
|
+
const key_in_bytes = Buffer.from(key, 'base64')
|
|
86
|
+
const decipher = createDecipheriv( algorithm, key_in_bytes, iv);
|
|
87
|
+
const decrypted = decipher.update(encrypted, 'hex', 'utf8');
|
|
88
|
+
const final = Buffer.concat([decrypted, decipher.final('utf8')]);
|
|
89
|
+
this.action('return', 'decipher');
|
|
77
90
|
return final.toString();
|
|
78
|
-
this.state('return', 'decipher');
|
|
79
91
|
}
|
|
80
92
|
|
|
81
93
|
/**************
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "64907438819979111427",
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.20.
|
|
4
|
+
"version": "1.20.4",
|
|
5
5
|
"description": "Deva Core a Vedic-inspired Event Based Context Aware Feature, Zone, Action, and State Machine integrated Artificial Intelligence Framework",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"license": "VLA:64907438819979111427 LICENSE.md",
|