TBD54566975 / web5-go

Apache License 2.0
7 stars 6 forks source link

Add web5 CLI for DID creation #63

Closed KendallWeihe closed 4 months ago

KendallWeihe commented 4 months ago

Summary

This PR proposes the introduction of a web5 CLI tool. Originally prompted by https://github.com/TBD54566975/web5-go/issues/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.

Supported commands

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 https://github.com/TBD54566975/web5-go/issues/20

KendallWeihe commented 4 months ago

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

Edit: also added this one

alecthomas commented 4 months ago

Looks great to me!

mistermoe commented 4 months ago

awesome start @KendallWeihe