-
Notifications
You must be signed in to change notification settings - Fork 204
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
feat: support w3c revocation #2072
Draft
GHkrishna
wants to merge
14
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.
Draft
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2fc170b
feat: support w3c revocation
02c3d92
feat: support w3c revocation
7c089ae
chore: verify credential status
GHkrishna a6b5f5f
chore: rearrange files
GHkrishna 46b87bf
chore: remove unnecessary code from credentials API
GHkrishna ed8a3a8
chore: remove unnecessary code from credentials API
GHkrishna 26be6f2
chore: remove bitstring specific credential status from jsonld cred f…
GHkrishna 444551d
chore: add appropriate format based error
GHkrishna 078c43c
chore: rename symbol
GHkrishna 5e2dbd6
Merge branch 'main' into feat/support-w3c-revocation
GHkrishna f1dc6ee
chore: update folder name
GHkrishna e72e89a
fix: typing and other minor issues while verifying Bitstring status l…
GHkrishna cb92fdf
chore: add named imports from pako
GHkrishna 535cdbd
chore: update error for verifying bit string status list credential
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 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
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
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
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 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
45 changes: 45 additions & 0 deletions
45
packages/core/src/modules/vc/models/credential/w3c-credential-status/W3cCredentialStatus.ts
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,45 @@ | ||
import { plainToInstance } from 'class-transformer' | ||
import { IsString, validateOrReject } from 'class-validator' | ||
|
||
import { AgentContext } from '../../../../../agent/context' | ||
import { CredoError } from '../../../../../error' | ||
import { IsUri } from '../../../../../utils/validators' | ||
|
||
export interface W3cCredentialStatusOptions { | ||
id: string | ||
type: string | ||
} | ||
|
||
export class W3cCredentialStatus { | ||
public constructor(options: W3cCredentialStatusOptions) { | ||
if (options) { | ||
this.id = options.id | ||
this.type = options.type | ||
} | ||
} | ||
|
||
@IsUri() | ||
@IsString() | ||
public id!: string | ||
|
||
@IsString() | ||
public type!: string | ||
} | ||
|
||
// Function to validate the status using the updated method | ||
export const validateStatus = async ( | ||
status: W3cCredentialStatus | W3cCredentialStatus[], | ||
agentContext: AgentContext | ||
): Promise<boolean> => { | ||
const entry = plainToInstance(W3cCredentialStatus, status) | ||
|
||
try { | ||
await validateOrReject(entry) | ||
return true | ||
} catch (errors) { | ||
agentContext.config.logger.debug(`Credential status validation failed: ${errors}`, { | ||
stack: errors, | ||
}) | ||
throw new CredoError(`Invalid credential status type: ${errors}`) | ||
} | ||
} |
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.
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.
Ahh yes you are right. Also as the specs suggest the issuer may not always be the one revoking the credential. Will change it