mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 22:49:28 -07:00
Ensure an output of the verification process
This commit is contained in:
parent
e718c02628
commit
41d3b16029
1 changed files with 15 additions and 7 deletions
22
src/claim.js
22
src/claim.js
|
@ -213,7 +213,7 @@ class Claim {
|
|||
for (let index = 0; index < this._matches.length; index++) {
|
||||
const claimData = this._matches[index]
|
||||
|
||||
let verificationResult,
|
||||
let verificationResult = null,
|
||||
proofData = null,
|
||||
proofFetchError
|
||||
|
||||
|
@ -235,18 +235,18 @@ class Claim {
|
|||
viaProxy: proofData.viaProxy,
|
||||
}
|
||||
} else {
|
||||
if (this.isAmbiguous()) {
|
||||
// Assume a wrong match and continue
|
||||
continue
|
||||
}
|
||||
|
||||
// Consider the proof completed but with a negative result
|
||||
verificationResult = {
|
||||
verificationResult = verificationResult ? verificationResult : {
|
||||
result: false,
|
||||
completed: true,
|
||||
proof: {},
|
||||
errors: [proofFetchError],
|
||||
}
|
||||
|
||||
if (this.isAmbiguous()) {
|
||||
// Assume a wrong match and continue
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (verificationResult.completed) {
|
||||
|
@ -257,6 +257,14 @@ class Claim {
|
|||
}
|
||||
}
|
||||
|
||||
// Fail safe verification result
|
||||
verificationResult = verificationResult ? verificationResult : {
|
||||
result: false,
|
||||
completed: true,
|
||||
proof: {},
|
||||
errors: ['Unknown error'],
|
||||
}
|
||||
|
||||
this._status = E.ClaimStatus.VERIFIED
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue