Skip to content

Commit

Permalink
minor fix on multi cred presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmanos committed Nov 28, 2024
1 parent bd91995 commit bbd3b4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/components/History/HistoryList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import useScreenType from '../../hooks/useScreenType';
import { formatDate } from '../../functions/DateFormat';
import { H3 } from '../Shared/Heading';
import HistoryDetailPopup from '../Popups/HistoryDetailPopup';
import { fromBase64 } from '../../util';

const HistoryList = ({ credentialId = null, history, title = '', limit = null }) => {

Expand All @@ -21,7 +22,10 @@ const HistoryList = ({ credentialId = null, history, title = '', limit = null })
}, [history, credentialId, limit]);

const handleHistoryItemClick = async (item) => {
setMatchingCredentials([item.presentation]);
setMatchingCredentials(item.presentation.startsWith("b64:") ?
[...JSON.parse(new TextDecoder().decode(fromBase64(item.presentation.replace("b64:", ""))))] :
[item.presentation]
);
if (screenType === 'mobile') {
navigate(`/history/${item.id}`);
}
Expand Down
6 changes: 5 additions & 1 deletion src/lib/services/OpenID4VPRelyingParty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { CredentialBatchHelper } from "./CredentialBatchHelper";
import { MDoc, parse } from "@auth0/mdl";
import { JSONPath } from "jsonpath-plus";
import { cborDecode, cborEncode } from "../utils/cbor";
import { toBase64 } from "../../util";

export class OpenID4VPRelyingParty implements IOpenID4VPRelyingParty {

Expand Down Expand Up @@ -434,7 +435,10 @@ export class OpenID4VPRelyingParty implements IOpenID4VPRelyingParty {

const credentialIdentifiers = originalVCs.map((vc) => vc.credentialIdentifier);

const storePresentationPromise = this.storeVerifiablePresentation(generatedVPs[0], presentationSubmission.descriptor_map[0].format, credentialIdentifiers, presentationSubmission, client_id);
const presentations = "b64:" + toBase64(new TextEncoder().encode(JSON.stringify([
...generatedVPs
])));
const storePresentationPromise = this.storeVerifiablePresentation(presentations, "", credentialIdentifiers, presentationSubmission, client_id);
const updateCredentialPromise = filteredVCEntities.map(async (cred) => this.credentialBatchHelper.useCredential(cred))

const updateRepositoryPromise = this.openID4VPRelyingPartyStateRepository.store(S);
Expand Down

0 comments on commit bbd3b4e

Please sign in to comment.