Skip to content

Commit 5806f5c

Browse files
authored
Update anoncreds format names (openwallet-foundation#3374)
* Update anoncreds format names Signed-off-by: jamshale <[email protected]> * Add a unit test Signed-off-by: jamshale <[email protected]> --------- Signed-off-by: jamshale <[email protected]>
1 parent b104401 commit 5806f5c

File tree

4 files changed

+50
-12
lines changed

4 files changed

+50
-12
lines changed

acapy_agent/protocols/issue_credential/v2_0/message_types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,25 @@
3737
# Format specifications
3838
ATTACHMENT_FORMAT = {
3939
CRED_20_PROPOSAL: {
40-
V20CredFormat.Format.ANONCREDS.api: "anoncreds/cred-filter@v2.0",
40+
V20CredFormat.Format.ANONCREDS.api: "anoncreds/credential-filter@v1.0",
4141
V20CredFormat.Format.INDY.api: "hlindy/[email protected]",
4242
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]",
4343
V20CredFormat.Format.VC_DI.api: "didcomm/[email protected]",
4444
},
4545
CRED_20_OFFER: {
46-
V20CredFormat.Format.ANONCREDS.api: "anoncreds/cred-abstract@v2.0",
46+
V20CredFormat.Format.ANONCREDS.api: "anoncreds/credential-offer@v1.0",
4747
V20CredFormat.Format.INDY.api: "hlindy/[email protected]",
4848
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]",
4949
V20CredFormat.Format.VC_DI.api: "didcomm/[email protected]",
5050
},
5151
CRED_20_REQUEST: {
52-
V20CredFormat.Format.ANONCREDS.api: "anoncreds/cred-req@v2.0",
52+
V20CredFormat.Format.ANONCREDS.api: "anoncreds/credential-request@v1.0",
5353
V20CredFormat.Format.INDY.api: "hlindy/[email protected]",
5454
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]",
5555
V20CredFormat.Format.VC_DI.api: "didcomm/[email protected]",
5656
},
5757
CRED_20_ISSUE: {
58-
V20CredFormat.Format.ANONCREDS.api: "anoncreds/cred@v2.0",
58+
V20CredFormat.Format.ANONCREDS.api: "anoncreds/credential@v1.0",
5959
V20CredFormat.Format.INDY.api: "hlindy/[email protected]",
6060
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]",
6161
V20CredFormat.Format.VC_DI.api: "didcomm/[email protected]",

acapy_agent/protocols/issue_credential/v2_0/routes.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from ....messaging.models.openapi import OpenAPISchema
2929
from ....messaging.models.paginated_query import PaginatedQuerySchema, get_limit_offset
3030
from ....messaging.valid import (
31+
ANONCREDS_CRED_DEF_ID_EXAMPLE,
3132
ANONCREDS_DID_EXAMPLE,
3233
ANONCREDS_SCHEMA_ID_EXAMPLE,
3334
INDY_CRED_DEF_ID_EXAMPLE,
@@ -137,13 +138,24 @@ class V20CredStoreRequestSchema(OpenAPISchema):
137138
class V20CredFilterAnoncredsSchema(OpenAPISchema):
138139
"""Anoncreds credential filtration criteria."""
139140

140-
cred_def_id = fields.Str(
141+
schema_issuer_id = fields.Str(
141142
required=False,
142143
metadata={
143-
"description": "Credential definition identifier",
144+
"description": "Schema issuer ID",
144145
"example": ANONCREDS_DID_EXAMPLE,
145146
},
146147
)
148+
schema_name = fields.Str(
149+
required=False,
150+
metadata={"description": "Schema name", "example": "preferences"},
151+
)
152+
schema_version = fields.Str(
153+
required=False,
154+
metadata={
155+
"description": "Schema version",
156+
"example": MAJOR_MINOR_VERSION_EXAMPLE,
157+
},
158+
)
147159
schema_id = fields.Str(
148160
required=False,
149161
metadata={
@@ -154,13 +166,16 @@ class V20CredFilterAnoncredsSchema(OpenAPISchema):
154166
issuer_id = fields.Str(
155167
required=False,
156168
metadata={
157-
"description": "Credential issuer DID",
169+
"description": "Credential issuer ID",
158170
"example": ANONCREDS_DID_EXAMPLE,
159171
},
160172
)
161-
epoch = fields.Str(
173+
cred_def_id = fields.Str(
162174
required=False,
163-
metadata={"description": "Credential epoch time", "example": "2021-08-24"},
175+
metadata={
176+
"description": "Credential definition identifier",
177+
"example": ANONCREDS_CRED_DEF_ID_EXAMPLE,
178+
},
164179
)
165180

166181

acapy_agent/protocols/issue_credential/v2_0/tests/test_routes.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,29 @@ async def test_validate_cred_filter_schema(self):
6161
with self.assertRaises(test_module.ValidationError):
6262
schema.validate_fields({"veres-one": {"no": "support"}})
6363

64+
async def test_validate_cred_filter_anoncreds_schema(self):
65+
schema = test_module.V20CredFilterSchema()
66+
schema.validate_fields({"anoncreds": {"issuer_id": TEST_DID}})
67+
schema.validate_fields(
68+
{"anoncreds": {"issuer_id": TEST_DID, "schema_version": "1.0"}}
69+
)
70+
schema.validate_fields(
71+
{
72+
"anoncreds": {"issuer_id": TEST_DID},
73+
}
74+
)
75+
schema.validate_fields(
76+
{
77+
"anoncreds": {},
78+
}
79+
)
80+
with self.assertRaises(test_module.ValidationError):
81+
schema.validate_fields({})
82+
with self.assertRaises(test_module.ValidationError):
83+
schema.validate_fields(["hopeless", "stop"])
84+
with self.assertRaises(test_module.ValidationError):
85+
schema.validate_fields({"veres-one": {"no": "support"}})
86+
6487
async def test_validate_create_schema(self):
6588
schema = test_module.V20IssueCredSchemaCore()
6689
schema.validate(

acapy_agent/protocols/present_proof/v2_0/message_types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@
3232
# Format specifications
3333
ATTACHMENT_FORMAT = {
3434
PRES_20_PROPOSAL: {
35-
V20PresFormat.Format.ANONCREDS.api: "anoncreds/proof-req@v2.0",
35+
V20PresFormat.Format.ANONCREDS.api: "anoncreds/proof-proposal@v1.0",
3636
V20PresFormat.Format.INDY.api: "hlindy/[email protected]",
3737
V20PresFormat.Format.DIF.api: "dif/presentation-exchange/[email protected]",
3838
},
3939
PRES_20_REQUEST: {
40-
V20PresFormat.Format.ANONCREDS.api: "anoncreds/proof-req@v2.0",
40+
V20PresFormat.Format.ANONCREDS.api: "anoncreds/proof-request@v1.0",
4141
V20PresFormat.Format.INDY.api: "hlindy/[email protected]",
4242
V20PresFormat.Format.DIF.api: "dif/presentation-exchange/[email protected]",
4343
},
4444
PRES_20: {
45-
V20PresFormat.Format.ANONCREDS.api: "anoncreds/proof@v2.0",
45+
V20PresFormat.Format.ANONCREDS.api: "anoncreds/proof@v1.0",
4646
V20PresFormat.Format.INDY.api: "hlindy/[email protected]",
4747
V20PresFormat.Format.DIF.api: "dif/presentation-exchange/[email protected]",
4848
},

0 commit comments

Comments
 (0)