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: update "bring your own delegations" example #72

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion src/pages/docs/how-to/upload.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,17 @@ w3 delegation create <did_from_ucan-key_command_above> | base64
Then, when you initialize and configure the client, you can pass in this Agent and UCAN.

```javascript
import { StoreMemory } from '@web3-storage/access/stores/store-memory'
import * as Client from '@web3-storage/w3up-client'
import { importDAG } from '@ucanto/core/delegation'
import { CarReader } from '@ipld/car'
import * as Signer from '@ucanto/principal/ed25519'

async function main () {
// Load client with specific private key
const principal = Signer.parse(process.env.KEY)
const client = await Client.create({ principal })
const store = new StoreMemory()
const client = await Client.create({ principal, store })
// Add proof that this agent has been delegated capabilities on the space
const proof = await parseProof(process.env.PROOF)
const space = await client.addSpace(proof)
Expand Down
Loading