Skip to content

feat: support w3c revocation #2072

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

GHkrishna
Copy link
Contributor

@GHkrishna GHkrishna commented Oct 29, 2024

What

This PR introduces support for W3C credential revocation. The following changes have been made:

Refactor functionality for Verify Credential and Verify Presentation.
Integrated with the Bit String Status List for checking and updating credential status.

How

Revocation Flow: Implemented the revocation flow by checking a credential status and updating the credential issuance process to handle revocable credentials.
Integration: Integrated the new revocation features with the existing system, ensuring compatibility and proper handling of revoked credentials.

TO DO:

  • Validation of revocable Bitstring Status List Entry in a w3cCredential
  • Create and maintain BitstringStatusList Credential~
    • Update signature related models
      - [ ] Keep track of occupied and/or free spaces in the BSLC
      - [ ] Endpoints to create and post(host) a BitstringStatusList Credential
  • Issue a revocable credential (including BitStringStatusListEntry)
    • Update issuance related models
    • Ability to accept a revocable credential (without modifying existing BSLC).
      (However, ability to verify signature of fetched credential is required)
      - [ ] Update records as per occupied (both locally as well as on the server)
      - [ ] Revoking(change status of) a w3cCredential (issued by issuer or others capable of revoking the credential)
  • Revocation notification: Ability to notify holder about change in status
  • Add tags, etc in revocable credentials?
    (Might add some related taxs)
  • Add test cases

Copy link

changeset-bot bot commented Oct 29, 2024

⚠️ No Changeset found

Latest commit: 3ab1d73

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@GHkrishna
Copy link
Contributor Author

GHkrishna commented Oct 29, 2024

Hello @TimoGlastra, wanting to create a separate PR for w3c revocation, due to some conflicts in the original PR #2024 .
The work until now, I have updated with the origin authors name.

I'll start with integrating the changes you suggested

@GHkrishna GHkrishna marked this pull request as ready for review December 3, 2024 03:19
@GHkrishna GHkrishna force-pushed the feat/support-w3c-revocation branch from b2e1d60 to 078c43c Compare December 3, 2024 03:23
@GHkrishna GHkrishna marked this pull request as draft December 4, 2024 05:16
@GHkrishna GHkrishna marked this pull request as ready for review December 22, 2024 09:24
@GHkrishna GHkrishna marked this pull request as draft December 23, 2024 04:36
@GHkrishna GHkrishna force-pushed the feat/support-w3c-revocation branch from 535cdbd to f5671a7 Compare January 13, 2025 05:38
@GHkrishna
Copy link
Contributor Author

Some concerns:

  1. Where to manage occupied/empty index?
  2. Should credo create/update BSLC?
  3. During revocation how to manage indexes to revoke?

Current approach:

image

Do we need to do this?

image

@GHkrishna GHkrishna marked this pull request as ready for review March 27, 2025 13:30
@GHkrishna GHkrishna requested a review from a team as a code owner March 27, 2025 13:30
@GHkrishna GHkrishna force-pushed the feat/support-w3c-revocation branch from 9786c84 to 22a8462 Compare April 7, 2025 18:32
@GHkrishna
Copy link
Contributor Author

GHkrishna commented Apr 7, 2025

As per the discussion in the community call(with @TimoGlastra and @genaris ), the index allocation logic and the logic to revoke credential should be part of the revokers preference and credo must only be responsible for signing the BitSting status list credential and issuing a revocable credential containing a valid credential status property.

Apologies as the PR is getting de-prioritized from my end. Looking forward to your reviews

GHkrishna and others added 8 commits April 9, 2025 03:21
Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

feat: support w3c revocation

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: verify credential status

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: rearrange files

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: remove unnecessary code from credentials API

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: remove unnecessary code from credentials API

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: remove bitstring specific credential status from jsonld cred formats

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: add appropriate format based error

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: rename symbol

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: update folder name

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

fix: typing and other minor issues while verifying Bitstring status list credential

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: add named imports from pako

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: update error for verifying bit string status list credential

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: move validate status logic to libraries

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

refactor: Invalidate array of bitStringStatusListCredential

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

refactor: export files from index

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

refactor: separate bitstring statuslist and bitstring status list credential

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

feat: add CredentialStatusBasedOnType

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

reactor: remove duplicate code

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: add comment

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

fix: add credential status compare while verifyReceivedCredentialMatchesRequest

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

fix: remove credentialStatus from unsupported fields while accepting request

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

fix: imports

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: update imports

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

fix: imports

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: update minor type changes

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

fix: remove unnecessary tranformation

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

fix: verification of bitstring status list credential after fetching

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

chore: push pnpm-lock file

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

fix: take claimformat from options instead of from credential record, which might not always be present

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

fix: completed TODO

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

fix: check signature of fetched credential, w3cjwt support

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
…ocation separated from credo

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
…ocation separated from credo

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
@GHkrishna
Copy link
Contributor Author

Hello @genaris @TimoGlastra
Need your feedback on the PR, since, it has a risk of getting stale.

I understand you guys are quite occupied with all the interesting work going on in credo. Since this PR is quite raw, your feedback is quite essential to accommodate changes based on them.

Thank you once again.

Copy link
Contributor

@genaris genaris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @GHkrishna ! In general it looks good to me, as it is a good first step to support Bitstring Status lists.

I think it would be good to add some tests as well.

@@ -58,6 +58,8 @@
"lru_map": "^0.4.1",
"make-error": "^1.3.6",
"object-inspect": "^1.10.3",
"pako": "^2.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does pako work fine in react native? How does it compare with other modules such as fflate? I'm asking this because we want core to be as smaller as possible and it looks like pako is a bit heavy.

Copy link
Contributor Author

@GHkrishna GHkrishna Jun 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that's a good suggestion, I'm all in on keeping core as small as possible,
Pako did work fine with an android device.
I was not aware about fflate, will have a look at it.

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
GHkrishna added 3 commits June 7, 2025 16:20
Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
@GHkrishna
Copy link
Contributor Author

I think it would be good to add some tests as well.

Yes sure, I just wanted to make sure, we are on the right track before starting with the test cases. I think this is a good time to start now.

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
@GHkrishna
Copy link
Contributor Author

Ariel, currently I'm adding testcases for revocable credential in addition to that of the existing ones(non-revocable w3c) instead of replacing/editing them.

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants