Skip to content

Commit

Permalink
Merge pull request #1913 from blockchain-certificates/feat/support-ve…
Browse files Browse the repository at this point in the history
…rifiable-presentation

fix(VerifiablePresentation): verify all certificates of a presentation
  • Loading branch information
lemoustachiste authored Nov 27, 2024
2 parents afd4953 + 828b019 commit 04a6704
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
5 changes: 1 addition & 4 deletions bundle-esm-stats.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/certificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ export default class Certificate {
message: `Credential ${vc.name ? vc.name + ' ' : ''}with id ${vc.id} failed verification. Error: ${verificationStatus.message}`,
errors: [verificationStatus]
};
break;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/v3/mocknet-verifiable-presentation.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"@context": ["https://www.w3.org/ns/credentials/v2", "https://w3id.org/security/data-integrity/v2"], "id": "urn:uuid:bbba9667-8ec1-445f-82c9-a57251dd731c", "type": ["VerifiablePresentation"], "holder": "did:example:ebfeb1f712ebc6f1c276e12ec21", "verifiableCredential": [{"@context": ["https://www.w3.org/ns/credentials/v2", "https://w3id.org/security/data-integrity/v2", "https://w3id.org/blockcerts/v3.1"], "id": "urn:uuid:bbba8553-8ec1-445f-82c9-a57251dd731c", "type": ["VerifiableCredential", "BlockcertsCredential"], "issuer": "https://www.blockcerts.org/samples/3.0/issuer-blockcerts.json", "validFrom": "2022-07-13T20:21:40.088Z", "validUntil": "2039-07-13T00:00:00.000Z", "credentialSubject": {"id": "did:example:ebfeb1f712ebc6f1c276e12ec21", "name": "Julien Fraichot", "email": "[email protected]", "publicKey": "ecdsa-koblitz-pubkey:1BPQXndcz5Uf3qZQkgnvJC87LUD5n7a2mC", "claim": {"name": "Master of Puppets", "description": "Awarded to those who rock"}}, "metadata": "{\"classOf\":\"2021\"}", "display": {"contentMediaType": "text/html", "content": "<div style=\"background-color:transparent;padding:6px;display:inline-flex;align-items:center;flex-direction:column\">Yo</div>"}, "proof": {"id": "urn:uuid:e0dc671b-fd28-43d4-a2eb-24535a04f2d1", "type": "DataIntegrityProof", "cryptosuite": "merkle-proof-2019", "proofPurpose": "assertionMethod", "created": "2024-11-18T15:15:25Z", "proofValue": "zEuZQLZTYrdsDv2FbpkZtthsgpG54RGrfTSvyUNDGi1ecmJdY9KMtFSxbbs6pEspqa38GgXJD9ReRosEBrXsXKu4Nk7xMGnm6wfzuCUiwwBCXKrfs8e8r6a1gbyXbzifiJprkeVD9UtaVtdb5QXKHPRikuQR8F9epBejTF7MfQukr1T5U7mZ8nSuKXDJ5epzg6mCANdCFt8ZrYZiLUZGrWpd33BfeuyaJxSGYcfMgjzJGvLnoZpAXHi1MWpNFhxxuTn6BtUbivTJqQhgzUDoXaErWeMEe1z8wRR5TgzNaoULxGp", "verificationMethod": "https://www.blockcerts.org/samples/3.0/issuer-blockcerts.json#key-1"}}, {"@context": ["https://www.w3.org/ns/credentials/v2", {"DOB": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/DOB", "@type": "https://schema.org/Text"}, "nationality": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/nationality", "@type": "https://schema.org/Text"}, "height": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/height", "@type": "https://schema.org/Text"}, "residentialAddressStreet": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/residentialAddressStreet", "@type": "https://schema.org/Text"}, "residentialAddressTown": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/residentialAddressTown", "@type": "https://schema.org/Text"}, "residentialAddressPostCode": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/residentialAddressPostCode", "@type": "https://schema.org/Text"}, "IdCardCredential": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/IdCardCredential", "@type": "https://schema.org/DataType"}}, "https://w3id.org/security/data-integrity/v2", "https://w3id.org/blockcerts/v3.2"], "type": ["VerifiableCredential", "BlockcertsCredential", "IdCardCredential"], "name": [{"@value": "Canadian Id Card", "@language": "en"}, {"@value": "Carte d'Identit\u00e9 Canadienne", "@language": "fr"}, {"@value": "\u0628\u0637\u0627\u0642\u0629 \u0627\u0644\u0647\u0648\u064a\u0629 \u0627\u0644\u0643\u0646\u062f\u064a\u0629", "@language": "ar"}], "description": [{"@value": "A Blockcerts example (not an official document) highlighting various VC v2 spec items", "@language": "en"}, {"@value": "Un example Blockcerts (document non officiel) d\u00e9montrant diff\u00e9rents \u00e9l\u00e9ments de la sp\u00e9cification VC v2", "@language": "fr"}, {"@value": "\u0645\u062b\u0627\u0644 \u0639\u0644\u0649 Blockcerts (\u0644\u064a\u0633 \u0645\u0633\u062a\u0646\u062f\u064b\u0627 \u0631\u0633\u0645\u064a\u064b\u0627) \u064a\u0633\u0644\u0637 \u0627\u0644\u0636\u0648\u0621 \u0639\u0644\u0649 \u0639\u0646\u0627\u0635\u0631 \u0645\u0648\u0627\u0635\u0641\u0627\u062a VC v2 \u0627\u0644\u0645\u062e\u062a\u0644\u0641\u0629", "@language": "ar"}], "issuer": "https://www.blockcerts.org/samples/3.0/issuer-blockcerts.json", "validFrom": "2024-03-01T00:00:00Z", "validUntil": "2039-02-28T23:59:59Z", "id": "urn:uuid:4f5f0100-ccbf-4ca9-9cfc-4f5fc3052d28", "credentialSchema": [{"id": "https://www.blockcerts.org/samples/3.0/example-id-card-schema.json", "type": "JsonSchema"}], "credentialSubject": {"id": "did:example:ebfeb1f712ebc6f1c276e12ec21", "name": "John Smith", "nationality": "Canada", "DOB": "05/10/1983", "height": "1.80m", "residentialAddressStreet": "6 Maple Tree street", "residentialAddressTown": "Toronto", "residentialAddressPostCode": "YYZYUL"}, "display": {"contentMediaType": "text/html", "content": "<div style=\"background-color:transparent;padding:6px;display:inline-flex;align-items:center;flex-direction:column\">Yo</div>"}, "proof": {"id": "urn:uuid:5f7a5393-4fc5-4804-956d-f4e21eefa2e0", "type": "DataIntegrityProof", "cryptosuite": "merkle-proof-2019", "proofPurpose": "assertionMethod", "created": "2024-11-05T15:09:46Z", "proofValue": "zEuZQLZTYrdsDv2HJ1WCR1o1t2bNMqtrFkM67ELRNg5Zooe2UHYkJYYwa6VSHVxymPyeQ1XQLkmvH6YPXX9U2WPUdgsopMMcMfiHaGGm8K4fcLBjHMkmfJpMyBDvFXSCJKNu4Ca5q2k9w4BwQJt3bzjxp1RwrsMxGNsrroTmaXuUfGe1EdiNCvvxUW4GnaoCnN9pawfP1gSqB2GBA1TogxZzi8EsRsnswAHAcD1cMpx1r64cBaEc2biYLf5DekCXqUjbVZXA1DrGS22jmjvzyk6Zw7MDjETkSw6HJhFhAnSRCUY", "verificationMethod": "https://www.blockcerts.org/samples/3.0/issuer-blockcerts.json#key-1"}}], "proof": {"id": "urn:uuid:9b315c9c-f7d5-4467-9d8e-987b7876ff60", "type": "DataIntegrityProof", "cryptosuite": "merkle-proof-2019", "proofPurpose": "assertionMethod", "created": "2024-11-18T16:55:15Z", "proofValue": "zEuZQLZTYrdsDv2cLE9nmDcak89qahzxUSxUK5L8EnKepu6EDTQZEK4t3ByoKkKqMbGynA5siezfvs88mxhYkJ3EVVsPzt5YL1JDuxgjKU2F8hWVWZoAy6Et8zhKEk3CJTvebFnQPgVa4t7dNfHPWkacdzRuY4tVQEmj9k2KnwSU1NrTf2TF5Ky5hpk41CGWxQmrE9RooPasqL8YP81QXXG5KsoV3twpoA3cCk7qQgtGxLvRp6p7L18HTmpZWFjG1oLfuDu8Qmiu2goTSoWv33YQeMGZNcexDM7qQo96VhSRYUp", "verificationMethod": "https://www.blockcerts.org/samples/3.0/issuer-blockcerts.json#key-1"}}
{"@context": ["https://www.w3.org/ns/credentials/v2", "https://w3id.org/security/data-integrity/v2"], "id": "urn:uuid:bbba9667-8ec1-445f-82c9-a57251dd731c", "type": ["VerifiablePresentation"], "holder": "did:example:ebfeb1f712ebc6f1c276e12ec21", "verifiableCredential": [{"@context": ["https://www.w3.org/ns/credentials/v2", "https://w3id.org/security/data-integrity/v2", "https://w3id.org/blockcerts/v3.1"], "id": "urn:uuid:bbba8553-8ec1-445f-82c9-a57251dd731c", "type": ["VerifiableCredential", "BlockcertsCredential"], "issuer": "https://www.blockcerts.org/samples/3.0/issuer-blockcerts.json", "validFrom": "2022-07-13T20:21:40.088Z", "validUntil": "2039-07-13T00:00:00.000Z", "credentialSubject": {"id": "did:example:ebfeb1f712ebc6f1c276e12ec21", "name": "Julien Fraichot", "email": "[email protected]", "publicKey": "ecdsa-koblitz-pubkey:1BPQXndcz5Uf3qZQkgnvJC87LUD5n7a2mC", "claim": {"name": "Master of Puppets", "description": "Awarded to those who rock"}}, "metadata": "{\"classOf\":\"2021\"}", "display": {"contentMediaType": "text/html", "content": "<div style=\"background-color:transparent;padding:6px;display:inline-flex;align-items:center;flex-direction:column\">Yo</div>"}, "proof": {"id": "urn:uuid:e0dc671b-fd28-43d4-a2eb-24535a04f2d1", "type": "DataIntegrityProof", "cryptosuite": "merkle-proof-2019", "proofPurpose": "assertionMethod", "created": "2024-11-18T15:15:25Z", "proofValue": "zEuZQLZTYrdsDv2FbpkZtthsgpG54RGrfTSvyUNDGi1ecmJdY9KMtFSxbbs6pEspqa38GgXJD9ReRosEBrXsXKu4Nk7xMGnm6wfzuCUiwwBCXKrfs8e8r6a1gbyXbzifiJprkeVD9UtaVtdb5QXKHPRikuQR8F9epBejTF7MfQukr1T5U7mZ8nSuKXDJ5epzg6mCANdCFt8ZrYZiLUZGrWpd33BfeuyaJxSGYcfMgjzJGvLnoZpAXHi1MWpNFhxxuTn6BtUbivTJqQhgzUDoXaErWeMEe1z8wRR5TgzNaoULxGp", "verificationMethod": "https://www.blockcerts.org/samples/3.0/issuer-blockcerts.json#key-1"}}, {"@context": ["https://www.w3.org/ns/credentials/v2", {"DOB": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/DOB", "@type": "https://schema.org/Text"}, "nationality": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/nationality", "@type": "https://schema.org/Text"}, "height": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/height", "@type": "https://schema.org/Text"}, "residentialAddressStreet": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/residentialAddressStreet", "@type": "https://schema.org/Text"}, "residentialAddressTown": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/residentialAddressTown", "@type": "https://schema.org/Text"}, "residentialAddressPostCode": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/residentialAddressPostCode", "@type": "https://schema.org/Text"}, "IdCardCredential": {"@id": "https://schemas.learningmachine.com/2017/blockcerts/IdCardCredential", "@type": "https://schema.org/DataType"}}, "https://w3id.org/security/data-integrity/v2", "https://w3id.org/blockcerts/v3.2"], "type": ["VerifiableCredential", "BlockcertsCredential", "IdCardCredential"], "name": [{"@value": "Canadian Id Card", "@language": "en"}, {"@value": "Carte d'Identit\u00e9 Canadienne", "@language": "fr"}, {"@value": "\u0628\u0637\u0627\u0642\u0629 \u0627\u0644\u0647\u0648\u064a\u0629 \u0627\u0644\u0643\u0646\u062f\u064a\u0629", "@language": "ar"}], "description": [{"@value": "A Blockcerts example (not an official document) highlighting various VC v2 spec items", "@language": "en"}, {"@value": "Un example Blockcerts (document non officiel) d\u00e9montrant diff\u00e9rents \u00e9l\u00e9ments de la sp\u00e9cification VC v2", "@language": "fr"}, {"@value": "\u0645\u062b\u0627\u0644 \u0639\u0644\u0649 Blockcerts (\u0644\u064a\u0633 \u0645\u0633\u062a\u0646\u062f\u064b\u0627 \u0631\u0633\u0645\u064a\u064b\u0627) \u064a\u0633\u0644\u0637 \u0627\u0644\u0636\u0648\u0621 \u0639\u0644\u0649 \u0639\u0646\u0627\u0635\u0631 \u0645\u0648\u0627\u0635\u0641\u0627\u062a VC v2 \u0627\u0644\u0645\u062e\u062a\u0644\u0641\u0629", "@language": "ar"}], "issuer": "https://www.blockcerts.org/samples/3.0/issuer-blockcerts.json", "validFrom": "2024-03-01T00:00:00Z", "validUntil": "2039-02-28T23:59:59Z", "id": "urn:uuid:4f5f0100-ccbf-4ca9-9cfc-4f5fc3052d28", "credentialSchema": [{"id": "https://www.blockcerts.org/samples/3.0/example-id-card-schema.json", "type": "JsonSchema"}], "credentialSubject": {"id": "did:example:ebfeb1f712ebc6f1c276e12ec21", "name": "John Smith", "nationality": "Canada", "DOB": "05/10/1983", "height": "1.80m", "residentialAddressStreet": "6 Maple Tree street", "residentialAddressTown": "Toronto", "residentialAddressPostCode": "YYZYUL"}, "display": {"contentMediaType": "text/html", "content": "<div style=\"background-color:transparent;padding:6px;display:inline-flex;align-items:center;flex-direction:column\">Yo</div>"}, "proof": {"id": "urn:uuid:5f7a5393-4fc5-4804-956d-f4e21eefa2e0", "type": "DataIntegrityProof", "cryptosuite": "merkle-proof-2019", "proofPurpose": "assertionMethod", "created": "2024-11-05T15:09:46Z", "proofValue": "zEuZQLZTYrdsDv2HJ1WCR1o1t2bNMqtrFkM67ELRNg5Zooe2UHYkJYYwa6VSHVxymPyeQ1XQLkmvH6YPXX9U2WPUdgsopMMcMfiHaGGm8K4fcLBjHMkmfJpMyBDvFXSCJKNu4Ca5q2k9w4BwQJt3bzjxp1RwrsMxGNsrroTmaXuUfGe1EdiNCvvxUW4GnaoCnN9pawfP1gSqB2GBA1TogxZzi8EsRsnswAHAcD1cMpx1r64cBaEc2biYLf5DekCXqUjbVZXA1DrGS22jmjvzyk6Zw7MDjETkSw6HJhFhAnSRCUY", "verificationMethod": "https://www.blockcerts.org/samples/3.0/issuer-blockcerts.json#key-1"}}], "proof": {"id": "urn:uuid:9b315c9c-f7d5-4467-9d8e-987b7876ff60", "type": "DataIntegrityProof", "cryptosuite": "merkle-proof-2019", "proofPurpose": "assertionMethod", "created": "2024-11-18T16:55:15Z", "proofValue": "zEuZQLZTYrdsDv2cLE9nmDcak89qahzxUSxUK5L8EnKepu6EDTQZEK4t3ByoKkKqMbGynA5siezfvs88mxhYkJ3EVVsPzt5YL1JDuxgjKU2F8hWVWZoAy6Et8zhKEk3CJTvebFnQPgVa4t7dNfHPWkacdzRuY4tVQEmj9k2KnwSU1NrTf2TF5Ky5hpk41CGWxQmrE9RooPasqL8YP81QXXG5KsoV3twpoA3cCk7qQgtGxLvRp6p7L18HTmpZWFjG1oLfuDu8Qmiu2goTSoWv33YQeMGZNcexDM7qQo96VhSRYUp", "verificationMethod": "https://www.blockcerts.org/samples/3.0/issuer-blockcerts.json#key-1"}}

0 comments on commit 04a6704

Please sign in to comment.