diff --git a/aries_cloudagent/anoncreds/holder.py b/aries_cloudagent/anoncreds/holder.py index 2a5738c839..242feccc3f 100644 --- a/aries_cloudagent/anoncreds/holder.py +++ b/aries_cloudagent/anoncreds/holder.py @@ -307,7 +307,6 @@ async def store_credential_w3c( try: secret = await self.get_master_secret() cred_w3c = W3cCredential.load(credential_data) - cred_w3c.to_legacy() await asyncio.get_event_loop().run_in_executor( None, cred_w3c.process, diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_offer.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_offer.py index 5d46f86fa0..c42ba32174 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_offer.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_offer.py @@ -1,13 +1,13 @@ """Cred request artifacts to attach to RFC 453 messages.""" from typing import Sequence, Union -from aries_cloudagent.indy.models.cred_abstract import IndyKeyCorrectnessProofSchema +from .......indy.models.cred_abstract import IndyKeyCorrectnessProofSchema from .......messaging.models.base import BaseModel, BaseModelSchema -from aries_cloudagent.vc.vc_ld.models.credential import ( +from .......vc.vc_ld.models.credential import ( CredentialSchema, VerifiableCredential, ) -from aries_cloudagent.messaging.valid import ( +from .......messaging.valid import ( INDY_CRED_DEF_ID_EXAMPLE, INDY_CRED_DEF_ID_VALIDATE, NUM_STR_WHOLE_EXAMPLE, diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_request.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_request.py index a6473de252..22668ae73c 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_request.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_request.py @@ -2,7 +2,7 @@ from typing import Mapping, Union from .......messaging.models.base import BaseModel, BaseModelSchema -from aries_cloudagent.messaging.valid import ( +from .......messaging.valid import ( INDY_CRED_DEF_ID_EXAMPLE, INDY_CRED_DEF_ID_VALIDATE, INDY_DID_EXAMPLE, diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/tests/test_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/tests/test_handler.py index 81b7b988d2..04d3c552ef 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/tests/test_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/tests/test_handler.py @@ -4,36 +4,36 @@ import pytest from .......anoncreds.holder import AnonCredsHolder -from aries_cloudagent.messaging.credential_definitions.util import ( +from .......messaging.credential_definitions.util import ( CRED_DEF_SENT_RECORD_TYPE, ) -from aries_cloudagent.messaging.decorators.attach_decorator import AttachDecorator -from aries_cloudagent.multitenant.base import BaseMultitenantManager -from aries_cloudagent.multitenant.manager import MultitenantManager -from aries_cloudagent.protocols.issue_credential.v2_0.formats.handler import ( +from .......messaging.decorators.attach_decorator import AttachDecorator +from .......multitenant.base import BaseMultitenantManager +from .......multitenant.manager import MultitenantManager +from .......protocols.issue_credential.v2_0.formats.handler import ( V20CredFormatError, ) -from aries_cloudagent.protocols.issue_credential.v2_0.messages.cred_format import ( +from .......protocols.issue_credential.v2_0.messages.cred_format import ( V20CredFormat, ) -from aries_cloudagent.protocols.issue_credential.v2_0.messages.cred_offer import ( +from .......protocols.issue_credential.v2_0.messages.cred_offer import ( V20CredOffer, ) -from aries_cloudagent.protocols.issue_credential.v2_0.messages.cred_proposal import ( +from .......protocols.issue_credential.v2_0.messages.cred_proposal import ( V20CredProposal, ) -from aries_cloudagent.protocols.issue_credential.v2_0.messages.cred_request import ( +from .......protocols.issue_credential.v2_0.messages.cred_request import ( V20CredRequest, ) -from aries_cloudagent.protocols.issue_credential.v2_0.messages.inner.cred_preview import ( +from .......protocols.issue_credential.v2_0.messages.inner.cred_preview import ( V20CredAttrSpec, V20CredPreview, ) -from aries_cloudagent.protocols.issue_credential.v2_0.models.detail.indy import ( +from .......protocols.issue_credential.v2_0.models.detail.indy import ( V20CredExRecordIndy, ) -from aries_cloudagent.storage.record import StorageRecord +from .......storage.record import StorageRecord from unittest import IsolatedAsyncioTestCase diff --git a/demo/runners/faber.py b/demo/runners/faber.py index 2625c1f91d..d497a318cd 100644 --- a/demo/runners/faber.py +++ b/demo/runners/faber.py @@ -342,129 +342,66 @@ def generate_proof_request_web_request( return proof_request_web_request elif cred_type == CRED_FORMAT_VC_DI: - # TODO For now (until the VC_DI proof exchange is implemented) just do a "legacy" proof request when cred type is "vc_di" - # proof_request_web_request = { - # "comment": "Test proof request for VC-DI format", - # "presentation_request": { - # "dif": { - # "options": { - # "challenge": "3fa85f64-5717-4562-b3fc-2c963f66afa7", - # "domain": "4jt78h47fh47", - # }, - # "presentation_definition": { - # "id": "32f54163-7166-48f1-93d8-ff217bdb0654", - # "submission_requirements": [ - # { - # "name": "Degree Verification", - # "rule": "pick", - # "min": 1, - # "from": "A", - # } - # ], - # "input_descriptors": [ - # { - # "id": "degree_input_1", - # "name": "Degree Certificate", - # "group": ["A"], - # "schema": [ - # { - # "uri": "https://www.w3.org/2018/credentials#VerifiableCredential" - # }, - # { - # "uri": "https://w3id.org/citizenship#PermanentResidentCard" - # }, - # ], - # "constraints": { - # "limit_disclosure": "required", - # "fields": [ - # { - # "path": [ - # "$.credentialSubject.degree.name" - # ], - # "purpose": "We need to verify that you have the required degree.", - # "filter": {"type": "string"}, - # }, - # { - # "path": [ - # "$.credentialSubject.birthDate" - # ], - # "purpose": "To ensure you meet the age requirement.", - # "filter": { - # "type": "string", - # "pattern": birth_date.strftime( - # birth_date_format - # ), - # }, - # }, - # ], - # }, - # } - # ], - # }, - # }, - # }, - # } - # if not connectionless: - # proof_request_web_request["connection_id"] = self.connection_id - # return proof_request_web_request - - req_attrs = [ - { - "name": "name", - "restrictions": [{"schema_name": "degree schema"}], - }, - { - "name": "date", - "restrictions": [{"schema_name": "degree schema"}], - }, - ] - if revocation: - req_attrs.append( - { - "name": "degree", - "restrictions": [{"schema_name": "degree schema"}], - "non_revoked": {"to": int(time.time() - 1)}, + proof_request_web_request = { + "comment": "Test proof request for VC-DI format", + "presentation_request": { + "dif": { + "options": { + "challenge": "3fa85f64-5717-4562-b3fc-2c963f66afa7", + "domain": "4jt78h47fh47", + }, + "presentation_definition": { + "id": "32f54163-7166-48f1-93d8-ff217bdb0654", + "submission_requirements": [ + { + "name": "Degree Verification", + "rule": "pick", + "min": 1, + "from": "A", + } + ], + "input_descriptors": [ + { + "id": "degree_input_1", + "name": "Degree Certificate", + "group": ["A"], + "schema": [ + { + "uri": "https://www.w3.org/2018/credentials#VerifiableCredential" + }, + { + "uri": "https://w3id.org/citizenship#PermanentResidentCard" + }, + ], + "constraints": { + "limit_disclosure": "required", + "fields": [ + { + "path": [ + "$.credentialSubject.degree.name" + ], + "purpose": "We need to verify that you have the required degree.", + "filter": {"type": "string"}, + }, + { + "path": [ + "$.credentialSubject.birthDate" + ], + "purpose": "To ensure you meet the age requirement.", + "filter": { + "type": "string", + "pattern": birth_date.strftime( + birth_date_format + ), + }, + }, + ], + }, + } + ], + }, }, - ) - else: - req_attrs.append( - { - "name": "degree", - "restrictions": [{"schema_name": "degree schema"}], - } - ) - if SELF_ATTESTED: - # test self-attested claims - req_attrs.append( - {"name": "self_attested_thing"}, - ) - req_preds = [ - # test zero-knowledge proofs - { - "name": "birthdate_dateint", - "p_type": "<=", - "p_value": int(birth_date.strftime(birth_date_format)), - "restrictions": [{"schema_name": "degree schema"}], - } - ] - indy_proof_request = { - "name": "Proof of Education", - "version": "1.0", - "requested_attributes": { - f"0_{req_attr['name']}_uuid": req_attr for req_attr in req_attrs }, - "requested_predicates": { - f"0_{req_pred['name']}_GE_uuid": req_pred - for req_pred in req_preds - }, - } - - if revocation: - indy_proof_request["non_revoked"] = {"to": int(time.time())} - - proof_request_web_request = { - "presentation_request": {"indy": indy_proof_request}, - "trace": exchange_tracing, } if not connectionless: proof_request_web_request["connection_id"] = self.connection_id