forked from openwallet-foundation/acapy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
draft: vcdi proposal format integration
Signed-off-by: supersonicwisd1 <[email protected]>
- Loading branch information
1 parent
1535702
commit 7249eee
Showing
5 changed files
with
166 additions
and
14 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
aries_cloudagent/messaging/credential_definitions/vcdi/util.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
"""Credential definition utilities.""" | ||
|
||
import re | ||
|
||
from marshmallow import fields | ||
|
||
from ....core.profile import Profile | ||
from ...models.openapi import OpenAPISchema | ||
from ...valid import ( | ||
VCDI_CRED_DEF_ID_EXAMPLE, | ||
VCDI_CRED_DEF_ID_VALIDATE, | ||
VCDI_DID_EXAMPLE, | ||
VCDI_DID_VALIDATE, | ||
VCDI_SCHEMA_ID_EXAMPLE, | ||
VCDI_SCHEMA_ID_VALIDATE, | ||
VCDI_VERSION_EXAMPLE, | ||
VCDI_VERSION_VALIDATE, | ||
) | ||
|
||
CRED_DEF_SENT_RECORD_TYPE = "cred_def_sent" | ||
|
||
|
||
class VCDICredDefQueryStringSchema(OpenAPISchema): | ||
"""Query string parameters for credential definition searches.""" | ||
|
||
schema_id = fields.Str( | ||
required=False, | ||
validate=VCDI_SCHEMA_ID_VALIDATE, | ||
metadata={ | ||
"description": "Schema identifier", | ||
"example": VCDI_SCHEMA_ID_EXAMPLE, | ||
}, | ||
) | ||
schema_issuer_did = fields.Str( | ||
required=False, | ||
validate=VCDI_DID_VALIDATE, | ||
metadata={"description": "Schema issuer DID", "example": VCDI_DID_EXAMPLE}, | ||
) | ||
schema_name = fields.Str( | ||
required=False, metadata={"description": "Schema name", "example": "membership"} | ||
) | ||
schema_version = fields.Str( | ||
required=False, | ||
validate=VCDI_VERSION_VALIDATE, | ||
metadata={"description": "Schema version", "example": VCDI_VERSION_EXAMPLE}, | ||
) | ||
issuer_did = fields.Str( | ||
required=False, | ||
validate=VCDI_DID_VALIDATE, | ||
metadata={"description": "Issuer DID", "example": VCDI_DID_EXAMPLE}, | ||
) | ||
cred_def_id = fields.Str( | ||
required=False, | ||
validate=VCDI_CRED_DEF_ID_VALIDATE, | ||
metadata={ | ||
"description": "Credential definition id", | ||
"example": VCDI_CRED_DEF_ID_EXAMPLE, | ||
}, | ||
) | ||
|
||
|
||
CRED_DEF_TAGS = list(vars(VCDICredDefQueryStringSchema).get("_declared_fields", [])) | ||
|
||
CRED_DEF_EVENT_PREFIX = "acapy::CRED_DEF::" | ||
EVENT_LISTENER_PATTERN = re.compile(f"^{CRED_DEF_EVENT_PREFIX}(.*)?$") | ||
|
||
|
||
async def notify_cred_def_event(profile: Profile, cred_def_id: str, meta_data: dict): | ||
"""Send notification for a cred def post-process event.""" | ||
await profile.notify( | ||
CRED_DEF_EVENT_PREFIX + cred_def_id, | ||
meta_data, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
CRED_20_PROPOSAL: { | ||
V20CredFormat.Format.INDY.api: "hlindy/[email protected]", | ||
V20CredFormat.Format.LD_PROOF.api: "aries/[email protected]", | ||
V20CredFormat.Format.VC_DI.api: "didcomm/w3c-di-vc-offer@v0.1", | ||
V20CredFormat.Format.VC_DI.api: "didcomm/[email protected]", | ||
}, | ||
CRED_20_OFFER: { | ||
V20CredFormat.Format.INDY.api: "hlindy/[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters