From 03cfd71c4536c3893d385abe4fcb96e0a8cc68bc Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Sat, 29 Jun 2024 07:34:37 +0200 Subject: [PATCH] use a subset of type UserDto for fingerprint calc --- frontend/src/common/wot.ts | 2 +- .../src/components/AuditLogDetailsSignedWotId.vue | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/frontend/src/common/wot.ts b/frontend/src/common/wot.ts index 3369b933..dcf5fb67 100644 --- a/frontend/src/common/wot.ts +++ b/frontend/src/common/wot.ts @@ -80,7 +80,7 @@ async function verifyRescursive(signatureChain: string[], signerPublicKey: Crypt * @param user The user whose fingerprint to compute * @returns Hexadecimal representation of the fingerprint */ -async function computeFingerprint(user: UserDto) { +async function computeFingerprint(user: { ecdhPublicKey?: string; ecdsaPublicKey?: string }) { if (!user.ecdhPublicKey || !user.ecdsaPublicKey) { throw new Error('User has no public keys'); } diff --git a/frontend/src/components/AuditLogDetailsSignedWotId.vue b/frontend/src/components/AuditLogDetailsSignedWotId.vue index f9e57ee0..a537e6fa 100644 --- a/frontend/src/components/AuditLogDetailsSignedWotId.vue +++ b/frontend/src/components/AuditLogDetailsSignedWotId.vue @@ -77,17 +77,7 @@ onMounted(async () => { try { const signerPublicKey = await asPublicKey(base64.parse(props.event.signerKey), UserKeys.ECDSA_KEY_DESIGNATION, UserKeys.ECDSA_PUB_KEY_USAGES); const [_, signedKeys] = await JWT.parse(props.event.signature, signerPublicKey) as [JWTHeader, SignedKeys]; - const signedUser: UserDto = { - id: props.event.userId, - type: 'USER', - email: '', // irrelevant for this purpose - name: '', // irrelevant for this purpose - devices: [], // irrelevant for this purpose - accessibleVaults: [], // irrelevant for this purpose - ecdhPublicKey: signedKeys.ecdhPublicKey, - ecdsaPublicKey: signedKeys.ecdsaPublicKey - }; - signedFingerprint.value = await wot.computeFingerprint(signedUser); + signedFingerprint.value = await wot.computeFingerprint({ecdhPublicKey: signedKeys.ecdhPublicKey, ecdsaPublicKey: signedKeys.ecdsaPublicKey}); if (props.event.signerKey === signingUser?.ecdsaPublicKey && signedFingerprint.value === currentFingerprint.value) { signatureStatus.value = SignatureStatus.STILL_VALID; } else if (props.event.signerKey !== signingUser?.ecdsaPublicKey) {