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

fix(did-provider-key): align did:key resolver to spec #1332

Merged
merged 3 commits into from
Jan 26, 2024

Conversation

mirceanis
Copy link
Member

What issue is this PR fixing

fixes #1330

What is being changed

The did:key resolver implementations imported from transmute resolved to outdated Verification method formats.
This PR replaces those dependencies with a local implementation that also adheres better to the spec for defaults and behavior.

The verification methods default to JsonWebKey2020, unless otherwise specified through the options.publicKeyFormat parameter.
This implementation also supports options.enableEncryptionKeyDerivation, defaulting to true, that triggers the expression of the corresponding X25519 keyAgreement key for an Ed25519 public key.

This implementation supports Ed25519, X25519, Secp256k1, and P-256 key types for did:key.

Quality

Check all that apply:

  • I want these changes to be integrated
  • I successfully ran pnpm i, pnpm build, pnpm test, pnpm test:browser locally.
  • I allow my PR to be updated by the reviewers (to speed up the review process).
  • I added unit tests.
  • I added integration tests.

Notes

This PR is based on #1331, as changing the default verification methods in did:key triggers the corner case signaled in #1329 and fixed in #1331

@codecov-commenter
Copy link

Codecov Report

Attention: 25 lines in your changes are missing coverage. Please review.

Comparison is base (7896cea) 89.83% compared to head (1df297e) 89.84%.

Files Patch % Lines
packages/did-provider-key/src/resolver.ts 91.33% 24 Missing ⚠️
...s/credential-ld/src/suites/JsonWebSignature2020.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1332      +/-   ##
==========================================
+ Coverage   89.83%   89.84%   +0.01%     
==========================================
  Files         176      176              
  Lines       27010    27278     +268     
  Branches     2120     2164      +44     
==========================================
+ Hits        24265    24509     +244     
- Misses       2745     2769      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mirceanis mirceanis merged commit 8e3b94c into next Jan 26, 2024
9 checks passed
@mirceanis mirceanis deleted the 1330-did-key-spec-alignment branch January 26, 2024 21:04
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.

did:key resolver doesn't match the spec
4 participants