Make claims.verify handle notations from all users

This commit is contained in:
Yarmo Mackenbach 2020-11-20 23:20:26 +01:00
parent b70065b15c
commit 580510d0d0

View file

@ -108,9 +108,24 @@ const runVerification = (proofData, spData) => {
const verify = async (input, fingerprint, opts) => { const verify = async (input, fingerprint, opts) => {
if (input instanceof openpgp.key.Key) { if (input instanceof openpgp.key.Key) {
const fingerprintLocal = await keys.getFingerprint(input) const fingerprintFromKey = await keys.getFingerprint(input)
const claims = await keys.getClaims(input) const userData = await keys.getUserData(input)
return await verify(claims, fingerprintLocal, opts)
const promises = userData.map(async (user, i) => {
return new Promise(async (resolve, reject) => {
try {
const res = await verify(user.notations, fingerprintFromKey, opts)
resolve(res)
} catch (e) {
console.error(`Claim verification failed: ${user.userData.id}`, e)
reject(e)
}
})
})
return Promise.all(promises).then((values) => {
return values
})
} }
if (input instanceof Array) { if (input instanceof Array) {
const promises = input.map(async (uri, i) => { const promises = input.map(async (uri, i) => {