Improve examples

This commit is contained in:
Yarmo Mackenbach 2022-02-08 18:48:57 +01:00
parent 6cd0307617
commit 498ad7bff0
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1
2 changed files with 13 additions and 4 deletions

View file

@ -7,8 +7,17 @@ const main = async () => {
// Process it to extract the UIDs and their claims // Process it to extract the UIDs and their claims
const obj = await doip.keys.process(key) const obj = await doip.keys.process(key)
// Log the claims of the first UID // Process every claim for every user
console.log(obj.users[0].claims) 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() main()

View file

@ -5,10 +5,10 @@ const main = async () => {
const claim = new doip.Claim("dns:doip.rocks", "3637202523e7c1309ab79e99ef2dc5827b445f4b") const claim = new doip.Claim("dns:doip.rocks", "3637202523e7c1309ab79e99ef2dc5827b445f4b")
// Match it to candidate service providers // Match it to candidate service providers
claim.match(); claim.match()
// Verify the claim // Verify the claim
await claim.verify(); await claim.verify()
// Log the claims of the first UID // Log the claims of the first UID
console.log(claim) console.log(claim)