Skip to content

Commit

Permalink
assign pres to cred before verification
Browse files Browse the repository at this point in the history
  • Loading branch information
F-Node-Karlsruhe committed Feb 8, 2023
1 parent fda7c10 commit 2871849
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ VC Verifier Changelog

WIP
---

- allow arrays in the proof field of a verifiable
- assign basic presentation props to credential before verification


1.0.0 (2023-02-07)
Expand Down
23 changes: 16 additions & 7 deletions frontend/src/views/Verify.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
<div class="credentialid mt-1"><a :href="credential.id">{{ credential.id }}</a></div>
</div>
<div class="col-2 text-end">
<a v-if="credential.presentation" tabindex="0" style="display: inline-block;" type="button"
class="me-3" data-bs-container="body" data-bs-toggle="tooltip"
<a v-if="credential.presentation && credential.presentation.verified != undefined"
tabindex="0" style="display: inline-block;" type="button" class="me-3"
data-bs-container="body" data-bs-toggle="tooltip"
:data-bs-title="'Presentation ' + credential.presentation.status">
<i v-if="credential.presentation.verified" style="font-size: 1.25rem;"
class="bi bi-card-checklist text-success" role="img" aria-label="Verified"></i>
Expand Down Expand Up @@ -373,10 +374,18 @@ export default {
const verifyTasks = Promise.all(this.verifiables.map(async (verifiable) => {
if (getVerifiableType(verifiable) == VerifiableType.PRESENTATION) {
if (Array.isArray(verifiable.verifiableCredential)) this.credentials = this.credentials.concat(verifiable.verifiableCredential)
else this.credentials.push(verifiable.verifiableCredential)
const presentation = {
holder: verifiable.holder,
challenge: verifiable.proof.challenge,
domain: verifiable.proof.domain
}
if (Array.isArray(verifiable.verifiableCredential)) this.credentials = this.credentials.concat(verifiable.verifiableCredential.map((credential) => { return { ...credential, presentation } }));
else this.credentials.push({ ...verifiable.verifiableCredential, presentation });
} else {
this.credentials.push(verifiable)
this.credentials.push(verifiable);
}
const res = await this.$api.post('/', [verifiable]);
Expand All @@ -393,11 +402,11 @@ export default {
holder: verifiable.holder,
challenge: verifiable.proof.challenge,
domain: verifiable.proof.domain,
status: 'verified'
status: 'verified!'
}
if (presentation.presentationResult && !presentation.verified) {
presentation.status = 'partially verified'
presentation.status = 'partially verified!'
this.toast.warning(`Presentation of ${presentation.holder ? 'of holder' + presentation.holder.id || presentation.holder : ''} contains invalid credentials!`);
}
Expand Down

0 comments on commit 2871849

Please sign in to comment.