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

Implement Did:Web #378

Closed
wants to merge 4 commits into from
Closed

Implement Did:Web #378

wants to merge 4 commits into from

Conversation

nitro-neal
Copy link
Contributor

This implements the did:web method to web5-js package. This also adds the did:web resolve test vectors

Example Creation:

const portableDid = await DidWebMethod.create({ didWebId: 'did:web:example.com'});

Example did:web Document

{
   "did":"did:web:www.linkedin.com",
   "document":{
      "id":"did:web:www.linkedin.com",
      "verificationMethod":[
         {
            "id":"did:web:www.linkedin.com#key-0",
            "type":"JsonWebKey2020",
            "controller":"did:web:www.linkedin.com",
            "publicKeyJwk":{
               "alg":"EdDSA",
               "crv":"Ed25519",
               "kty":"OKP",
               "ext":"true",
               "key_ops":[
                  "verify"
               ],
               "x":"hc-XL1kJwtmUbeVkWcnomXDz21EHfWEPeGJJjlo3OUs"
            }
         }
      ],
      "authentication":[
         "did:web:www.linkedin.com#key-0"
      ],
      "assertionMethod":[
         "did:web:www.linkedin.com#key-0"
      ],
      "capabilityInvocation":[
         "did:web:www.linkedin.com#key-0"
      ],
      "capabilityDelegation":[
         "did:web:www.linkedin.com#key-0"
      ],
      "@context":[
         "https://www.w3.org/ns/did/v1",
         "https://w3id.org/security/suites/jws-2020/v1"
      ]
   },
   "keySet":{
      "verificationMethodKeys":[
         {
            "publicKeyJwk":{
               "alg":"EdDSA",
               "crv":"Ed25519",
               "kty":"OKP",
               "ext":"true",
               "key_ops":[
                  "verify"
               ],
               "x":"hc-XL1kJwtmUbeVkWcnomXDz21EHfWEPeGJJjlo3OUs"
            },
            "privateKeyJwk":{
               "d":"C37hmybgtDsT1csFUcqbazclufdMBH4ut6z5WIR_69Y",
               "alg":"EdDSA",
               "crv":"Ed25519",
               "kty":"OKP",
               "ext":"true",
               "key_ops":[
                  "sign"
               ],
               "x":"hc-XL1kJwtmUbeVkWcnomXDz21EHfWEPeGJJjlo3OUs"
            },
            "relationships":[
               "authentication"
            ]
         }
      ]
   }
}

Copy link

codesandbox bot commented Jan 16, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

github-actions bot commented Jan 16, 2024

TBDocs Report

✅ No errors or warnings

@web5/api

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

TBDocs Report Updated at 2024-01-16T22:30:22Z 6503530

Copy link

codecov bot commented Jan 16, 2024

Codecov Report

Merging #378 (6503530) into main (474cc47) will decrease coverage by 0.08%.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #378      +/-   ##
==========================================
- Coverage   91.90%   91.82%   -0.08%     
==========================================
  Files          67       59       -8     
  Lines       18241    15725    -2516     
  Branches     1550     1294     -256     
==========================================
- Hits        16764    14440    -2324     
+ Misses       1454     1266     -188     
+ Partials       23       19       -4     
Components Coverage Δ
agent 88.71% <ø> (ø)
api 96.73% <ø> (-0.22%) ⬇️
common 98.57% <ø> (ø)
credentials ∅ <ø> (∅)
crypto 94.60% <ø> (ø)
dids ∅ <ø> (∅)
identity-agent 56.81% <ø> (ø)
crypto-aws-kms 100.00% <ø> (ø)
proxy-agent 58.43% <ø> (ø)
user-agent 55.22% <ø> (ø)

Copy link
Contributor

@frankhinek frankhinek left a comment

Choose a reason for hiding this comment

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

Looks like accidental duplicate work. Sorry about that @nitro-neal .

Moe had put up a PR a couple of months ago that had been pulled in to the @web5/dids refactor I have been working on for the past 7-10 days: #278

There will be a lot refactored in @web5/dids to use the key management and other changes in @web5/crypto so it probably doesn't make a lot of sense to merge this now and then change it a couple of days later. That being said, I think a lot of your code can replace what Moe had originally written.

@frankhinek frankhinek marked this pull request as draft January 17, 2024 00:19
@nitro-neal
Copy link
Contributor Author

Yup all good, was a good exercise regardless, I'll keep the branch open in case we need anything form it.

@nitro-neal nitro-neal closed this Jan 17, 2024
@frankhinek
Copy link
Contributor

yes definitely keep the branch up -- I will plan on using almost all of your code

unfortunately the merge conflicts would be hellish at this point given how much has changed internally within @web5/dids

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