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

feat: use w3 key create instead of ucan-key ed #70

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/pages/docs/concepts/architecture-options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ w3up-client in backend-\>\>web3.storage w3up service: Upload data
You'll need a registered Space, and your client in the backend to have a delegation to use the Space.

<Callout>
**Recommended**: It's easiest to create and register your Space using [w3cli](https://github.com/web3-storage/w3cli), then create an identity for your server and delegate it the ability to upload to your Space. [This example](https://github.com/web3-storage/w3up/tree/main/packages/w3up-client#bringing-your-own-agent-and-delegation) shows how to load an identity and a delegation into the client on the server.
**Recommended**: It's easiest to create and register your Space using [w3cli](https://github.com/web3-storage/w3cli), then create an identity for your server and delegate it the ability to upload to your Space. The [bring your own delegations](/docs/how-to/upload/#bring-your-own-delegations) section shows how to generate an identity, create a delegation and then use it on the server.
</Callout>

After this, once your user uploads data to your backend, you can run any of the upload methods.
Expand Down Expand Up @@ -53,7 +53,7 @@ Typically `w3up-client` will be running in your end-user's client code, as well
You'll need a registered Space, and your client in the backend to have a delegation to use the Space.

<Callout>
**Recommended**: It's easiest to create and register your Space using [w3cli](https://github.com/web3-storage/w3cli), then create an identity for your server and delegate it the ability to upload to your Space. [This example](https://github.com/web3-storage/w3up/tree/main/packages/w3up-client#bringing-your-own-agent-and-delegation) shows how to load an identity and a delegation into the client on the server.
**Recommended**: It's easiest to create and register your Space using [w3cli](https://github.com/web3-storage/w3cli), then create an identity for your server and delegate it the ability to upload to your Space. The [bring your own delegations](/docs/how-to/upload/#bring-your-own-delegations) section shows how to generate an identity, create a delegation and then use it on the server.
</Callout>

Your backend code can then re-delegate it's capabilities to your users. Your user does not need a registered Space - just an Agent with a delegation from your Space.
Expand Down
22 changes: 16 additions & 6 deletions src/pages/docs/go-w3up.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,19 @@ go get github.com/web3.storage/go-ucanto

## Generate a DID

You can use `ucan-key` to generate a private key and DID for use with the library. Install Node.js and then use the `ucan-key` module:
Currently the best way to generate a DID is to use the w3up JS CLI:

<Steps>
### Install w3 CLI

```sh
npm install -g @web3-storage/w3cli
```

### Generate a DID

```sh
npx ucan-key ed
w3 key create
Comment on lines +33 to +45
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe leave this as ucan-key as it has fewer dependencies?

Or for the sake of go devs patience, they will still be able to use npx like npx @web3-storage/w3cli key create, as key create doesn't need any existing client state.

Copy link
Contributor

Choose a reason for hiding this comment

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

can confirm... npx still works

$ npx @web3-storage/w3cli key create
# did:key:z6Mkuu8gnJEe5uWPtExfwPcC8xvJQr23AmXArmqKXwBYGCEV
MgCZa59TQQ+xTk2ko+Sn+oZZ3ir9bmD6gZ5s09ubqk9I3bO0B5YAVloPr3OhRk9qSEMgV1sHaQFz6mCTeJeYrJkWxL6I=

```

Output should look something like:
Expand All @@ -42,6 +51,7 @@ Output should look something like:
# did:key:z6Mkh9TtUbFJcUHhMmS9dEbqpBbHPbL9oxg1zziWn1CYCNZ2
MgCb+bRGl02JqlWMPUxCyntxlYj0T/zLtR2tn8LFvw6+Yke0BKAP/OUu2tXpd+tniEoOzB3pxqxHZpRhrZl1UYUeraT0=
```
</Steps>

<Callout>
Save the private key (starting `Mg...`) to a file `private.key`.
Expand All @@ -52,16 +62,16 @@ MgCb+bRGl02JqlWMPUxCyntxlYj0T/zLtR2tn8LFvw6+Yke0BKAP/OUu2tXpd+tniEoOzB3pxqxHZpRh
Proofs are delegations to your DID enabling it to perform tasks. Currently the best way to obtain proofs that will allow you to interact with the web3.storage API is to use the w3up JS CLI:

<Steps>
### Generate a DID

[Generate a DID](#generate-a-did) and make a note of it (the string starting with `did:key:...`)

### Install w3 CLI

```sh
npm install -g @web3-storage/w3cli
```

### Generate a DID

[Generate a DID](#generate-a-did) and make a note of it (the string starting with `did:key:...`)

### Create a space

```sh
Expand Down
2 changes: 1 addition & 1 deletion src/pages/docs/how-to/upload.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ In your command line where `w3cli` is configured with the Space you want to use

```shell
# The following command returns what will be your Agent private key and DID
npx ucan-key ed
w3 key create

# ❗️ Store the private key (starting "Mg...") in environment variable KEY

Expand Down
Loading