@onlineapps/service-validator-core 1.0.2 → 1.0.3
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
|
@@ -66,7 +66,7 @@ class ValidationProofVerifier {
|
|
|
66
66
|
console.log('[ValidationProofVerifier] ✓ Hash integrity verified');
|
|
67
67
|
|
|
68
68
|
// 4. Check required validationData fields
|
|
69
|
-
const requiredFields = ['serviceName', 'version', 'testsRun', 'testsPassed', 'testsFailed', 'validator', '
|
|
69
|
+
const requiredFields = ['serviceName', 'version', 'testsRun', 'testsPassed', 'testsFailed', 'validator', 'validatedAt'];
|
|
70
70
|
for (const field of requiredFields) {
|
|
71
71
|
if (data[field] === undefined || data[field] === null) {
|
|
72
72
|
console.error(`[ValidationProofVerifier] ❌ Missing required field: ${field}`);
|
|
@@ -80,7 +80,7 @@ class ValidationProofVerifier {
|
|
|
80
80
|
console.log('[ValidationProofVerifier] ✓ All required fields present');
|
|
81
81
|
|
|
82
82
|
// 5. Check proof age
|
|
83
|
-
const proofDate = new Date(data.
|
|
83
|
+
const proofDate = new Date(data.validatedAt);
|
|
84
84
|
const now = new Date();
|
|
85
85
|
const age = now - proofDate;
|
|
86
86
|
|
|
@@ -160,17 +160,8 @@ class ValidationProofVerifier {
|
|
|
160
160
|
* @private
|
|
161
161
|
*/
|
|
162
162
|
_generateHash(data) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
version: data.version,
|
|
166
|
-
testsRun: data.testsRun,
|
|
167
|
-
testsPassed: data.testsPassed,
|
|
168
|
-
testsFailed: data.testsFailed,
|
|
169
|
-
validator: data.validator,
|
|
170
|
-
timestamp: data.timestamp,
|
|
171
|
-
fingerprint: data.fingerprint || ''
|
|
172
|
-
}, null, 0); // No whitespace for consistency
|
|
173
|
-
|
|
163
|
+
// Match ValidationProofGenerator algorithm: stringify with sorted keys
|
|
164
|
+
const hashInput = JSON.stringify(data, Object.keys(data).sort());
|
|
174
165
|
return crypto.createHash('sha256').update(hashInput).digest('hex');
|
|
175
166
|
}
|
|
176
167
|
}
|