@onlineapps/service-validator-core 1.0.10 → 1.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/service-validator-core",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Core validation logic for microservices",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -43,6 +43,12 @@ class ValidationProofSchema {
43
43
  description: 'Validator version',
44
44
  example: '1.0.0'
45
45
  },
46
+ contractFingerprint: {
47
+ type: 'string',
48
+ required: false,
49
+ description: 'Fingerprint of the service contract (operations, config, version)',
50
+ example: 'a1b2c3d4...'
51
+ },
46
52
 
47
53
  // Timestamp
48
54
  validatedAt: {
@@ -39,22 +39,9 @@ class FingerprintUtils {
39
39
  } else if (typeof data === 'string') {
40
40
  input = data;
41
41
  } else if (typeof data === 'object' && data !== null) {
42
- // Deep sort object keys for deterministic fingerprinting
43
- const deepSort = (obj) => {
44
- if (Array.isArray(obj)) {
45
- return obj.map(deepSort);
46
- }
47
- if (obj !== null && typeof obj === 'object') {
48
- return Object.keys(obj)
49
- .sort()
50
- .reduce((acc, key) => {
51
- acc[key] = deepSort(obj[key]);
52
- return acc;
53
- }, {});
54
- }
55
- return obj;
56
- };
57
- input = JSON.stringify(deepSort(data));
42
+ // Serialize object with optional key sorting
43
+ const keys = sortKeys ? Object.keys(data).sort() : Object.keys(data);
44
+ input = JSON.stringify(data, keys);
58
45
  } else {
59
46
  // Primitives (number, boolean, null, undefined)
60
47
  input = String(data);