diff --git a/samples/acdc/legal-entity-engagement-context-role-vLEI-credential.json b/samples/acdc/legal-entity-engagement-context-role-vLEI-credential-auth.json similarity index 100% rename from samples/acdc/legal-entity-engagement-context-role-vLEI-credential.json rename to samples/acdc/legal-entity-engagement-context-role-vLEI-credential-auth.json diff --git a/samples/acdc/legal-entity-engagement-context-role-vLEI-credential-le.json b/samples/acdc/legal-entity-engagement-context-role-vLEI-credential-le.json new file mode 100644 index 0000000..96f39da --- /dev/null +++ b/samples/acdc/legal-entity-engagement-context-role-vLEI-credential-le.json @@ -0,0 +1,35 @@ +{ + "v": "ACDC10JSON00011c_", + "d": "EpcEvrX2gGTpmKbIG25GSA7_LsWwwzVQ6aUilgBubpGI", + "u": "IY7-g7wTfta1087YAdUXTbuI0Vklqt8pQxTgc3Rtz0o", + "i": "did:keri:EmSIYYxvgtKn9jAp8GcK3fXOwTeyBIcAnRnyrLNfKjVI", + "ri": "did:keri:EymRy7xMwsxUelUauaXtMxTfPAMPAI6FkekwlOjkggt", + "s": "EZdaE1HCu2ZhyIhpXTWfGSLS2kirKexaC-4up3sIUz1I", + "a": { + "d": "EG7PfBZbyXS0huxbnvMD-jOdTnDCCaT4CO6xId-ATNWg", + "i": "did:keri:EFs6d-7q-l6tDMn_yYFyFzaT89sSFNLCOaKqYMF-7L_0", + "dt": "2021-06-09T17:35:54.169967+00:00", + "LEI": "254900YH3ZCDPE1E5306", + "personLegalName": "Anne Jones", + "engagementContextRole": "Project Manager" + }, + "e": { + "d": "EBDmgKOAEwnMGsofWg2m0l63J1awfJafqJyCzTnVkdSw", + "le": { + "n": "Et2DOOu4ivLsjpv89vgv6auPntSLx4CvOhGUxMhxPS24", + "s": "ENPXp1vQzRF6JwIuS-mp2U8Uf1MoADoP_GqQ62VsDZWY" + } + }, + "r": { + "d": "EDIai3Wkd-Z_4cezz9nYEcCK3KNH5saLvZoS_84JL6NU", + "usageDisclaimer": { + "l": "Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled." + }, + "issuanceDisclaimer": { + "l": "All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework." + }, + "privacyDisclaimer": { + "l": "It is the sole responsibility of Holders as Issuees of an ECR vLEI Credential to present that Credential in a privacy-preserving manner using the mechanisms provided in the Issuance and Presentation Exchange (IPEX) protocol specification and the Authentic Chained Data Container (ACDC) specification. https://github.com/WebOfTrust/IETF-IPEX and https://github.com/trustoverip/tswg-acdc-specification." + } + } +} diff --git a/samples/acdc/legal-entity-engagement-context-role-vLEI-credential-said.json b/samples/acdc/legal-entity-engagement-context-role-vLEI-credential-said.json new file mode 100644 index 0000000..b37f485 --- /dev/null +++ b/samples/acdc/legal-entity-engagement-context-role-vLEI-credential-said.json @@ -0,0 +1,29 @@ +{ + "v": "ACDC10JSON00011c_", + "d": "EpcEvrX2gGTpmKbIG25GSA7_LsWwwzVQ6aUilgBubpGI", + "u": "IY7-g7wTfta1087YAdUXTbuI0Vklqt8pQxTgc3Rtz0o", + "i": "did:keri:EmSIYYxvgtKn9jAp8GcK3fXOwTeyBIcAnRnyrLNfKjVI", + "ri": "did:keri:EymRy7xMwsxUelUauaXtMxTfPAMPAI6FkekwlOjkggt", + "s": "EZdaE1HCu2ZhyIhpXTWfGSLS2kirKexaC-4up3sIUz1I", + "a": { + "d": "EG7PfBZbyXS0huxbnvMD-jOdTnDCCaT4CO6xId-ATNWg", + "i": "did:keri:EFs6d-7q-l6tDMn_yYFyFzaT89sSFNLCOaKqYMF-7L_0", + "dt": "2021-06-09T17:35:54.169967+00:00", + "LEI": "254900YH3ZCDPE1E5306", + "personLegalName": "Anne Jones", + "engagementContextRole": "Project Manager" + }, + "e": "EBDmgKOAEwnMGsofWg2m0l63J1awfJafqJyCzTnVkdSw", + "r": { + "d": "EDIai3Wkd-Z_4cezz9nYEcCK3KNH5saLvZoS_84JL6NU", + "usageDisclaimer": { + "l": "Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled." + }, + "issuanceDisclaimer": { + "l": "All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework." + }, + "privacyDisclaimer": { + "l": "It is the sole responsibility of Holders as Issuees of an ECR vLEI Credential to present that Credential in a privacy-preserving manner using the mechanisms provided in the Issuance and Presentation Exchange (IPEX) protocol specification and the Authentic Chained Data Container (ACDC) specification. https://github.com/WebOfTrust/IETF-IPEX and https://github.com/trustoverip/tswg-acdc-specification." + } + } +} diff --git a/test-vectors/acdc/ecr-failures/legal-entity-engagement-context-role-vLEI-credential-auth-bad.json b/test-vectors/acdc/ecr-failures/legal-entity-engagement-context-role-vLEI-credential-auth-bad.json new file mode 100644 index 0000000..ce69a5a --- /dev/null +++ b/test-vectors/acdc/ecr-failures/legal-entity-engagement-context-role-vLEI-credential-auth-bad.json @@ -0,0 +1,34 @@ +{ + "v": "ACDC10JSON00011c_", + "d": "EpcEvrX2gGTpmKbIG25GSA7_LsWwwzVQ6aUilgBubpGI", + "u": "IY7-g7wTfta1087YAdUXTbuI0Vklqt8pQxTgc3Rtz0o", + "i": "did:keri:EmSIYYxvgtKn9jAp8GcK3fXOwTeyBIcAnRnyrLNfKjVI", + "ri": "did:keri:EymRy7xMwsxUelUauaXtMxTfPAMPAI6FkekwlOjkggt", + "s": "EZdaE1HCu2ZhyIhpXTWfGSLS2kirKexaC-4up3sIUz1I", + "a": { + "d": "EG7PfBZbyXS0huxbnvMD-jOdTnDCCaT4CO6xId-ATNWg", + "i": "did:keri:EFs6d-7q-l6tDMn_yYFyFzaT89sSFNLCOaKqYMF-7L_0", + "dt": "2021-06-09T17:35:54.169967+00:00", + "LEI": "254900YH3ZCDPE1E5306", + "personLegalName": "Anne Jones", + "engagementContextRole": "Project Manager" + }, + "e": { + "d": "EBDmgKOAEwnMGsofWg2m0l63J1awfJafqJyCzTnVkdSw", + "auth": { + "n": "Et2DOOu4ivLsjpv89vgv6auPntSLx4CvOhGUxMhxPS24" + } + }, + "r": { + "d": "EDIai3Wkd-Z_4cezz9nYEcCK3KNH5saLvZoS_84JL6NU", + "usageDisclaimer": { + "l": "Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled." + }, + "issuanceDisclaimer": { + "l": "All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework." + }, + "privacyDisclaimer": { + "l": "It is the sole responsibility of Holders as Issuees of an ECR vLEI Credential to present that Credential in a privacy-preserving manner using the mechanisms provided in the Issuance and Presentation Exchange (IPEX) protocol specification and the Authentic Chained Data Container (ACDC) specification. https://github.com/WebOfTrust/IETF-IPEX and https://github.com/trustoverip/tswg-acdc-specification." + } + } +} diff --git a/test-vectors/acdc/ecr-failures/legal-entity-engagement-context-role-vLEI-credential-bad.json b/test-vectors/acdc/ecr-failures/legal-entity-engagement-context-role-vLEI-credential-bad.json new file mode 100644 index 0000000..34b8e46 --- /dev/null +++ b/test-vectors/acdc/ecr-failures/legal-entity-engagement-context-role-vLEI-credential-bad.json @@ -0,0 +1,35 @@ +{ + "v": "ACDC10JSON00011c_", + "d": "EpcEvrX2gGTpmKbIG25GSA7_LsWwwzVQ6aUilgBubpGI", + "u": "IY7-g7wTfta1087YAdUXTbuI0Vklqt8pQxTgc3Rtz0o", + "i": "did:keri:EmSIYYxvgtKn9jAp8GcK3fXOwTeyBIcAnRnyrLNfKjVI", + "ri": "did:keri:EymRy7xMwsxUelUauaXtMxTfPAMPAI6FkekwlOjkggt", + "s": "EZdaE1HCu2ZhyIhpXTWfGSLS2kirKexaC-4up3sIUz1I", + "a": { + "d": "EG7PfBZbyXS0huxbnvMD-jOdTnDCCaT4CO6xId-ATNWg", + "i": "did:keri:EFs6d-7q-l6tDMn_yYFyFzaT89sSFNLCOaKqYMF-7L_0", + "dt": "2021-06-09T17:35:54.169967+00:00", + "LEI": "254900YH3ZCDPE1E5306", + "personLegalName": "Anne Jones", + "engagementContextRole": "Project Manager" + }, + "e": { + "d": "EBDmgKOAEwnMGsofWg2m0l63J1awfJafqJyCzTnVkdSw", + "bad": { + "n": "Et2DOOu4ivLsjpv89vgv6auPntSLx4CvOhGUxMhxPS24", + "s": "ENPXp1vQzRF6JwIuS-mp2U8Uf1MoADoP_GqQ62VsDZWY" + } + }, + "r": { + "d": "EDIai3Wkd-Z_4cezz9nYEcCK3KNH5saLvZoS_84JL6NU", + "usageDisclaimer": { + "l": "Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled." + }, + "issuanceDisclaimer": { + "l": "All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework." + }, + "privacyDisclaimer": { + "l": "It is the sole responsibility of Holders as Issuees of an ECR vLEI Credential to present that Credential in a privacy-preserving manner using the mechanisms provided in the Issuance and Presentation Exchange (IPEX) protocol specification and the Authentic Chained Data Container (ACDC) specification. https://github.com/WebOfTrust/IETF-IPEX and https://github.com/trustoverip/tswg-acdc-specification." + } + } +} diff --git a/test-vectors/acdc/ecr-failures/legal-entity-engagement-context-role-vLEI-credential-le-bad.json b/test-vectors/acdc/ecr-failures/legal-entity-engagement-context-role-vLEI-credential-le-bad.json new file mode 100644 index 0000000..d5fd6bb --- /dev/null +++ b/test-vectors/acdc/ecr-failures/legal-entity-engagement-context-role-vLEI-credential-le-bad.json @@ -0,0 +1,34 @@ +{ + "v": "ACDC10JSON00011c_", + "d": "EpcEvrX2gGTpmKbIG25GSA7_LsWwwzVQ6aUilgBubpGI", + "u": "IY7-g7wTfta1087YAdUXTbuI0Vklqt8pQxTgc3Rtz0o", + "i": "did:keri:EmSIYYxvgtKn9jAp8GcK3fXOwTeyBIcAnRnyrLNfKjVI", + "ri": "did:keri:EymRy7xMwsxUelUauaXtMxTfPAMPAI6FkekwlOjkggt", + "s": "EZdaE1HCu2ZhyIhpXTWfGSLS2kirKexaC-4up3sIUz1I", + "a": { + "d": "EG7PfBZbyXS0huxbnvMD-jOdTnDCCaT4CO6xId-ATNWg", + "i": "did:keri:EFs6d-7q-l6tDMn_yYFyFzaT89sSFNLCOaKqYMF-7L_0", + "dt": "2021-06-09T17:35:54.169967+00:00", + "LEI": "254900YH3ZCDPE1E5306", + "personLegalName": "Anne Jones", + "engagementContextRole": "Project Manager" + }, + "e": { + "d": "EBDmgKOAEwnMGsofWg2m0l63J1awfJafqJyCzTnVkdSw", + "le": { + "n": "Et2DOOu4ivLsjpv89vgv6auPntSLx4CvOhGUxMhxPS24" + } + }, + "r": { + "d": "EDIai3Wkd-Z_4cezz9nYEcCK3KNH5saLvZoS_84JL6NU", + "usageDisclaimer": { + "l": "Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled." + }, + "issuanceDisclaimer": { + "l": "All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework." + }, + "privacyDisclaimer": { + "l": "It is the sole responsibility of Holders as Issuees of an ECR vLEI Credential to present that Credential in a privacy-preserving manner using the mechanisms provided in the Issuance and Presentation Exchange (IPEX) protocol specification and the Authentic Chained Data Container (ACDC) specification. https://github.com/WebOfTrust/IETF-IPEX and https://github.com/trustoverip/tswg-acdc-specification." + } + } +} diff --git a/test-vectors/acdc/ecr-failures/legal-entity-engagement-context-role-vLEI-credential-missing-bad.json b/test-vectors/acdc/ecr-failures/legal-entity-engagement-context-role-vLEI-credential-missing-bad.json new file mode 100644 index 0000000..76f2854 --- /dev/null +++ b/test-vectors/acdc/ecr-failures/legal-entity-engagement-context-role-vLEI-credential-missing-bad.json @@ -0,0 +1,28 @@ +{ + "v": "ACDC10JSON00011c_", + "d": "EpcEvrX2gGTpmKbIG25GSA7_LsWwwzVQ6aUilgBubpGI", + "u": "IY7-g7wTfta1087YAdUXTbuI0Vklqt8pQxTgc3Rtz0o", + "i": "did:keri:EmSIYYxvgtKn9jAp8GcK3fXOwTeyBIcAnRnyrLNfKjVI", + "ri": "did:keri:EymRy7xMwsxUelUauaXtMxTfPAMPAI6FkekwlOjkggt", + "s": "EZdaE1HCu2ZhyIhpXTWfGSLS2kirKexaC-4up3sIUz1I", + "a": { + "d": "EG7PfBZbyXS0huxbnvMD-jOdTnDCCaT4CO6xId-ATNWg", + "i": "did:keri:EFs6d-7q-l6tDMn_yYFyFzaT89sSFNLCOaKqYMF-7L_0", + "dt": "2021-06-09T17:35:54.169967+00:00", + "LEI": "254900YH3ZCDPE1E5306", + "personLegalName": "Anne Jones", + "engagementContextRole": "Project Manager" + }, + "r": { + "d": "EDIai3Wkd-Z_4cezz9nYEcCK3KNH5saLvZoS_84JL6NU", + "usageDisclaimer": { + "l": "Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled." + }, + "issuanceDisclaimer": { + "l": "All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework." + }, + "privacyDisclaimer": { + "l": "It is the sole responsibility of Holders as Issuees of an ECR vLEI Credential to present that Credential in a privacy-preserving manner using the mechanisms provided in the Issuance and Presentation Exchange (IPEX) protocol specification and the Authentic Chained Data Container (ACDC) specification. https://github.com/WebOfTrust/IETF-IPEX and https://github.com/trustoverip/tswg-acdc-specification." + } + } +} diff --git a/tests/test_schema.py b/tests/test_schema.py index 01d199f..9f2f53d 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -3,10 +3,10 @@ import pytest from keri.core import scheming, coring +from keri.kering import ValidationError @pytest.mark.parametrize("filename", ["verifiable-ixbrl-report-attestation.json", - "legal-entity-engagement-context-role-vLEI-credential.json", "legal-entity-official-organizational-role-vLEI-credential.json", "legal-entity-vLEI-credential.json", "qualified-vLEI-issuer-vLEI-credential.json", @@ -21,6 +21,40 @@ def test_schema_example(fmt, filename): schemer.verify(sample.read().encode("utf-8")) +@pytest.mark.parametrize("sample", [ + "legal-entity-engagement-context-role-vLEI-credential-auth.json", + "legal-entity-engagement-context-role-vLEI-credential-le.json", + "legal-entity-engagement-context-role-vLEI-credential-said.json", +]) +@pytest.mark.parametrize("schema", ["legal-entity-engagement-context-role-vLEI-credential.json", ]) +@pytest.mark.parametrize("fmt", ["acdc"]) +def test_ecr_schema_with_good(fmt, schema, sample): + with open(f'{Path(__file__).parent}/../schema/{fmt}/{schema}', 'r') as schma, \ + open(f'{Path(__file__).parent}/../samples/acdc/{sample}', 'r') as smple: + schemer = scheming.Schemer(sed=json.load(schma)) + + assert schemer.verify(smple.read().encode("utf-8")) + + +@pytest.mark.parametrize("sample", [ + "legal-entity-engagement-context-role-vLEI-credential-bad.json", + "legal-entity-engagement-context-role-vLEI-credential-auth-bad.json", + "legal-entity-engagement-context-role-vLEI-credential-le-bad.json", + "legal-entity-engagement-context-role-vLEI-credential-missing-bad.json", +]) +@pytest.mark.parametrize("schema", ["legal-entity-engagement-context-role-vLEI-credential.json", ]) +@pytest.mark.parametrize("fmt", ["acdc"]) +def test_ecr_schema_with_bad(fmt, schema, sample): + with open(f'{Path(__file__).parent}/../schema/{fmt}/{schema}', 'r') as schma, \ + open(f'{Path(__file__).parent}/../test-vectors/{fmt}/ecr-failures/{sample}', 'r') as smple: + schemer = scheming.Schemer(sed=json.load(schma)) + + with pytest.raises(ValidationError) as e: + schemer.verify(smple.read().encode("utf-8")) + + assert e.type is ValidationError + + def test_legal_entity_chain(): qvi = json.load(open(f'{__path()}/../schema/acdc/qualified-vLEI-issuer-vLEI-credential.json', 'r')) le = json.load(open(f'{__path()}/../schema/acdc/legal-entity-vLEI-credential.json', 'r'))