From b21a9faeaf342d11365df9a66f4b978eff6635de Mon Sep 17 00:00:00 2001 From: Tim Schauder Date: Tue, 27 Aug 2024 17:18:29 +0200 Subject: [PATCH] Add todo check for nonce --- models/WalletResponse.ts | 3 +-- pages/wallet-redirect.vue | 7 ------- utils/utils.ts | 5 ++++- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/models/WalletResponse.ts b/models/WalletResponse.ts index b1cc9d3..a1fa7b3 100644 --- a/models/WalletResponse.ts +++ b/models/WalletResponse.ts @@ -1,8 +1,7 @@ export type WalletResponse = { state: string; - vp_token: string; // TODO: add string[] + vp_token: string; presentation_submission: PresentationSubmission; - nonce: string; } type PresentationSubmission = { diff --git a/pages/wallet-redirect.vue b/pages/wallet-redirect.vue index 4f6115f..b9710ec 100644 --- a/pages/wallet-redirect.vue +++ b/pages/wallet-redirect.vue @@ -40,13 +40,6 @@ onMounted(async () => { const responseCode = ref() const hash = route.hash - - // TODO: add check for nonce - // const nonce = route.query.nonce - // if (nonce !== vpToken.nonce) { - // errorMessage.value = 'Nonce ist falsch'; - // return; - // } if (hash && presentationId) { try { const params = new URLSearchParams(hash.slice(1)) diff --git a/utils/utils.ts b/utils/utils.ts index aa11006..4be5fc3 100644 --- a/utils/utils.ts +++ b/utils/utils.ts @@ -5,6 +5,8 @@ import * as cbor from 'cbor-web'; import {Buffer} from 'buffer'; export async function getSdJwtClaims(vpToken: string): Promise<{ key: string; value: string }[] | undefined> { + // TODO: edit for multiple Presentations + check nonce + try { const decodedSdJwt: DecodedSDJwt = await decodeSdJwt(vpToken, digest); return await getClaims( @@ -19,6 +21,8 @@ export async function getSdJwtClaims(vpToken: string): Promise<{ key: string; v } export async function getMdocClaims(vpToken: string): Promise<{ + // TODO: edit for multiple Presentations + check nonce + [p: string]: { key: string; value: string } } | undefined> { try { @@ -29,7 +33,6 @@ export async function getMdocClaims(vpToken: string): Promise<{ preferWeb: true }); - // TODO: edit for multiple Presentations const namespaces = valueOut.documents[0].issuerSigned.nameSpaces; const firstNamespace = Object.entries(namespaces)[0][0]; const dataArray: TagValue[] = namespaces[firstNamespace];