Skip to content
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

Status List Credential Implementation #448

Merged
merged 29 commits into from
May 23, 2024
Merged

Conversation

nitro-neal
Copy link
Contributor

@nitro-neal nitro-neal commented Mar 14, 2024

StatusListCredential represents a digitally verifiable status list credential according to the W3C Verifiable Credentials Status List v2021.

When a status list is published, the result is a verifiable credential that encapsulates the status list.

Implements status list credential create and validateCredentialInStatusList

create

  /**
   * Create a [StatusListCredential] with a specific purpose, e.g., for revocation.
   *
   * @param statusListCredentialId The id used for the resolvable path to the status list credential [String].
   * @param issuer The issuer URI of the credential, as a [String].
   * @param statusPurpose The status purpose of the status list cred, eg: revocation, as a [StatusPurpose].
   * @param issuedCredentials The credentials to be included in the status list credential, eg: revoked credentials, list of type [VerifiableCredential].
   * @returns A special [VerifiableCredential] instance that is a StatusListCredential.
   * @throws Error If the status list credential cannot be created.
   *
   * Example:
   * ```
      StatusListCredential.create({
        statusListCredentialId : 'https://statuslistcred.com/123',
        issuer                 : issuerDid.uri,
        statusPurpose          : StatusPurpose.REVOCATION,
        issuedCredentials      : [credWithCredStatus]
      })
   * ```
   */

validateCredentialInStatusList

  /**
   * Validates if a given credential is part of the status list represented by a [VerifiableCredential].
   *
   * @param credentialToValidate The [VerifiableCredential] to be validated against the status list.
   * @param statusListCredential The [VerifiableCredential] representing the status list.
   * @returns A [Boolean] indicating whether the `credentialToValidate` is part of the status list.
   *
   * This function checks if the given `credentialToValidate`'s status list index is present in the expanded status list derived from the `statusListCredential`.
   *
   * Example:
   * ```
   * const isRevoked = StatusListCredential.validateCredentialInStatusList(credentialToCheck, statusListCred);
   * ```
   */

Closes: #380

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Merging #448 (eced7f6) into main (eba12e9) will decrease coverage by 0.01%.
Report is 4 commits behind head on main.
The diff coverage is 92.30%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #448      +/-   ##
==========================================
- Coverage   93.35%   93.34%   -0.01%     
==========================================
  Files          80       81       +1     
  Lines       23831    24083     +252     
  Branches     1891     1915      +24     
==========================================
+ Hits        22247    22481     +234     
- Misses       1544     1562      +18     
  Partials       40       40              
Components Coverage Δ
agent 88.72% <ø> (ø)
api 97.30% <ø> (ø)
common 98.68% <ø> (ø)
credentials 94.35% <92.30%> (-0.43%) ⬇️
crypto 93.81% <ø> (+<0.01%) ⬆️
dids 97.51% <ø> (ø)
identity-agent 56.81% <ø> (ø)
crypto-aws-kms 100.00% <ø> (ø)
proxy-agent 58.43% <ø> (ø)
user-agent 55.22% <ø> (ø)

decentralgabe
decentralgabe previously approved these changes Mar 15, 2024
Copy link
Member

@decentralgabe decentralgabe left a comment

Choose a reason for hiding this comment

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

nice job on this. the most important thing is to get this into web5 specs with some tests to make sure we can check statuses consistently across impls

Copy link

changeset-bot bot commented Apr 4, 2024

🦋 Changeset detected

Latest commit: 2e21b51

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@web5/credentials Patch

Not sure what this means? Click here to learn what changesets are.

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

@TBD54566975 TBD54566975 deleted a comment from github-actions bot Apr 4, 2024
Copy link
Contributor

github-actions bot commented Apr 4, 2024

TBDocs Report

🛑 Errors: 0
⚠️ Warnings: 1

@web5/api

  • Project entry file: packages/api/src/index.ts
📄 File: ./packages/api/src/web-features.ts
⚠️ extractor:typedoc:missing-docs: installNetworkingFeatures (CallSignature) does not have any documentation.

@web5/crypto

  • Project entry file: packages/crypto/src/index.ts

@web5/crypto-aws-kms

  • Project entry file: packages/crypto-aws-kms/src/index.ts

@web5/dids

  • Project entry file: packages/dids/src/index.ts

@web5/credentials

  • Project entry file: packages/credentials/src/index.ts

TBDocs Report Updated at 2024-05-23T19:32:44Z 2e21b51

@nitro-neal
Copy link
Contributor Author

Adding test vectors here https://github.com/TBD54566975/web5-spec/pull/151/files

@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 93.15589% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 90.89%. Comparing base (c0eba91) to head (0f4a14a).

Current head 0f4a14a differs from pull request most recent head 2e21b51

Please upload reports for the commit 2e21b51 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #448      +/-   ##
==========================================
+ Coverage   90.87%   90.89%   +0.01%     
==========================================
  Files         118      119       +1     
  Lines       29744    30005     +261     
  Branches     2214     2237      +23     
==========================================
+ Hits        27029    27272     +243     
- Misses       2680     2698      +18     
  Partials       35       35              
Components Coverage Δ
agent 80.86% <ø> (ø)
api 94.15% <ø> (ø)
common 98.68% <ø> (ø)
credentials 94.87% <93.15%> (-0.39%) ⬇️
crypto 93.81% <ø> (ø)
dids 97.73% <ø> (ø)
identity-agent 96.70% <ø> (ø)
crypto-aws-kms 100.00% <ø> (ø)
proxy-agent 96.70% <ø> (ø)
user-agent 96.70% <ø> (ø)

Copy link
Member

@thehenrytsai thehenrytsai left a comment

Choose a reason for hiding this comment

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

Hey @nitro-neal, I am going to create a PR to your PR for you to review! 🤣
#486

@nitro-neal
Copy link
Contributor Author

Updated and merged in your updates.

thehenrytsai
thehenrytsai previously approved these changes Apr 9, 2024
Copy link
Member

@thehenrytsai thehenrytsai left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Member

Choose a reason for hiding this comment

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

Fix the tbdocs warning yo!

Copy link
Member

@thehenrytsai thehenrytsai left a comment

Choose a reason for hiding this comment

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

Looks good, except for that typedoc warning... I thought I turned it into an error instead of warning. Maybe this is still running off of old code... will investigate if it continues to be like this.

@nitro-neal
Copy link
Contributor Author

spec update
TBD54566975/web5-spec#151

Copy link
Member

@thehenrytsai thehenrytsai left a comment

Choose a reason for hiding this comment

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

🚀

@nitro-neal nitro-neal merged commit 0de58f3 into main May 23, 2024
13 checks passed
@nitro-neal nitro-neal deleted the status-list-credential-impl branch May 23, 2024 21:41
@github-actions github-actions bot mentioned this pull request May 21, 2024
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.

Add Credentials Feature "Status Lists"
4 participants