livepeer / livepeer/studio

Support CID playback URL lookup for assets with IPFS gateway URL

Open
#1,575 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
88
Forks
37
PR merge metrics
No merged PRs in 30d

Description

**What's the problem? (required)** Describe the problem or need in exactly 1
sentence. Ex. "I'm unable to [...]", or "I am confused by [...]"

If I upload an asset with an IPFS gateway URL, I cannot lookup the playback URL of the asset using a CID.

**What's the current behavior? (required)** A clear and concise description of
the current behavior of the DApp or package (or lack thereof).

If I upload an asset with the URL `ipfs://`, then I can lookup the playback URL using a call to `/playback/` because the API will lookup the playback URL for the asset with the upload URL `ipfs://` in this [function](https://github.com/livepeer/studio/blob/919536ffd76df4b6f81d8040e65e934284cbef28/packages/api/src/controllers/playback.ts#L44).

If I upload an asset with the URL `https://ipfs.io/ipfs/`, then I can *not* lookup the playback URL using a call to `/playback/` because the API will not find this asset with the upload URL `ipfs://` since the upload URL will be `https://ipfs.io/ipfs/`.

**Do you have any personal experiences dealing with this problem? (optional)**
Describe your personal experiences related this problem in 1-4 sentences.

The current design looks up playback URLs using `ipfs://` because CID playback URL lookup is only supported for assets with the upload URL of `ipfs://`. And the original reason for this was to have the API/Catalyst be responsible for downloading the file using a trusted gateway to ensure that the file matches the CID - we wanted to avoid someone uploading with a URL with a CID, but the file downloaded does not match the CID.

**Describe a possible solution you've considered (optional)** A clear and
concise description of what you want to happen.

We might be able to detect CIDs/IPFS gateway URLs (see [example](https://github.com/livepeer/livepeer.js/blob/9ce1fa460985d4301c06df88698e7e3e746c4d52/packages/core/src/utils/storage/ipfs.ts#L20) and use CAR retrieval to [trustlessly download a file with a CID from a gateway](https://docs.ipfs.tech/reference/http/gateway/#trusted-vs-trustless). Perhaps this goes into Catalyst though?

An up-to-date gateway should support CAR responses, but we might need to have a fallback path in case the gateway used does not support CAR responses.

**Additional context (optional)** Add any other context or screenshots about the
enhancement or feature request here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the lookup in packages/api/src/controllers/playback.ts and compare the IPFS URL detection example in livepeer.js. Investigate trusted CAR retrieval and the possible gateway fallback described in the issue; done means /playback/ resolves assets uploaded with an IPFS gateway URL while preserving CID verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.