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

Credential Schemas #340

Merged
merged 11 commits into from
Sep 21, 2023
Merged

Credential Schemas #340

merged 11 commits into from
Sep 21, 2023

Conversation

TaylorBeeston
Copy link
Collaborator

Overview

🎟 Relevant Jira Issues

📚 What is the context and goal of this PR?

The CLR Spec mentions that CLRs must have
a credentialSchema, and that verifiers must check the schema when verifying

🥴 TL; RL:

Adds support for checking credentialSchema as defined in the CLR spec and various specs relating
to it/referenced by it

💡 Feature Breakdown (screenshots & videos encouraged!)

Most of the work here happened in SSI, and I submitted a PR upstream, so you can read about that here!

  • Fixed a bug where options were not being propagated through plugins when verifying
  • Updated the ProofOptions type to correctly have the checks that SSI allows, and added credentialSchema as one of those checks
  • Updated the verification logic in the VC plugin to automatically add credentialStatus and/or credentialSchema to checks if the incoming VC has the respective fields
    • You can override this by just passing in a different checks array

🛠 Important tradeoffs made:

We are only supporting 1EdTechJSONSchemaValidator2019 schemas for now. I wrote about this in the SSI
PR, but basically it shouldn't be too bad to add support for more in the future, I'm just not super
familiar with what's out there.

Also, it seems adding some of the necessary contexts and syncing with upstream has bloated the WASM
payload up to almost 9 MB now =( Not sure what the best solution is, but maybe someday I can look
at taking some stuff out to lower that, or maybe just adding dynamic context resolution to our fork
and then not inlining so many contexts or something

🔍 Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Chore (refactor, documentation update, etc)

💳 Does This Create Any New Technical Debt? ( If yes, please describe and add JIRA TODOs )

  • No
  • Yes

Testing

🔬 How Can Someone QA This?

Open up the CLI, bring in this bad boy
and replace the issuer ID with learnCard.id.did() (i.e. vc.issuer.id = learnCard.id.did()).
Then issue it and verify the resulting credential. You should see schema in the checks array!

📱 🖥 Which devices would you like help testing on?

🧪 Code Coverage

Documentation

📜 Gitbook

📊 Storybook

✅ PR Checklist

  • Related to a Jira issue (create one if not)
  • My code follows style guidelines (eslint / prettier)
  • I have manually tested common end-2-end cases
  • I have reviewed my code
  • I have commented my code, particularly where ambiguous
  • New and existing unit tests pass locally with my changes
  • I have made corresponding changes to gitbook documentation

🚀 Ready to squash-and-merge?:

  • Code is backwards compatible
  • There is not a "Do Not Merge" label on this PR
  • I have thoughtfully considered the security implications of this change.
  • This change does not expose new public facing endpoints that do not have authentication

@changeset-bot
Copy link

changeset-bot bot commented Jul 14, 2023

🦋 Changeset detected

Latest commit: 9c1d726

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

This PR includes changesets to release 21 packages
Name Type
@learncard/learn-cloud-service Minor
@learncard/network-brain-service Minor
@learncard/network-plugin Minor
@learncard/expiration-plugin Minor
@learncard/learn-card-plugin Minor
@learncard/didkit-plugin Minor
@learncard/vc-plugin Minor
@learncard/cli Minor
@learncard/init Minor
@learncard/learn-cloud-client Patch
@learncard/learn-cloud-plugin Patch
@learncard/network-brain-client Patch
@learncard/did-web-plugin Patch
@learncard/snap-example-dapp Patch
@learncard/chapi-plugin Patch
@learncard/chapi-example Patch
@learncard/create-http-bridge Patch
@learncard/react Patch
learn-card-discord-bot Patch
@learncard/idx-plugin Patch
@learncard/snap-chapi-example 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

@netlify
Copy link

netlify bot commented Jul 14, 2023

Deploy Preview for learncarddocs canceled.

Name Link
🔨 Latest commit 9c1d726
🔍 Latest deploy log https://app.netlify.com/sites/learncarddocs/deploys/650c900e06397f0009202740

@netlify
Copy link

netlify bot commented Jul 14, 2023

Deploy Preview for learn-card-chapi-example ready!

Name Link
🔨 Latest commit 9c1d726
🔍 Latest deploy log https://app.netlify.com/sites/learn-card-chapi-example/deploys/650c900ea67562000823a9cd
😎 Deploy Preview https://deploy-preview-340--learn-card-chapi-example.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Custard7
Copy link
Collaborator

@TaylorBeeston - I just tried to running this, and am getting the following error. Do I need to take a specific build step?

Screen Shot 2023-07-19 at 4 20 49 PM

@TaylorBeeston
Copy link
Collaborator Author

@Custard7 sometimes NX will cache things it shouldn't so maybe try starting the CLI with pnx start cli --skip-nx-cache

@Custard7
Copy link
Collaborator

@TaylorBeeston

Hmm, okay I did pnx start cli --skip-nx-cache, and now I get this error:

Screen Shot 2023-07-25 at 10 05 05 PM

Although, upon further investigation, 1EdTech just updated the schema from 3.0.1, to 3.0.2 🙈

Screen Shot 2023-07-25 at 10 07 18 PM

Dangit. So this is probably working for 3.0.1, but I can't test with the 3.0.2 latest CLR schema...

@TaylorBeeston
Copy link
Collaborator Author

Omg nice lol. I can add support for 3.0.2 in the morning!

@Custard7
Copy link
Collaborator

@TaylorBeeston - is this the PR? Let me know if its ready, seems like we still need 3.0.2 and to update with main

Copy link
Collaborator

@Custard7 Custard7 left a comment

Choose a reason for hiding this comment

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

@TaylorBeeston worked like a charm ✅ 🍀

Screen Shot 2023-09-20 at 6 28 40 PM

@Custard7
Copy link
Collaborator

@TaylorBeeston - should we merge this guy in?

@TaylorBeeston
Copy link
Collaborator Author

@Custard7 yup! I'm just waiting/watching the context plane stuff first! There was an issue where it didn't want to publish the dynamic loader plugin to npm 🙃

@TaylorBeeston TaylorBeeston merged commit 867d38c into main Sep 21, 2023
13 of 14 checks passed
@TaylorBeeston TaylorBeeston deleted the credential-schemas branch September 21, 2023 18:56
@github-actions github-actions bot mentioned this pull request Sep 21, 2023
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.

2 participants