forked from Mirrors/doipjs
Make claims.verify handle notations from all users
This commit is contained in:
parent
b70065b15c
commit
580510d0d0
1 changed files with 18 additions and 3 deletions
|
@ -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) => {
|
||||||
|
|
Loading…
Reference in a new issue