Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
Signed-off-by: Sarthak Vijayvergiya <[email protected]>
  • Loading branch information
sarthakvijayvergiya committed Apr 29, 2024
1 parent 7f1f202 commit bac56be
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 139 deletions.
1 change: 0 additions & 1 deletion aries_cloudagent/anoncreds/holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,42 @@

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

from marshmallow import ValidationError

from aries_cloudagent.tests import mock
from ..tests import mock

from .......core.in_memory import InMemoryProfile
from .......ledger.base import BaseLedger
Expand Down
179 changes: 58 additions & 121 deletions demo/runners/faber.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bac56be

Please sign in to comment.