fix: use correct fromJSON() for Profiles and Claims

This commit is contained in:
Yarmo Mackenbach 2023-09-21 15:30:35 +02:00
parent 7ce2287894
commit fc10aeba1c
No known key found for this signature in database
GPG key ID: 3C57D093219103A3
2 changed files with 6 additions and 4 deletions

View file

@ -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) {

View file

@ -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 ??