Skip to content

Commit

Permalink
show error message
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra committed Nov 25, 2024
1 parent c8544e1 commit 5980202
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 4 deletions.
4 changes: 2 additions & 2 deletions agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ WORKDIR /app

FROM base AS prod-deps
COPY tsconfig.json /app/tsconfig.json
# COPY patches /app/patches
COPY patches /app/patches
# COPY sphereon-did-auth-siop-0.16.0.tgz /app/sphereon-did-auth-siop-0.16.0.tgz

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod

FROM base AS build
COPY tsconfig.json /app/tsconfig.json
# COPY patches /app/patches
COPY patches /app/patches
# COPY sphereon-did-auth-siop-0.16.0.tgz /app/sphereon-did-auth-siop-0.16.0.tgz

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install
Expand Down
5 changes: 5 additions & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@
"build": "tsc -p tsconfig.json",
"start": "node dist/server.js",
"dev": "tsx watch -r dotenv/config src/server.ts dotenv_config_path=.env.development"
},
"pnpm": {
"patchedDependencies": {
"@sphereon/[email protected]": "patches/@[email protected]"
}
}
}
25 changes: 25 additions & 0 deletions agent/patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/dist/authorization-response/PresentationExchange.js b/dist/authorization-response/PresentationExchange.js
index 547a02a7b58e26e0cd8d6b4398abc1fbb456af01..8dfca1c2ae5252e97b3742d764a87cda2c845bbd 100644
--- a/dist/authorization-response/PresentationExchange.js
+++ b/dist/authorization-response/PresentationExchange.js
@@ -272,15 +272,16 @@ class PresentationExchange {
if (verifyPresentationCallback && evaluationResults.value !== undefined) {
// Verify the signature of all VPs
yield Promise.all(presentationsToVerify.map((presentation) => __awaiter(this, void 0, void 0, function* () {
+ let verificationResult
try {
- const verificationResult = yield verifyPresentationCallback(presentation, evaluationResults.value);
- if (!verificationResult.verified) {
- throw new Error(types_1.SIOPErrors.VERIFIABLE_PRESENTATION_SIGNATURE_NOT_VALID + (verificationResult.reason ? `. ${verificationResult.reason}` : ''));
- }
+ verificationResult = yield verifyPresentationCallback(presentation, evaluationResults.value);
}
catch (error) {
throw new Error(types_1.SIOPErrors.VERIFIABLE_PRESENTATION_SIGNATURE_NOT_VALID);
}
+ if (!verificationResult.verified) {
+ throw new Error(types_1.SIOPErrors.VERIFIABLE_PRESENTATION_SIGNATURE_NOT_VALID + (verificationResult.reason ? `. ${verificationResult.reason}` : ''));
+ }
})));
}
PresentationExchange.assertValidPresentationSubmission(evaluationResults.value);
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@
},
"devDependencies": {
"@biomejs/biome": "^1.8.3"
},
"pnpm": {
"patchedDependencies": {
"@sphereon/[email protected]": "patches/@[email protected]"
}
}
}
25 changes: 25 additions & 0 deletions patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/dist/authorization-response/PresentationExchange.js b/dist/authorization-response/PresentationExchange.js
index 547a02a7b58e26e0cd8d6b4398abc1fbb456af01..8dfca1c2ae5252e97b3742d764a87cda2c845bbd 100644
--- a/dist/authorization-response/PresentationExchange.js
+++ b/dist/authorization-response/PresentationExchange.js
@@ -272,15 +272,16 @@ class PresentationExchange {
if (verifyPresentationCallback && evaluationResults.value !== undefined) {
// Verify the signature of all VPs
yield Promise.all(presentationsToVerify.map((presentation) => __awaiter(this, void 0, void 0, function* () {
+ let verificationResult
try {
- const verificationResult = yield verifyPresentationCallback(presentation, evaluationResults.value);
- if (!verificationResult.verified) {
- throw new Error(types_1.SIOPErrors.VERIFIABLE_PRESENTATION_SIGNATURE_NOT_VALID + (verificationResult.reason ? `. ${verificationResult.reason}` : ''));
- }
+ verificationResult = yield verifyPresentationCallback(presentation, evaluationResults.value);
}
catch (error) {
throw new Error(types_1.SIOPErrors.VERIFIABLE_PRESENTATION_SIGNATURE_NOT_VALID);
}
+ if (!verificationResult.verified) {
+ throw new Error(types_1.SIOPErrors.VERIFIABLE_PRESENTATION_SIGNATURE_NOT_VALID + (verificationResult.reason ? `. ${verificationResult.reason}` : ''));
+ }
})));
}
PresentationExchange.assertValidPresentationSubmission(evaluationResults.value);
10 changes: 8 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5980202

Please sign in to comment.