Skip to content

Commit

Permalink
add proof challenge as query param
Browse files Browse the repository at this point in the history
Signed-off-by: F-Node-Karlsruhe <[email protected]>
  • Loading branch information
F-Node-Karlsruhe committed Jun 14, 2023
1 parent fdcece8 commit 320d14f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ WIP
---

- always use id hash as the credential identifier
- add proof challenge as query param


1.5.2 (2023-06-05)
Expand Down
6 changes: 5 additions & 1 deletion api/src/routes/verify/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ export class VerifyRoutes {

try {

const challenge = req.query.challenge || req.query.nonce

if (challenge && typeof challenge != 'string') throw new Error('The challenge/nonce must be provided as a string!');

let tasks = Promise.all(req.body.map(function (verifialbe: Verifiable) {

return Verifier.verify(verifialbe);
return Verifier.verify(verifialbe, challenge);

}));

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/PresentationRequest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default {
const presentationResponse = res.data
const presentation = typeof presentationResponse.vp_token == 'string' ? JSON.parse(presentationResponse.vp_token) : presentationResponse.vp_token;
this.$store.dispatch("addVerifiables", [presentation])
.then(() => this.$router.push({ path: '/verify' }));
.then(() => this.$router.push({ path: '/verify', query: { challenge: this.nonce } }));
})
.catch((error) => {
if (error.response.status != 404) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/Verify.vue
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export default {
this.addCredential({ ...verifiable });
}
const res = await this.$api.post('/', [verifiable]);
const res = await this.$api.post('/', [verifiable], { params: { challenge: this.$route.query.challenge } });
const result = res.data[0];
Expand Down

0 comments on commit 320d14f

Please sign in to comment.