TBD54566975 / web5-go

Apache License 2.0
7 stars 6 forks source link

Add DID resolve to web5 cmd #77

Closed KendallWeihe closed 4 months ago

KendallWeihe commented 4 months ago

Closes https://github.com/TBD54566975/web5-go/issues/70


Usage

web5 did resolve <uri>

For example, run web5 did:jwk create, and use the uri from the output as the input to the resolve command

Commentary

I think I may redo the DX for the did:jwk and did:web to be web5 did create <method> <additional args> ... @mistermoe thoughts? My driving reason is to try and match the namespacing in our various web SDKs (specifically looking at web5-js as the most mature among them)

I want to be able to resolve a DID with just the URI, so I would want the create commands to be consistent with this DX as well

alecthomas commented 4 months ago

Add to cmd/web5/README.md?

Also, I didn't realize we're building a CLI. Why are we now creating a web5 CLI even though we weren't considering that AFAIK when we built other implementations?

I'm not sure of the intent, but Go is almost ideal for writing redistributable CLIs as it generates statically linked completely self-contained executables, so if we want a single CLI then this makes sense vs. being in another language. Rust would also be a good choice for the same reasons.

mistermoe commented 4 months ago

Add to cmd/web5/README.md?

Also, I didn't realize we're building a CLI. Why are we now creating a web5 CLI even though we weren't considering that AFAIK when we built other implementations?

@diehuxx it wasn't something that we necessarily deliberated. Happened a bit organically. 2 primary reasons.

  1. Did creation for PFIs will happen typically once. Having to write a throwaway script to do this feels unnecessary. Have run into this with 2 partners and for our own PFI. Figured a cli might make this easier
  2. I find myself needing to resolve DIDs for debugging purposes quite often using our own resolvers. Would be nice to use a command to do so

Further I imagine being able to use a cli for updating / managing a did in general will be helpful. Especially given that it'll be able to use aws KMS quite easily

mistermoe commented 4 months ago

Re: question in description

Makes sense @KendallWeihe was actually thinking the same thing re: args

ideally we can surface method specific command line options & args based on the options we've surfaced at the sdk level

alecthomas commented 4 months ago

A bit tangential, but I can highly recommend goreleaser for building and releasing Go binaries. It will automatically build and upload to GH releases. FTL uses it, for example.

KendallWeihe commented 4 months ago

Add to cmd/web5/README.md?

Done, thanks! Though that README is kinda bleh, not sure what would be ideal there, but a problem for later.

KendallWeihe commented 4 months ago

Something very strange is going on. Tests are failing on this branch; the TestVerifySECP256K1 test is failing with an error failed to parse public key: malformed public key: invalid length: 64. I tried re-running the workflow, but it failed again. Tests from the prior commit are passing, but all that was changed in the most recent commit was a README. Tests are passing locally. I branched off of this branch and reran the tests in the GitHub Pipeline and the tests passed.

I suspect we have some weird cryptographic issue going on where something to do with this particular commit, and the random generation made available in our GitHub Pipelines.

Going to merge this in and open a ticket.

KendallWeihe commented 4 months ago

surface method specific command line options & args based on the options we've surfaced at the sdk level

totally agree https://github.com/TBD54566975/web5-go/issues/85