Skip to content

Commit

Permalink
Add logs for debugging purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
Jdu278 committed Aug 22, 2024
1 parent f059156 commit 9286b98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions pages/wallet-redirect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ onMounted(async () => {
// errorMessage.value = 'Nonce ist falsch';
// return;
// }
console.log('presentationId', presentationId, 'hash', hash);
if (hash && presentationId) {
try {
const params = new URLSearchParams(hash.slice(1))
Expand All @@ -58,9 +58,12 @@ onMounted(async () => {
);
vpToken = response.data.vp_token;
// TODO: add proper check
if (vpToken.includes('ey')) {
const sdJwtClaims = await getSdJwtClaims(vpToken)
console.log('These are the claims', sdJwtClaims)
if (sdJwtClaims) {
console.log('sdJwtClaims', sdJwtClaims)
dataList.value = Object.entries(sdJwtClaims)
.filter(([key]) => !['cnf', 'exp', 'iat', 'iss', 'vct'].includes(key))
.map(([key, value]) => ({
Expand All @@ -73,7 +76,9 @@ onMounted(async () => {
}
} else {
const mdocClaims = await getMdocClaims(vpToken)
console.log('mdocClaims', mdocClaims)
if (mdocClaims) {
console.log('mdocClaims', mdocClaims)
dataList.value = Object.entries(mdocClaims).map(([, valueObj]) => ({
key: valueObj.key,
value: valueObj.value
Expand All @@ -83,7 +88,8 @@ onMounted(async () => {
errorMessage.value = 'Fehler beim Abrufen der Daten';
}
}
} catch {
} catch (error) {
console.log('Error wallet redirect', error)
errorMessage.value = 'Fehler beim Abrufen der Daten';
}
} else {
Expand Down
6 changes: 4 additions & 2 deletions utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export async function getSdJwtClaims(vpToken: string): Promise<{ key: string; v
decodedSdJwt.disclosures,
digest,
)
} catch {
} catch (error) {
console.log('Error during getSdJwtClaims', error);
throw Error()
}
}
Expand Down Expand Up @@ -42,7 +43,8 @@ export async function getMdocClaims(vpToken: string): Promise<{
return Object.fromEntries(
Object.entries(claims)) as { [key: string]: { key: string; value: string } };

} catch {
} catch (error) {
console.log('Error during getmdocclaims', error);
throw Error()
}
}
Expand Down

0 comments on commit 9286b98

Please sign in to comment.