feat: add verification result validation function

This commit is contained in:
Yarmo Mackenbach 2023-09-23 09:44:51 +02:00
parent ba6941448c
commit 264645b381
No known key found for this signature in database
GPG key ID: 3C57D093219103A3

View file

@ -267,8 +267,15 @@ export class Claim {
viaProxy: proofData.viaProxy viaProxy: proofData.viaProxy
} }
// Post process the data // Validate the result
const def = _data[claimData.about.id] const def = _data[claimData.about.id]
if (def.functions?.validate && verificationResult.completed && verificationResult.result) {
try {
(verificationResult.result = await def.functions.validate(claimData, proofData, verificationResult, opts))
} catch (_) {}
}
// Post process the data
if (def.functions?.postprocess) { if (def.functions?.postprocess) {
try { try {
({ claimData, proofData } = await def.functions.postprocess(claimData, proofData, opts)) ({ claimData, proofData } = await def.functions.postprocess(claimData, proofData, opts))