Skip to content

Commit

Permalink
fix presentation ui for proof arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
F-Node-Karlsruhe committed Mar 17, 2023
1 parent fdc8c0a commit 37ec9c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions frontend/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export function getVerifiableType(verifiable) {
return VerifiableType.CREDENTIAL;
}

export function getHolder(presentation) {
if (presentation.holder) return presentation.holder;
const proof = Array.isArray(presentation.proof) ? presentation.proof[0] : presentation.proof
return proof.verificationMethod.split('#')[0];
}

export async function getContext(credential) {
const resolved = await jsonld.processContext(await jsonld.processContext(null, null), credential);
return resolved.mappings;
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/views/Verify.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<script>
import { useToast } from "vue-toastification";
import { Tooltip } from 'bootstrap';
import { getVerifiableType, VerifiableType, getContext } from '../utils.js';
import { getVerifiableType, VerifiableType, getContext, getHolder } from '../utils.js';
import Passport from "@/components/Passport.vue";
Expand Down Expand Up @@ -196,9 +196,9 @@ export default {
const presentation = {
presentation:
{
holder: verifiable.holder,
challenge: verifiable.proof.challenge,
domain: verifiable.proof.domain
holder: getHolder(verifiable),
challenge: Array.isArray(verifiable.proof) ? verifiable.proof[0].challenge : verifiable.proof.challenge,
domain: Array.isArray(verifiable.proof) ? verifiable.proof[0].domain : verifiable.proof.domain
}
}
Expand All @@ -222,9 +222,9 @@ export default {
var presentation = {
verified: result.verified,
presentationResult: result.presentationResult.verified,
holder: verifiable.holder,
challenge: verifiable.proof.challenge,
domain: verifiable.proof.domain,
holder: getHolder(verifiable),
challenge: Array.isArray(verifiable.proof) ? verifiable.proof[0].challenge : verifiable.proof.challenge,
domain: Array.isArray(verifiable.proof) ? verifiable.proof[0].domain : verifiable.proof.domain,
status: 'verified!'
}
Expand Down

0 comments on commit 37ec9c4

Please sign in to comment.