Skip to content

Commit 60e46b3

Browse files
Merge pull request #46 from storacha/fix/http-bridge-code-sample
fix: code samples in http bridge doc Reported by user, updated per user's feedback
2 parents cf5ee4d + 034d07f commit 60e46b3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/pages/how-to/http-bridge.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,19 @@ w3 space ls
5555
And use the `bridge generate-tokens` command to generate header values:
5656

5757
```sh
58-
w3 bridge generate-tokens did:key:z6Mkabc123 --can 'store/add' --can 'upload/add' --can 'upload/list' --expiration `date -v +24H +%s`
58+
w3 bridge generate-tokens did:key:z6Mkabc123 --can 'store/add' --can 'upload/add' --can 'upload/list' --expiration $(date -v +24H +%s)
5959
```
6060

6161
The example command above uses the `--expiration` option to specify that these headers will be
6262
valid for 24 hours. It uses the `--can` options to specify that the headers can be used to invoke
6363
`store/add`, `upload/add` or `upload/list` capabilities.
6464

65+
If using Windows, replace single quote with double quotes. Also, replace the time to a unix format. Please reference this code sample made for Windows instead:
66+
```sh
67+
w3 bridge generate-tokens did:key:z6Mkabc123 --can "store/add" --can "upload/add" --can "upload/list" --expiration $((Get-Date).AddHours(24).ToUniversalTime() -UFormat %s)
68+
```
69+
PowerShell does not handle date arithmetic well. The best alternative is to manually calculate and pass the expiration timestamp if running into an issue.
70+
6571
The result of `w3 bridge generate-tokens` will contain the values of the `X-Auth-Secret` and `Authorization` headers:
6672

6773
```txt

0 commit comments

Comments
 (0)