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

Allow querying credentials for proof request with multiple referents #181

Merged
merged 4 commits into from
Sep 17, 2019
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
5 changes: 3 additions & 2 deletions aries_cloudagent/holder/indy.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ async def store_credential(
credential_definition,
credential_data,
credential_request_metadata,
credential_attr_mime_types=None
credential_attr_mime_types=None,
credential_id=None
):
"""
Store a credential in the wallet.
Expand All @@ -92,7 +93,7 @@ async def store_credential(
"""
credential_id = await indy.anoncreds.prover_store_credential(
self.wallet.handle,
None, # Always let indy set the id for now
credential_id,
json.dumps(credential_request_metadata),
json.dumps(credential_data),
json.dumps(credential_definition),
Expand Down
6 changes: 5 additions & 1 deletion aries_cloudagent/messaging/credentials/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,15 @@ async def receive_credential(self, credential_message: CredentialIssue):

return credential_exchange_record

async def store_credential(self, credential_exchange_record: CredentialExchange):
async def store_credential(
self, credential_exchange_record: CredentialExchange, credential_id: str
):
"""
Store a credential in the wallet.

Args:
credential_message: credential to store
credential_id: string to use as id for record in wallet

"""

Expand All @@ -487,6 +490,7 @@ async def store_credential(self, credential_exchange_record: CredentialExchange)
credential_definition,
raw_credential,
credential_exchange_record.credential_request_metadata,
credential_id=credential_id
)

credential = await holder.get_credential(credential_id)
Expand Down
7 changes: 6 additions & 1 deletion aries_cloudagent/messaging/credentials/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,9 @@ async def credential_exchange_store(request: web.BaseRequest):
context = request.app["request_context"]
outbound_handler = request.app["outbound_message_router"]

body = await request.json()
credential_id = body.get("credential_id")

credential_exchange_id = request.match_info["id"]
credential_exchange_record = await CredentialExchange.retrieve_by_id(
context, credential_exchange_id
Expand All @@ -482,7 +485,9 @@ async def credential_exchange_store(request: web.BaseRequest):
(
credential_exchange_record,
credential_stored_message,
) = await credential_manager.store_credential(credential_exchange_record)
) = await credential_manager.store_credential(
credential_exchange_record, credential_id
)

await outbound_handler(credential_stored_message, connection_id=connection_id)
return web.json_response(credential_exchange_record.serialize())
Expand Down
6 changes: 3 additions & 3 deletions aries_cloudagent/messaging/presentations/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ async def presentation_exchange_credentials_list(request: web.BaseRequest):
context = request.app["request_context"]

presentation_exchange_id = request.match_info["id"]
presentation_referent = request.match_info.get("referent")
presentation_referents = request.match_info.get("referent").split(",")

try:
presentation_exchange_record = await PresentationExchange.retrieve_by_id(
Expand All @@ -174,7 +174,7 @@ async def presentation_exchange_credentials_list(request: web.BaseRequest):
holder: BaseHolder = await context.inject(BaseHolder)
credentials = await holder.get_credentials_for_presentation_request_by_referent(
presentation_exchange_record.presentation_request,
(presentation_referent,) if presentation_referent else (),
presentation_referents,
start,
count,
extra_query,
Expand All @@ -185,7 +185,7 @@ async def presentation_exchange_credentials_list(request: web.BaseRequest):
"Retrieved presentation credentials",
{
"presentation_exchange_id": presentation_exchange_id,
"referent": presentation_referent,
"referents": presentation_referents,
"extra_query": extra_query,
"credentials": credentials,
},
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.run
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM bcgovimages/von-image:py36-1.11-0
FROM bcgovimages/von-image:py36-1.11-1

ENV ENABLE_PTVSD 0

Expand Down
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
aiohttp~=3.5.4
aiohttp-apispec~=1.1.2
aiohttp==3.5.4
aiohttp-apispec==1.1.2
apispec==2.0.2
aiohttp-cors~=0.7.0
base58~=1.0.3
Markdown~=3.1.1
marshmallow==3.0.0rc9
marshmallow==3.0.0
msgpack~=0.6.1
prompt_toolkit~=2.0.9
pynacl~=1.3.0