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

holder credential queries return cred briefs, not full in-wallet cred… #726

Merged
merged 2 commits into from
Sep 28, 2020
Merged
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
29 changes: 15 additions & 14 deletions aries_cloudagent/holder/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from ..messaging.models.openapi import OpenAPISchema
from ..messaging.valid import (
INDY_CRED_DEF_ID,
INDY_CRED_REV_ID,
INDY_REV_REG_ID,
INDY_SCHEMA_ID,
INDY_WQL,
Expand Down Expand Up @@ -52,31 +53,31 @@ class WitnessSchema(OpenAPISchema):
)


class CredentialSchema(OpenAPISchema):
"""Result schema for a credential query."""
class CredBriefSchema(OpenAPISchema):
"""Result schema with credential brief for a credential query."""

referent = fields.Str(description="Credential referent", example=UUIDFour.EXAMPLE)
attrs = fields.Dict(
keys=fields.Str(description="Attribute name"),
values=fields.Nested(RawEncCredAttrSchema),
description="Attribute names mapped to their raw and encoded values",
)
schema_id = fields.Str(description="Schema identifier", **INDY_SCHEMA_ID)
cred_def_id = fields.Str(
description="Credential definition identifier", **INDY_CRED_DEF_ID
)
rev_reg_id = fields.Str(
description="Revocation registry identifier", **INDY_REV_REG_ID
)
values = fields.Dict(
keys=fields.Str(description="Attribute name"),
values=fields.Nested(RawEncCredAttrSchema),
description="Attribute names mapped to their raw and encoded values",
cred_rev_id = fields.Str(
description="Credential revocation identifier", **INDY_CRED_REV_ID
)
signature = fields.Dict(description="Digital signature")
signature_correctness_proof = fields.Dict(description="Signature correctness proof")
rev_reg = fields.Nested(RevRegSchema)
witness = fields.Nested(WitnessSchema)


class CredentialsListSchema(OpenAPISchema):
class CredBriefListSchema(OpenAPISchema):
"""Result schema for a credential query."""

results = fields.List(fields.Nested(CredentialSchema()))
results = fields.List(fields.Nested(CredBriefSchema()))


class CredentialsListQueryStringSchema(OpenAPISchema):
Expand Down Expand Up @@ -109,7 +110,7 @@ class CredIdMatchInfoSchema(OpenAPISchema):

@docs(tags=["credentials"], summary="Fetch a credential from wallet by id")
@match_info_schema(CredIdMatchInfoSchema())
@response_schema(CredentialSchema(), 200)
@response_schema(CredBriefSchema(), 200)
async def credentials_get(request: web.BaseRequest):
"""
Request handler for retrieving a credential.
Expand Down Expand Up @@ -187,7 +188,7 @@ async def credentials_remove(request: web.BaseRequest):
summary="Fetch credentials from wallet",
)
@querystring_schema(CredentialsListQueryStringSchema())
@response_schema(CredentialsListSchema(), 200)
@response_schema(CredBriefListSchema(), 200)
async def credentials_list(request: web.BaseRequest):
"""
Request handler for searching credential records.
Expand Down