@indra.ai/deva 1.64.48 → 1.64.50
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/_data/tests.json +1 -1
- package/package.json +2 -2
- package/tests/suite/03-hash.test.js +26 -0
package/_data/tests.json
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"file": "03-hash.test.js",
|
|
32
32
|
"title": "Hash",
|
|
33
33
|
"describe": "The md5, sha256 and sha512 tiers match node:crypto, every hashing site carries all three, the uid fingerprint holds, and one changed field breaks every tier.",
|
|
34
|
-
"count":
|
|
34
|
+
"count": 10
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
"file": "04-license.test.js",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "31711622713594414221",
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.64.
|
|
4
|
+
"version": "1.64.50",
|
|
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:31711622713594414221 LICENSE.md",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"bugs": {
|
|
75
75
|
"url": "https://github.com/indraai/deva/issues"
|
|
76
76
|
},
|
|
77
|
-
"homepage": "https://
|
|
77
|
+
"homepage": "https://deva.world",
|
|
78
78
|
"eslintConfig": {
|
|
79
79
|
"parserOptions": {
|
|
80
80
|
"ecmaVersion": 6
|
|
@@ -70,4 +70,30 @@ test('changing one field breaks every tier', () => {
|
|
|
70
70
|
const stamped = deva.client();
|
|
71
71
|
const tampered = {...stamped, key: `${stamped.key}x`};
|
|
72
72
|
assert.throws(() => verifyTiers(tampered, 'tampered'), /md5/);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('_stamp() matches a manual cumulative hash of the same data', () => {
|
|
76
|
+
const data = {id: {uid: 'stamp-test'}, text: 'deva', n: 108};
|
|
77
|
+
const manual = {...data};
|
|
78
|
+
for (const t of TIERS) manual[t] = digest(manual, t);
|
|
79
|
+
const stamped = deva._stamp({...data}, 'stamp-test', 'stamp-test');
|
|
80
|
+
for (const t of TIERS) assert.equal(stamped[t], manual[t], t);
|
|
81
|
+
verifyTiers(stamped, '_stamp()');
|
|
82
|
+
});
|
|
83
|
+
test('_unstamp() then _stamp() gives back the same hashes', () => {
|
|
84
|
+
const stamped = deva._stamp({id: {uid: 'restamp'}, text: 'again'});
|
|
85
|
+
const first = {...stamped};
|
|
86
|
+
const again = deva._stamp(deva._unstamp({...stamped}));
|
|
87
|
+
for (const t of TIERS) assert.equal(again[t], first[t], t);
|
|
88
|
+
});
|
|
89
|
+
test('_stamp() without _unstamp() first hashes the old tiers in and changes them', () => {
|
|
90
|
+
const stamped = deva._stamp({id: {uid: 'double'}, text: 'twice'});
|
|
91
|
+
const first = {...stamped};
|
|
92
|
+
const twice = deva._stamp({...stamped});
|
|
93
|
+
for (const t of TIERS) assert.notEqual(twice[t], first[t], t);
|
|
94
|
+
});
|
|
95
|
+
test('_unstamp() removes every tier and leaves the data', () => {
|
|
96
|
+
const bare = deva._unstamp(deva._stamp({id: {uid: 'bare'}, text: 'clean'}));
|
|
97
|
+
for (const t of TIERS) assert.equal(t in bare, false, t);
|
|
98
|
+
assert.deepEqual(bare, {id: {uid: 'bare'}, text: 'clean'});
|
|
73
99
|
});
|