Skip to content

Commit

Permalink
Merge branch 'main' into sync-development
Browse files Browse the repository at this point in the history
  • Loading branch information
ff137 committed Dec 5, 2024
2 parents 5a3b99a + 6ddb592 commit 3dc077c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
8 changes: 4 additions & 4 deletions acapy_agent/protocols/issue_credential/v2_0/message_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@
# Format specifications
ATTACHMENT_FORMAT = {
CRED_20_PROPOSAL: {
V20CredFormat.Format.ANONCREDS.api: "anoncreds/cred-filter@v2.0",
V20CredFormat.Format.ANONCREDS.api: "anoncreds/credential-filter@v1.0",
V20CredFormat.Format.INDY.api: "hlindy/[email protected]",
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]",
V20CredFormat.Format.VC_DI.api: "didcomm/[email protected]",
},
CRED_20_OFFER: {
V20CredFormat.Format.ANONCREDS.api: "anoncreds/cred-abstract@v2.0",
V20CredFormat.Format.ANONCREDS.api: "anoncreds/credential-offer@v1.0",
V20CredFormat.Format.INDY.api: "hlindy/[email protected]",
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]",
V20CredFormat.Format.VC_DI.api: "didcomm/[email protected]",
},
CRED_20_REQUEST: {
V20CredFormat.Format.ANONCREDS.api: "anoncreds/cred-req@v2.0",
V20CredFormat.Format.ANONCREDS.api: "anoncreds/credential-request@v1.0",
V20CredFormat.Format.INDY.api: "hlindy/[email protected]",
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]",
V20CredFormat.Format.VC_DI.api: "didcomm/[email protected]",
},
CRED_20_ISSUE: {
V20CredFormat.Format.ANONCREDS.api: "anoncreds/cred@v2.0",
V20CredFormat.Format.ANONCREDS.api: "anoncreds/credential@v1.0",
V20CredFormat.Format.INDY.api: "hlindy/[email protected]",
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]",
V20CredFormat.Format.VC_DI.api: "didcomm/[email protected]",
Expand Down
25 changes: 20 additions & 5 deletions acapy_agent/protocols/issue_credential/v2_0/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
get_paginated_query_params,
)
from ....messaging.valid import (
ANONCREDS_CRED_DEF_ID_EXAMPLE,
ANONCREDS_DID_EXAMPLE,
ANONCREDS_SCHEMA_ID_EXAMPLE,
INDY_CRED_DEF_ID_EXAMPLE,
Expand Down Expand Up @@ -140,13 +141,24 @@ class V20CredStoreRequestSchema(OpenAPISchema):
class V20CredFilterAnoncredsSchema(OpenAPISchema):
"""Anoncreds credential filtration criteria."""

cred_def_id = fields.Str(
schema_issuer_id = fields.Str(
required=False,
metadata={
"description": "Credential definition identifier",
"description": "Schema issuer ID",
"example": ANONCREDS_DID_EXAMPLE,
},
)
schema_name = fields.Str(
required=False,
metadata={"description": "Schema name", "example": "preferences"},
)
schema_version = fields.Str(
required=False,
metadata={
"description": "Schema version",
"example": MAJOR_MINOR_VERSION_EXAMPLE,
},
)
schema_id = fields.Str(
required=False,
metadata={
Expand All @@ -157,13 +169,16 @@ class V20CredFilterAnoncredsSchema(OpenAPISchema):
issuer_id = fields.Str(
required=False,
metadata={
"description": "Credential issuer DID",
"description": "Credential issuer ID",
"example": ANONCREDS_DID_EXAMPLE,
},
)
epoch = fields.Str(
cred_def_id = fields.Str(
required=False,
metadata={"description": "Credential epoch time", "example": "2021-08-24"},
metadata={
"description": "Credential definition identifier",
"example": ANONCREDS_CRED_DEF_ID_EXAMPLE,
},
)


Expand Down
23 changes: 23 additions & 0 deletions acapy_agent/protocols/issue_credential/v2_0/tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,29 @@ async def test_validate_cred_filter_schema(self):
with self.assertRaises(test_module.ValidationError):
schema.validate_fields({"veres-one": {"no": "support"}})

async def test_validate_cred_filter_anoncreds_schema(self):
schema = test_module.V20CredFilterSchema()
schema.validate_fields({"anoncreds": {"issuer_id": TEST_DID}})
schema.validate_fields(
{"anoncreds": {"issuer_id": TEST_DID, "schema_version": "1.0"}}
)
schema.validate_fields(
{
"anoncreds": {"issuer_id": TEST_DID},
}
)
schema.validate_fields(
{
"anoncreds": {},
}
)
with self.assertRaises(test_module.ValidationError):
schema.validate_fields({})
with self.assertRaises(test_module.ValidationError):
schema.validate_fields(["hopeless", "stop"])
with self.assertRaises(test_module.ValidationError):
schema.validate_fields({"veres-one": {"no": "support"}})

async def test_validate_create_schema(self):
schema = test_module.V20IssueCredSchemaCore()
schema.validate(
Expand Down
6 changes: 3 additions & 3 deletions acapy_agent/protocols/present_proof/v2_0/message_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
# Format specifications
ATTACHMENT_FORMAT = {
PRES_20_PROPOSAL: {
V20PresFormat.Format.ANONCREDS.api: "anoncreds/proof-req@v2.0",
V20PresFormat.Format.ANONCREDS.api: "anoncreds/proof-proposal@v1.0",
V20PresFormat.Format.INDY.api: "hlindy/[email protected]",
V20PresFormat.Format.DIF.api: "dif/presentation-exchange/[email protected]",
},
PRES_20_REQUEST: {
V20PresFormat.Format.ANONCREDS.api: "anoncreds/proof-req@v2.0",
V20PresFormat.Format.ANONCREDS.api: "anoncreds/proof-request@v1.0",
V20PresFormat.Format.INDY.api: "hlindy/[email protected]",
V20PresFormat.Format.DIF.api: "dif/presentation-exchange/[email protected]",
},
PRES_20: {
V20PresFormat.Format.ANONCREDS.api: "anoncreds/proof@v2.0",
V20PresFormat.Format.ANONCREDS.api: "anoncreds/proof@v1.0",
V20PresFormat.Format.INDY.api: "hlindy/[email protected]",
V20PresFormat.Format.DIF.api: "dif/presentation-exchange/[email protected]",
},
Expand Down

0 comments on commit 3dc077c

Please sign in to comment.