Skip to content

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

@changeset-bot
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 <[email protected]>

feat: support w3c revocation

Signed-off-by: Krishna Waske <[email protected]>

chore: verify credential status

Signed-off-by: Krishna Waske <[email protected]>

chore: rearrange files

Signed-off-by: Krishna Waske <[email protected]>

chore: remove unnecessary code from credentials API

Signed-off-by: Krishna Waske <[email protected]>

chore: remove unnecessary code from credentials API

Signed-off-by: Krishna Waske <[email protected]>

chore: remove bitstring specific credential status from jsonld cred formats

Signed-off-by: Krishna Waske <[email protected]>

chore: add appropriate format based error

Signed-off-by: Krishna Waske <[email protected]>

chore: rename symbol

Signed-off-by: Krishna Waske <[email protected]>

chore: update folder name

Signed-off-by: Krishna Waske <[email protected]>

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

Signed-off-by: Krishna Waske <[email protected]>

chore: add named imports from pako

Signed-off-by: Krishna Waske <[email protected]>

chore: update error for verifying bit string status list credential

Signed-off-by: Krishna Waske <[email protected]>

chore: move validate status logic to libraries

Signed-off-by: Krishna Waske <[email protected]>

refactor: Invalidate array of bitStringStatusListCredential

Signed-off-by: Krishna Waske <[email protected]>

refactor: export files from index

Signed-off-by: Krishna Waske <[email protected]>

refactor: separate bitstring statuslist and bitstring status list credential

Signed-off-by: Krishna Waske <[email protected]>

feat: add CredentialStatusBasedOnType

Signed-off-by: Krishna Waske <[email protected]>

reactor: remove duplicate code

Signed-off-by: Krishna Waske <[email protected]>

chore: add comment

Signed-off-by: Krishna Waske <[email protected]>

fix: add credential status compare while verifyReceivedCredentialMatchesRequest

Signed-off-by: Krishna Waske <[email protected]>

fix: remove credentialStatus from unsupported fields while accepting request

Signed-off-by: Krishna Waske <[email protected]>

fix: imports

Signed-off-by: Krishna Waske <[email protected]>

chore: update imports

Signed-off-by: Krishna Waske <[email protected]>

fix: imports

Signed-off-by: Krishna Waske <[email protected]>

chore: update minor type changes

Signed-off-by: Krishna Waske <[email protected]>

fix: remove unnecessary tranformation

Signed-off-by: Krishna Waske <[email protected]>

fix: verification of bitstring status list credential after fetching

Signed-off-by: Krishna Waske <[email protected]>

chore: push pnpm-lock file

Signed-off-by: Krishna Waske <[email protected]>

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

Signed-off-by: Krishna Waske <[email protected]>

fix: completed TODO

Signed-off-by: Krishna Waske <[email protected]>

fix: check signature of fetched credential, w3cjwt support

Signed-off-by: Krishna Waske <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>
…ocation separated from credo

Signed-off-by: Krishna Waske <[email protected]>
…ocation separated from credo

Signed-off-by: Krishna Waske <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>
@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.

"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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Pako is also used by SD-JWT JS library, works in react native, and since we already depend on it is maybe not a bad choice. I have no idea on the size .

@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 <[email protected]>
@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 <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>
Comment on lines 10 to 11
'revocation' = 'revocation',
'suspension' = 'suspension',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'revocation' = 'revocation',
'suspension' = 'suspension',
Revocation = 'revocation',
Suspension = 'suspension',

Comment on lines 137 to 156
// // Define an interface for the `credential` object that uses `CredentialSubject`
// export interface Credential {
// credentialSubject: CredentialSubject
// }

// // Use the `Credential` interface within `BitStringStatusListCredential`
// export interface BitStringStatusListCredential {
// credential: Credential
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove unused code?

})
}

@IsString()
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be a string? It's an object right?

}

try {
return (await response.json()) as BitStringStatusListCredential
Copy link
Contributor

Choose a reason for hiding this comment

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

The bitstrintstatuslistcredential is a class. We should transform and validate the json to a class instance

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public async revokeCredential(_agentContext: AgentContext, _options: RevokeCredentialOptions) {
// revoke jwt cred
throw new CredoError(`Revocation support not implemented for jwtVc`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why add these methods if both jwt and jsonld are not implemented?

"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.

Pako is also used by SD-JWT JS library, works in react native, and since we already depend on it is maybe not a bad choice. I have no idea on the size .

@TimoGlastra
Copy link
Contributor

@GHkrishna could you update the PR with the latest main, and fix the CI tests?

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.

4 participants