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

Add web5 CLI for DID creation #63

Merged
merged 2 commits into from
Feb 21, 2024
Merged

Add web5 CLI for DID creation #63

merged 2 commits into from
Feb 21, 2024

Conversation

KendallWeihe
Copy link
Contributor

@KendallWeihe KendallWeihe commented Feb 21, 2024

Summary

This PR proposes the introduction of a web5 CLI tool. Originally prompted by #20 this ticket was inspired by the ftl command line utility.

By no means is the exact DX orthodox, I expect we'll iterate on this, but this puts all the basic pieces in place.

  • cmd/web5/ Go package, which makes use of Kong (cc @alecthomas)
  • scripts/web5 so that developers will instantly gain access to the web5 CLI once they activate their hermit environment
  • Add scripts/ to the hermit env vars
  • Add basic README instructions

Supported commands

  • web5 did:jwk create
  • web5 did:web create <domain>
    • example: web5 did:web create tbd.website

Both commands will print the full Portable DID (JSON formatted with indenting) to the terminal

➜ web5 -h
Usage: web5 <command>

Web5 - A decentralized web platform that puts you in
control of your data and identity.

Flags:
  -h, --help    Show context-sensitive help.

Commands:
  did:jwk create
    Create a did:jwk.

  did:web create <domain>
    Create a did:web.

Run "web5 <command> --help" for more information on a command.

Example did:web creation

web5-go on  kendallw/cmd-did-create [$] via 🐹 v1.22.0
➜ web5 did:web create tbd.website
{
  "uri": "did:web:tbd.website",
  "privateKeys": [
    {
      "alg": "EdDSA",
      "kty": "OKP",
      "crv": "Ed25519",
      "d": "lZZJnTGwkiJ0BXFdkjctG4ZoJJAxDUllpuSpv_zysI1bgLjFXU2S_3XOZQbTxPZg6RPTEHW_gTUfLykMrfufTA",
      "x": "W4C4xV1Nkv91zmUG08T2YOkT0xB1v4E1Hy8pDK37n0w"
    }
  ],
  "document": {
    "id": "did:web:tbd.website",
    "verificationMethod": [
      {
        "id": "#0",
        "type": "JsonWebKey2020",
        "controller": "did:web:tbd.website",
        "publicKeyJwk": {
          "kty": "OKP",
          "crv": "Ed25519",
          "x": "W4C4xV1Nkv91zmUG08T2YOkT0xB1v4E1Hy8pDK37n0w"
        }
      }
    ]
  },
  "metadata": null
}

Closes #20

@KendallWeihe
Copy link
Contributor Author

KendallWeihe commented Feb 21, 2024

Didn't want this PR to get too beefy so created the following follow-up items

Edit: also added this one

@alecthomas
Copy link
Contributor

Looks great to me!

@mistermoe
Copy link
Contributor

awesome start @KendallWeihe

@KendallWeihe KendallWeihe merged commit ff722cc into main Feb 21, 2024
3 checks passed
@KendallWeihe KendallWeihe deleted the kendallw/cmd-did-create branch February 27, 2024 13:35
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.

Include cmd to create a DID
3 participants