Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possibly out of date admin routes #4

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,22 @@
CRED_20_PROPOSAL: {
V20CredFormat.Format.INDY.api: "hlindy/[email protected]",
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]",
V20CredFormat.Format.VC_DI.api: "aries/[email protected]",
},
CRED_20_OFFER: {
V20CredFormat.Format.INDY.api: "hlindy/[email protected]",
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]",
V20CredFormat.Format.VC_DI.api: "aries/[email protected]",
},
CRED_20_REQUEST: {
V20CredFormat.Format.INDY.api: "hlindy/[email protected]",
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]",
V20CredFormat.Format.VC_DI.api: "aries/[email protected]",
},
CRED_20_ISSUE: {
V20CredFormat.Format.INDY.api: "hlindy/[email protected]",
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]",
V20CredFormat.Format.VC_DI.api: "aries/[email protected]",
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,4 @@ class Meta:
)
attributes = fields.Nested(
V20CredAttrSpecSchema, many=True, required=True, data_key="attributes"
)
)
20 changes: 18 additions & 2 deletions aries_cloudagent/protocols/issue_credential/v2_0/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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"
)


Expand Down
Loading