diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/message_types.py b/aries_cloudagent/protocols/issue_credential/v2_0/message_types.py index 33c7241ae1..d6ffae8ccd 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/message_types.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/message_types.py @@ -43,18 +43,22 @@ CRED_20_PROPOSAL: { V20CredFormat.Format.INDY.api: "hlindy/cred-filter@v2.0", V20CredFormat.Format.LD_PROOF.api: "aries/ld-proof-vc-detail@v1.0", + V20CredFormat.Format.VC_DI.api: "aries/vc-di-detail@v2.0", }, CRED_20_OFFER: { V20CredFormat.Format.INDY.api: "hlindy/cred-abstract@v2.0", V20CredFormat.Format.LD_PROOF.api: "aries/ld-proof-vc-detail@v1.0", + V20CredFormat.Format.VC_DI.api: "aries/vc-di-detail@v2.0", }, CRED_20_REQUEST: { V20CredFormat.Format.INDY.api: "hlindy/cred-req@v2.0", V20CredFormat.Format.LD_PROOF.api: "aries/ld-proof-vc-detail@v1.0", + V20CredFormat.Format.VC_DI.api: "aries/vc-di-detail@v2.0", }, CRED_20_ISSUE: { V20CredFormat.Format.INDY.api: "hlindy/cred@v2.0", V20CredFormat.Format.LD_PROOF.api: "aries/ld-proof-vc@v1.0", + V20CredFormat.Format.VC_DI.api: "aries/vc-di@v2.0", }, } diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/messages/inner/cred_preview.py b/aries_cloudagent/protocols/issue_credential/v2_0/messages/inner/cred_preview.py index 85256fc9f0..052315b7bc 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/messages/inner/cred_preview.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/messages/inner/cred_preview.py @@ -176,4 +176,4 @@ class Meta: ) attributes = fields.Nested( V20CredAttrSpecSchema, many=True, required=True, data_key="attributes" - ) + ) \ No newline at end of file diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/routes.py b/aries_cloudagent/protocols/issue_credential/v2_0/routes.py index 1341ae4dc2..3c48f54508 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/routes.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/routes.py @@ -54,6 +54,8 @@ from .models.cred_ex_record import V20CredExRecord, V20CredExRecordSchema from .models.detail.indy import V20CredExRecordIndySchema from .models.detail.ld_proof import V20CredExRecordLDProofSchema +from .models.detail.w3c import CredExRecordVCDISchema +from .formats.vc_di.models.cred_detail import VCDIDetailSchema LOGGER = logging.getLogger(__name__) @@ -108,6 +110,7 @@ class V20CredExRecordDetailSchema(OpenAPISchema): indy = fields.Nested(V20CredExRecordIndySchema, required=False) ld_proof = fields.Nested(V20CredExRecordLDProofSchema, required=False) + vc_di = fields.Nested(CredExRecordVCDISchema, required=False) class V20CredExRecordListResultSchema(OpenAPISchema): @@ -182,6 +185,11 @@ class V20CredFilterSchema(OpenAPISchema): required=False, metadata={"description": "Credential filter for linked data proof"}, ) + vc_di = fields.Nested( + VCDIDetailSchema, + required=False, + metadata={"description":"Credential filter for vcdi"} + ) @validates_schema def validate_fields(self, data, **kwargs): @@ -256,6 +264,14 @@ class V20CredFilterLDProofSchema(OpenAPISchema): metadata={"description": "Credential filter for linked data proof"}, ) +class V20CredFilterVCDISchema(OpenAPISchema): + """Credential filtration criteria.""" + + vc_di = fields.Nested( + VCDIDetailSchema, + required=True, + metadata={"description": "Credential filter for vcdi"}, + ) class V20CredRequestFreeSchema(AdminAPIMessageTracingSchema): """Filter, auto-remove, comment, trace.""" @@ -338,11 +354,11 @@ def validate_fields(self, data, **kwargs): """Validate schema fields: need both filter and counter_preview or neither.""" if ( "filter_" in data - and ("indy" in data["filter_"] or "ld_proof" in data["filter_"]) + and ("indy" in data["filter_"] or "ld_proof" in data["filter_"] or "vc_di" in data["filter_"]) ) ^ ("counter_preview" in data): raise ValidationError( f"V20CredBoundOfferRequestSchema\n{data}\nrequires " - "both indy/ld_proof filter and counter_preview or neither" + "both indy/ld_proof/vc_di filter and counter_preview or neither" )