@aries-framework/anoncreds
Advanced tools
Comparing version 0.4.1-alpha.55 to 0.4.1-alpha.56
@@ -503,2 +503,3 @@ "use strict"; | ||
async processPresentation(messageContext) { | ||
var _a; | ||
const { message: presentationMessage, connection, agentContext } = messageContext; | ||
@@ -535,13 +536,16 @@ agentContext.config.logger.debug(`Processing presentation with message id ${presentationMessage.id}`); | ||
if (!presentationAttachment) { | ||
throw new core_1.AriesFrameworkError('Missing indy proof attachment in processPresentation'); | ||
proofRecord.errorMessage = 'Missing indy proof attachment'; | ||
await this.updateState(agentContext, proofRecord, core_1.ProofState.Abandoned); | ||
throw new errors_1.V1PresentationProblemReportError(proofRecord.errorMessage, { | ||
problemCode: core_1.PresentationProblemReportReason.Abandoned, | ||
}); | ||
} | ||
const requestAttachment = requestMessage.getRequestAttachmentById(messages_1.INDY_PROOF_REQUEST_ATTACHMENT_ID); | ||
if (!requestAttachment) { | ||
throw new core_1.AriesFrameworkError('Missing indy proof request attachment in processPresentation'); | ||
proofRecord.errorMessage = 'Missing indy proof request attachment'; | ||
await this.updateState(agentContext, proofRecord, core_1.ProofState.Abandoned); | ||
throw new errors_1.V1PresentationProblemReportError(proofRecord.errorMessage, { | ||
problemCode: core_1.PresentationProblemReportReason.Abandoned, | ||
}); | ||
} | ||
const isValid = await this.indyProofFormat.processPresentation(agentContext, { | ||
proofRecord, | ||
attachment: presentationAttachment, | ||
requestAttachment, | ||
}); | ||
await didCommMessageRepository.saveAgentMessage(agentContext, { | ||
@@ -552,2 +556,26 @@ agentMessage: presentationMessage, | ||
}); | ||
let isValid; | ||
try { | ||
isValid = await this.indyProofFormat.processPresentation(agentContext, { | ||
proofRecord, | ||
attachment: presentationAttachment, | ||
requestAttachment, | ||
}); | ||
} | ||
catch (error) { | ||
proofRecord.errorMessage = (_a = error.message) !== null && _a !== void 0 ? _a : 'Error verifying proof on presentation'; | ||
proofRecord.isVerified = false; | ||
await this.updateState(agentContext, proofRecord, core_1.ProofState.Abandoned); | ||
throw new errors_1.V1PresentationProblemReportError('Error verifying proof on presentation', { | ||
problemCode: core_1.PresentationProblemReportReason.Abandoned, | ||
}); | ||
} | ||
if (!isValid) { | ||
proofRecord.errorMessage = 'Invalid proof'; | ||
proofRecord.isVerified = false; | ||
await this.updateState(agentContext, proofRecord, core_1.ProofState.Abandoned); | ||
throw new errors_1.V1PresentationProblemReportError('Invalid proof', { | ||
problemCode: core_1.PresentationProblemReportReason.Abandoned, | ||
}); | ||
} | ||
// Update record | ||
@@ -554,0 +582,0 @@ proofRecord.isVerified = isValid; |
@@ -5,3 +5,3 @@ { | ||
"types": "build/index", | ||
"version": "0.4.1-alpha.55+5cac2bea", | ||
"version": "0.4.1-alpha.56+b2ba7c71", | ||
"files": [ | ||
@@ -28,3 +28,3 @@ "build" | ||
"dependencies": { | ||
"@aries-framework/core": "0.4.1-alpha.55+5cac2bea", | ||
"@aries-framework/core": "0.4.1-alpha.56+b2ba7c71", | ||
"bn.js": "^5.2.1", | ||
@@ -36,3 +36,3 @@ "class-transformer": "0.5.1", | ||
"devDependencies": { | ||
"@aries-framework/node": "0.4.1-alpha.55+5cac2bea", | ||
"@aries-framework/node": "0.4.1-alpha.56+b2ba7c71", | ||
"indy-sdk": "^1.16.0-dev-1636", | ||
@@ -43,3 +43,3 @@ "rimraf": "^4.4.0", | ||
}, | ||
"gitHead": "5cac2bea656ba130d5d4cfa2bde4b06d9df92f0f" | ||
"gitHead": "b2ba7c7197139e780cbb95eed77dc0a2ad3b3210" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
781450
10177