decentralized-identity / veramo

A JavaScript Framework for Verifiable Data
https://veramo.io
Apache License 2.0
414 stars 130 forks source link

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

Closed mirceanis closed 5 months ago

mirceanis commented 5 months ago

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:

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 commented 5 months ago

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 :warning:
...s/credential-ld/src/suites/JsonWebSignature2020.ts 66.66% 1 Missing :warning:
Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.