-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bring your own principal (#672)
This is web3-storage/w3up-client#74 ported here. --- This PR allows passing your own principal to the client `create` factory function instead of loading one from a pre-existing store. The caveat is that if you pass your own and the store is not empty then it needs to match the principal that was loaded from the store (otherwise any saved delegations will be unusable). This makes https://gist.github.com/alanshaw/e949abfcf6728f590ac9fa083dba5648#on-the-server a little easier, you won't need to install `@web3-storage/access` or deal with the `AgentData` class. Currently: ```js import * as Signer from '@ucanto/principal/ed25519' import { AgentData } from '@web3-storage/access/agent' import { Client } from '@web3-storage/w3up-client' const principal = Signer.parse(process.env.KEY) const data = await AgentData.create({ principal }) const client = new Client(data) ``` After this PR: ```js import * as Signer from '@ucanto/principal/ed25519' import * as Client from '@web3-storage/w3up-client' const principal = Signer.parse(process.env.KEY) const client = await Client.create({ principal }) ```
- Loading branch information
Alan Shaw
authored
Mar 29, 2023
1 parent
a16f412
commit 4586df2
Showing
3 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters