Skip to content

Commit afd8cba

Browse files
authored
docs: Update README.md
1 parent 6b67289 commit afd8cba

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Upload files to [web3.storage](https://web3.storage) from a Github Action, and output the IPFS Content ID.
44

5-
A lightweight wrapper around [w3cli](https://github.com/web3-storage/w3cli). As a [composite](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action) github action all it does is configure and call the cli for you. See the steps in [./action.yml](./action.yml).
5+
A lightweight wrapper around [w3cli]. As a [composite](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action) github action all it does is configure and call the cli for you. See the steps in [./action.yml](./action.yml).
66

77
## Usage
88

@@ -22,31 +22,39 @@ with:
2222
- run: echo ${{ steps.w3up.outputs.url }}
2323
```
2424
25-
Use [w3cli] to generate a `secret_key` and `proof` to allow this action to upload to a space on.
25+
### Generating a `secret_key` and `proof`
2626

27-
Install it from npm and login as described here https://web3.storage/docs/quickstart/ then:
27+
On your dev machine, use [w3cli] to generate a `secret_key` and `proof` to allow this action to upload to a space on.
28+
29+
Install it from npm and login as described here https://web3.storage/docs/quickstart/ then create a key like this:
2830

2931
```shell
30-
# create a signing key for CI.
3132
# Use the `did` in the input to the next command.
3233
# Use `key` as your `secret_key` for add_to_web3.
3334
$ w3 key create --json
3435
{
3536
"did": "did:key:z6Mk...",
3637
"key": "MgCaT7Se2QX9..."
3738
}
39+
```
40+
41+
Keep the `key` safe. Save it as a secret on your repo.
3842

39-
# create a base64 encoded UCAN `proof`
40-
# It delegates store and upload permissions to the `did` we created above.
43+
Copy the `did` for use in the next command. The output is a base64 encoded ucan `proof` that delegates capabilities to `store/add` and `upload/add` on your current space to the key generated above.
44+
45+
```shell
46+
# Delegate capabilities to the `did` we created above.
4147
$ w3 delegation create did:key:z6Mk... -c 'store/add' -c 'upload/add' --base64
4248
mAYIEAP8OEaJlcm9vdHOAZ3ZlcnNpb24BwwUBcRIg+oHTbzShh1WzBo9ISkonCW+KAcy/+zW8Zb...
4349
```
4450

45-
- Use the `key` value from the output of `w3 key create --json` as the `secret_key` for this action.
46-
- Use the `did value from that command as the audience for `w3 delegation create <audience>` shown above.
47-
- Use the output of `w3 delegation create <audience>` as the `proof` for this action.
51+
The capabilies `store/add` and `upload/add` are the minimum required to upload files to web3.storage. This proof will not allow that key to list uploads in this space for example.
52+
53+
To recap:
4854

49-
Keep the `secret_key` safe. Save it as a secret on your repo. The `proof` delegates permission from your account to that key to upload to your space. The `proof` can only be used by an agent that holds the `secret_key`.
55+
- Use the `key` value from the output of `w3 key create --json` as the `secret_key` for this action.
56+
- Use the `did value from that output as the audience for `w3 delegation create <audience>` shown above.
57+
- Use the output of `w3 delegation create <audience> --base64` as the `proof` for this action.
5058

5159
## Inputs
5260

@@ -109,3 +117,5 @@ e.g. `https://dweb.link/ipfs/bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbaugul
109117
💌 Considerate contributions welcome!
110118

111119
<h3 align="center"><a href="https://web3.storage"></a></h3>
120+
121+
[w3cli]: https://github.com/web3-storage/w3cli

0 commit comments

Comments
 (0)