From fc10aeba1c08bd89a35e99a791c0d861b50b1b3a Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Thu, 21 Sep 2023 15:30:35 +0200 Subject: [PATCH] fix: use correct fromJSON() for Profiles and Claims --- src/server/openpgpProfiles.js | 6 ++++-- static-src/kx-claim.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/server/openpgpProfiles.js b/src/server/openpgpProfiles.js index d82eade..6eaaefa 100644 --- a/src/server/openpgpProfiles.js +++ b/src/server/openpgpProfiles.js @@ -58,7 +58,8 @@ const fetchWKD = (id) => { const hash = createHash('md5').update(id).digest('hex') if (c && await c.get(hash)) { - profile = doipjs.Claim.fromJson(JSON.parse(await c.get(hash))) + profile = doipjs.Profile.fromJSON(JSON.parse(await c.get(hash))) + return resolve(profile) } if (!profile) { @@ -147,7 +148,8 @@ const fetchHKP = (id, keyserverDomain) => { const hash = createHash('md5').update(`${query}__${keyserverDomainNormalized}`).digest('hex') if (c && await c.get(hash)) { - profile = doipjs.Claim.fromJson(JSON.parse(await c.get(hash))) + profile = doipjs.Profile.fromJSON(JSON.parse(await c.get(hash))) + return resolve(profile) } if (!profile) { diff --git a/static-src/kx-claim.js b/static-src/kx-claim.js index 75e7e40..87c9f42 100644 --- a/static-src/kx-claim.js +++ b/static-src/kx-claim.js @@ -45,7 +45,7 @@ export class Claim extends HTMLElement { } async verify() { - const claim = doipjs.Claim.fromJson(JSON.parse(this.getAttribute('data-claim'))); + const claim = doipjs.Claim.fromJSON(JSON.parse(this.getAttribute('data-claim'))); await claim.verify({ proxy: { policy: 'adaptive', @@ -59,7 +59,7 @@ export class Claim extends HTMLElement { updateContent(value) { const root = this; const claimJson = JSON.parse(value); - const claim = doipjs.Claim.fromJson(claimJson); + const claim = doipjs.Claim.fromJSON(claimJson); root.querySelector('.info .title').innerText = claimJson.display.name; root.querySelector('.info .subtitle').innerText = claimJson.display.serviceProviderName ??