-
Notifications
You must be signed in to change notification settings - Fork 239
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
GHkrishna
wants to merge
16
commits into
openwallet-foundation:main
Choose a base branch
from
GHkrishna:feat/support-w3c-revocation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
10c8696
chore: add missing test script in package-core
GHkrishna c6d050d
Merge branch 'openwallet-foundation:main' into main
GHkrishna 926909f
feat: support w3c revocation
GHkrishna c50074e
fix: rebasing conflicts
GHkrishna 60dd875
fix: as discussed in the call we would need to keep the logic for rev…
GHkrishna 178ca90
fix: as discussed in the call we would need to keep the logic for rev…
GHkrishna 59f49ed
chore: remove comments
GHkrishna 748731e
fix: remove unnecessay imports
GHkrishna 2941920
fix: consistency with other interface
GHkrishna 6fdad0f
fix: expose CredentialStatusBasedOnType to easily access it
GHkrishna 5454eda
chore: remove commented code
GHkrishna 3f4e03b
Merge branch 'main' into feat/support-w3c-revocation
GHkrishna 8c2dc94
fix: import path change
GHkrishna 1100c63
fix: add and fix existing test cases
GHkrishna 05ea39e
fix: package lock
GHkrishna 3ab1d73
fix: linting issues
GHkrishna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
47 changes: 47 additions & 0 deletions
47
packages/core/src/modules/vc/data-integrity/libraries/credentialStatus.ts
This file contains hidden or 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,47 @@ | ||
| import type { AgentContext } from '../../../../agent' | ||
| import type { W3cCredentialStatus } from '../../models/credential/w3c-credential-status/W3cCredentialStatus' | ||
|
|
||
| import { CredoError } from '../../../../error/CredoError' | ||
| import type { SingleOrArray } from '../../../../types' | ||
| import { ClaimFormat } from '../../models' | ||
| import { | ||
| BitStringStatusListEntry, | ||
| verifyBitStringCredentialStatus, | ||
| } from '../../models/credential/w3c-credential-status' | ||
| import { W3cCredentialStatusSupportedTypes } from '../../models/credential/w3c-credential-status/W3cCredentialStatus' | ||
|
|
||
| // Function to validate the status using the updated method | ||
| export const validateStatus = async ( | ||
| credentialStatus: SingleOrArray<W3cCredentialStatus>, | ||
| agentContext: AgentContext, | ||
| credentialFormat: ClaimFormat.JwtVc | ClaimFormat.LdpVc | ||
| ): Promise<boolean> => { | ||
| if (Array.isArray(credentialStatus)) { | ||
| agentContext.config.logger.debug('Credential status type is array') | ||
| throw new CredoError( | ||
| 'Invalid credential status type. Currently only a single credentialStatus is supported per credential' | ||
| ) | ||
| } | ||
|
|
||
| switch (credentialStatus.type) { | ||
| case W3cCredentialStatusSupportedTypes.BitstringStatusListEntry: | ||
| agentContext.config.logger.debug('Credential status type is BitstringStatusListEntry') | ||
| try { | ||
| await verifyBitStringCredentialStatus( | ||
| credentialStatus as unknown as BitStringStatusListEntry, | ||
| agentContext, | ||
| credentialFormat | ||
| ) | ||
| } catch (errors) { | ||
| throw new CredoError('Error while validating credential status', errors) | ||
| } | ||
| break | ||
| default: | ||
| throw new CredoError( | ||
| `Invalid credential status type. Supported types are: ${Object.values(W3cCredentialStatusSupportedTypes).join( | ||
| ', ' | ||
| )}` | ||
| ) | ||
| } | ||
| return true | ||
| } |
This file contains hidden or 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 hidden or 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
23 changes: 0 additions & 23 deletions
23
packages/core/src/modules/vc/models/credential/W3cCredentialStatus.ts
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
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.
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.
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 .