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

Add missing VC-DI/LD-Proof verification method option #2867

Merged
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
10 changes: 2 additions & 8 deletions aries_cloudagent/vc/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async def issue_credential_route(request: web.BaseRequest):
options = {} if "options" not in body else body["options"]

# We derive the proofType from the issuer DID if not provided in options
if not options.get("type", None) and not options.get("proofType", None):
if not options.get("proofType", None):
issuer = credential["issuer"]
did = issuer if isinstance(issuer, str) else issuer["id"]
async with context.session() as session:
Expand All @@ -93,10 +93,6 @@ async def issue_credential_route(request: web.BaseRequest):
options["proofType"] = "Ed25519Signature2020"
elif key_type == "bls12381g2":
options["proofType"] = "BbsBlsSignature2020"
else:
options["proofType"] = (
options.pop("type") if "type" in options else options["proofType"]
)

credential = VerifiableCredential.deserialize(credential)
options = LDProofVCOptions.deserialize(options)
Expand Down Expand Up @@ -190,7 +186,7 @@ async def prove_presentation_route(request: web.BaseRequest):
options = {} if "options" not in body else body["options"]

# We derive the proofType from the holder DID if not provided in options
if not options.get("type", None):
if not options.get("proofType", None):
holder = presentation["holder"]
did = holder if isinstance(holder, str) else holder["id"]
async with context.session() as session:
Expand All @@ -202,8 +198,6 @@ async def prove_presentation_route(request: web.BaseRequest):
options["proofType"] = "Ed25519Signature2020"
elif key_type == "bls12381g2":
options["proofType"] = "BbsBlsSignature2020"
else:
options["proofType"] = options.pop("type")

presentation = VerifiablePresentation.deserialize(presentation)
options = LDProofVCOptions.deserialize(options)
Expand Down
25 changes: 3 additions & 22 deletions aries_cloudagent/vc/vc_ld/models/web_schemas.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
"""VC-API routes web requests schemas."""

from marshmallow import fields, Schema
from marshmallow import fields
from ....messaging.models.openapi import OpenAPISchema

from ....messaging.valid import (
RFC3339_DATETIME_EXAMPLE,
UUID4_EXAMPLE,
)
from ..validation_result import (
PresentationVerificationResultSchema,
)
Expand All @@ -21,21 +17,6 @@
)


class IssuanceOptionsSchema(Schema):
"""Linked data proof verifiable credential options schema."""

type = fields.Str(required=False, metadata={"example": "Ed25519Signature2020"})
created = fields.Str(required=False, metadata={"example": RFC3339_DATETIME_EXAMPLE})
domain = fields.Str(required=False, metadata={"example": "website.example"})
challenge = fields.Str(required=False, metadata={"example": UUID4_EXAMPLE})
# TODO, implement status list publication through a plugin
# credential_status = fields.Dict(
# data_key="credentialStatus",
# required=False,
# metadata={"example": {"type": "StatusList2021"}},
# )


class ListCredentialsResponse(OpenAPISchema):
"""Response schema for listing credentials."""

Expand All @@ -52,7 +33,7 @@ class IssueCredentialRequest(OpenAPISchema):
"""Request schema for issuing a credential."""

credential = fields.Nested(CredentialSchema)
options = fields.Nested(IssuanceOptionsSchema)
options = fields.Nested(LDProofVCOptionsSchema)


class IssueCredentialResponse(OpenAPISchema):
Expand All @@ -78,7 +59,7 @@ class ProvePresentationRequest(OpenAPISchema):
"""Request schema for proving a presentation."""

presentation = fields.Nested(PresentationSchema)
options = fields.Nested(IssuanceOptionsSchema)
options = fields.Nested(LDProofVCOptionsSchema)


class ProvePresentationResponse(OpenAPISchema):
Expand Down