From 498ad7bff038bff7c26c0009f7bcda8048ed4027 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Tue, 8 Feb 2022 18:48:57 +0100 Subject: [PATCH] Improve examples --- examples/fetch-key-hkp.js | 13 +++++++++++-- examples/verify-claim.js | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/examples/fetch-key-hkp.js b/examples/fetch-key-hkp.js index ef36df2..b8aed23 100644 --- a/examples/fetch-key-hkp.js +++ b/examples/fetch-key-hkp.js @@ -7,8 +7,17 @@ const main = async () => { // Process it to extract the UIDs and their claims const obj = await doip.keys.process(key) - // Log the claims of the first UID - console.log(obj.users[0].claims) + // Process every claim for every user + obj.users.forEach(async user => { + user.claims.forEach(async claim => { + // Match the claim + await claim.match() + + // Verify the claim + await claim.verify() + console.log(claim) + }) + }) } main() \ No newline at end of file diff --git a/examples/verify-claim.js b/examples/verify-claim.js index c62eb2d..6f2613c 100644 --- a/examples/verify-claim.js +++ b/examples/verify-claim.js @@ -5,10 +5,10 @@ const main = async () => { const claim = new doip.Claim("dns:doip.rocks", "3637202523e7c1309ab79e99ef2dc5827b445f4b") // Match it to candidate service providers - claim.match(); + claim.match() // Verify the claim - await claim.verify(); + await claim.verify() // Log the claims of the first UID console.log(claim)