fix: handle doip promise rejection

This commit is contained in:
Yarmo Mackenbach 2023-08-31 14:38:03 +02:00
parent 44f9664300
commit 1373f14587
No known key found for this signature in database
GPG key ID: 3C57D093219103A3

View file

@ -102,7 +102,16 @@ const fetchWKD = (id) => {
reject(new Error('No public keys could be read from the data fetched using WKD')) reject(new Error('No public keys could be read from the data fetched using WKD'))
} }
try {
profile = await doipjs.openpgp.parsePublicKey(publicKey) profile = await doipjs.openpgp.parsePublicKey(publicKey)
} catch (error) {
profile = null
}
if (!profile) {
reject(new Error('No public keys could be fetched using WKD'))
return
}
profile.publicKey.fetch.method = 'wkd' profile.publicKey.fetch.method = 'wkd'
profile.publicKey.fetch.query = id profile.publicKey.fetch.query = id
profile.publicKey.fetch.resolvedUrl = fetchURL profile.publicKey.fetch.resolvedUrl = fetchURL