-
Notifications
You must be signed in to change notification settings - Fork 38
feat: issue-credential v1 plugin #2288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
7cd2a6a to
06f72e3
Compare
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
7b0ebe0 to
ec2c85b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds an issue-credential v1.0 plugin to support the legacy v1 credential issuance protocol. The implementation includes a monkey patch for OOB invitation credential offer attachments and a new revocation event handler to update credential exchange record states when credentials are revoked.
Key changes:
- Complete plugin structure with models, messages, handlers, routes, and comprehensive test coverage
- Monkey patch to InvitationCreator.create_attachment for v1 credential offer support in OOB invitations
- Event handler registration to handle credential revocation events and update v1 exchange records
Reviewed changes
Copilot reviewed 54 out of 63 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Poetry configuration with dependencies and dev tools |
| routes.py | Admin API routes with monkey patch and revocation event handler |
| models/credential_exchange.py | V10CredentialExchange record model and schema |
| messages/*.py | Message classes for v1 protocol (proposal, offer, request, issue, ack) |
| handlers/tests/*.py | Comprehensive handler unit tests |
| v1_0/tests/*.py | Unit tests for routes and manager |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
issue_credential/issue_credential/v1_0/messages/inner/credential_preview.py
Outdated
Show resolved
Hide resolved
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
| _original_create_attachment = InvitationCreator.create_attachment | ||
|
|
||
|
|
||
| async def _patched_create_attachment(self, attachment: Mapping, pthid: str, session): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the monkey patch which does the V1 attachment handling or falls back to the the default from acapy.
| bus.subscribe(re.compile(r"^acapy::cred-revoked$"), cred_revoked) | ||
|
|
||
|
|
||
| async def cred_revoked(profile: Profile, event: EventWithMetadata): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the cred_ex revocation for v1 part. Aca-py has the same thing targeting the IssuerV2CredRevRecord's.
| ) | ||
|
|
||
| # OOB backwards compatibility. This is needed for adding v1 attachments. | ||
| for r in app.router.routes(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where the endpoint gets overridden with the patched class/function. It's not ideal to override the private handler but there's no other way I can think of.
multitenant_provider does the same thing for overriding endpoints.
Add a plugin for issuance v1 protocols.
Adds the protocols via the definition.py file and copies all the unit tests over.
2 things to get full functionality:
For more information see the original PR #1056
One thing about doing the
present-proofprotocol next is that this is overriding the oob create invitation endpoint with the monkey patched function. Thepresent-proofwill need to do this as well. I think the way to do this is have a dependency with each other where each plugin both has the same monkey patch.