-
Notifications
You must be signed in to change notification settings - Fork 7
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: add local ipfs pinning service api adaptor #69
base: main
Are you sure you want to change the base?
Conversation
Adds `w3 ps` command to run an http server on localhost to allow you to use the IPFS pinning service api with w3up and get ucan auth in pinning service mode. ```sh $ w3 ps ⁂ IPFS Pinning Service on http://127.0.0.1:1337 $ ipfs pin remote service add w3 'http://127.0.0.1:1337' 'did:key:z6MkvqaczHouddZ91gWNsuy2QFm419WFodXbVjBJykvzw1eK' $ ipfs pin remote add --service w3 <cid> ``` License: MIT Signed-off-by: Oli Evans <[email protected]>
const pinCache = new Map() | ||
const client = await getClient() | ||
const whoami = client.agent().did() | ||
const token = key ?? whoami |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The http api bound to loopback ip, so token auth is less critical, but kubo requires the user to provide a key when setting up a pin service remote.
@alanshaw suggested setting this as the space DID that we want the local pin service to write to, which would be rad, but we also need changes to the w3up-client to allow users to pass in a space did (with
) when doing an upload. The upload client supports it but it's not exposed in w3up-client
pin.js
Outdated
const rootCID = CID.parse(cid) | ||
const ipfsUrl = new URL(`/ipfs/${cid}?format=car`, ipfsGatewayUrl, { signal }) | ||
const res = await fetch(ipfsUrl) | ||
const storedCID = await client.uploadCAR({ stream: () => res.body }, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should tweak the w3up-client uploadCAR
to allow users to pass a stream, as currently it requires a blob but just calls stream on it, and it means we can't pass a stream directly, and need this madness.
License: MIT Signed-off-by: Oli Evans <[email protected]>
License: MIT Signed-off-by: Oli Evans <[email protected]>
POC based on https://hackmd.io/@olizilla/beam
Adds
w3 ps
command to run an http server on localhost to allow you to use the IPFS pinning service api with w3up and get ucan auth in pinning service mode.License: MIT