feat(sdk): sign preview generation requests - #14552
Open
rickyrombo wants to merge 1 commit into
Open
Conversation
🦋 Changeset detectedLatest commit: 7c6f6d9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
generatePreview asks a storage node to produce new bytes from a cid, and the node now attests the resulting cid on chain so it can be named as a track's preview. It will only do that for a user who already owns the source audio, so the request has to say who is asking. Reuses the upload request signature rather than inventing a second scheme, so both audio paths recover a signer the same way. Unsigned when there is no wallet or no user id, matching how uploadFile behaves: nodes accept those where content authorization is not yet enforced, and the preview simply never earns a claim. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
rickyrombo
force-pushed
the
feat/signed-preview-generation
branch
from
August 8, 2026 07:10
033a340 to
7c6f6d9
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #14550. Review that first — this branch contains only the commit on top of it.
Why previews need signing
generatePreviewasks a storage node to slice new bytes out of a cid. The node attests the resulting cid on chain so it can be named as a track'spreview_cid— and it will only do that for a user who already claims the source audio. So the request has to say who is asking.Without that check the endpoint is a gating bypass. Previews stream publicly, and they are 30 seconds long, so an attacker could generate previews of a gated track at offsets 0/30/60/…, name each on a throwaway track of their own, and reassemble the full 320. Requiring a signature and refusing unless the caller owns the source kills that at the door.
What changed
generatePreviewtakes an optionaluserIdand, when a wallet is configured, signs withsignUploadfrom #14550 — the same EIP-712 payload audio uploads use, passed assignature/userId/timestampquery parameters. Reusing it rather than inventing a second scheme means both audio paths recover a signer through one code path on the node side too.Both call sites in
TracksApipass the acting user: theuploadTrackfallback that generates a preview when the upload did not, andupdateTrackwithgeneratePreview: true. The second is the one that matters most — it has no audio upload at all, so this endpoint is its only route to a preview cid.Unsigned still works
No wallet or no user id sends the request unsigned, matching
uploadFile. Nodes accept those where content authorization is not enforced; the preview just never earns a claim, so it cannot be named on a track once enforcement is on. That makes this safe to land ahead of the gate but means it has to ship before the gate opens.Testing
Typechecks clean. The SDK's vitest suites do not run in my environment —
StorageNodeSelector.test.tsandsignUpload.test.tsboth fail at collection withTypeError: Object.defineProperty called on non-object, and they fail identically on a clean tree with none of these changes, so it is environmental rather than caused by this branch. These changes have not been exercised by a running test.🤖 Generated with Claude Code