Repository navigation
Description
Problem
The TypeScript (@decdn/client) and Python (decdn) SDKs are clients of the decdn gateway HTTP contract. They need a local decdn binary running beside the app, and they can only do what that contract exposes. An app that ships to end users cannot assume either.
The Android and iOS demos embed decdn-client directly and get the real client: discovery, paid pulls, verification, resume. But each writes its own JNI or C ABI layer and its own key and capability handling: make and store a key, map "this capability cannot pay for the rest" (FUNDING) to "new key, new capability", keep both so an interrupted pull resumes. Every app that embeds the client repeats that.
Proposal
- The core owns the delegated-key lifecycle.
decdn-clientgains one entry point for a sponsored pull:- it makes and stores the throwaway key in a data dir the app gives it;
- it asks the app for a capability through one callback: "get a
dcap1:token for this address" (the app calls its own backend); - on a funding refusal it makes a new key and asks again, within the existing funding-recovery rules;
- it keeps the key, the capability and the partial store, so a re-run resumes;
- progress and cancellation as the demos use them today.
- Generated bindings over that API, shipped per language:
- Kotlin (Android) and Swift (iOS);
- Python;
- Node (native module).
- The HTTP-contract SDKs are replaced, not kept beside the bindings.
@decdn/clientand thedecdnPyPI package become the bindings. TheSDK contractworkflow (anvil-e2e-sdk,anvil-e2e-sdk-python),.github/sdk-typescript.sha,.github/sdk-python.shaand the fake gateways go. Each binding gets a smoke test against anvil instead. decdn gatewaystays a CLI feature for the browser extension and local tools. It is not part of any SDK.- The demos move onto the shipped Kotlin and Swift packages and drop their hand-written JNI / C ABI layers.
Browser JS is out of scope: iroh's QUIC needs relay-only transport in a browser, and that needs its own spike.
Open questions
- Binding generator: UniFFI for Kotlin, Swift and Python, with napi for Node; or pyo3 for Python.
- Where bindings live: in this repo (one release, one version) or one repo per language.
- Mobile packaging: Maven Central / SwiftPM targets, and the build that produces them (the demos'
build.shand the iOSlibcpin are the starting point). - Footprint: the mobile builds today pull in
aws-lc(see the android-demo follow-up); the bindings should link ring only, like the CLI.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsBacklog
Activity