Files
bitvid/scripts/vendor/cashu-stub.mjs
T
thePR0M3TH3ANandClaude Opus 4.8 02e60f1842 feat(storage): Blossom Phase 0 — flag + vendored SDK + service skeleton (#30)
Phase 0 of docs/blossom-plan.md. No UX; off-by-default ("off = no trace").

- Vendored: pinned [email protected] bundled by scripts/build-blossom-sdk.mjs
  → vendor/blossom-client-sdk.bundle.min.js (esbuild, browser ESM, ~27KB). The
  optional @cashu/cashu-ts peer dep (BUD-07 payments, only reached on a lazy 402
  branch bitvid never hits) is aliased to a throwing stub. `npm run build:blossom-sdk`.
- Flag: FEATURE_BLOSSOM_STORAGE wired like FEATURE_AUDIO_INGEST / _BITCOIN_CONNECT
  (instance-config → config → constants), default FALSE.
- Service: js/services/blossomService.js implements the same
  uploadFile({…}) → {url,key} contract as s3UploadService (so a later
  isBlossomProvider branch drops into mediaUploader). Lazy-loads the SDK; core
  path = createUploadAuth(signer, sha256) + multiServerUpload (BUD-11 auth via
  bitvid's existing signer, BUD-04 mirror). Torrent parity + result-shape mapping +
  mediaUploader wiring + Storage-pane config land in Phase 1.

Tests: tests/blossom-service.test.mjs (5 — availability gate + input guards).
Lint + build clean. Nothing wired into the app yet.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-09 15:42:19 -04:00

17 lines
694 B
JavaScript

// Stub for the optional @cashu/cashu-ts peer dep, aliased in when bundling
// blossom-client-sdk (scripts/build-blossom-sdk.mjs). The SDK only reaches for it
// on the BUD-07 cashu-payment branch (a lazy `await import()` triggered by an HTTP
// 402). bitvid targets free Blossom servers, so this never runs; the stubs throw
// loudly if a payment-gated server is ever hit rather than silently misbehaving.
function unsupported() {
throw new Error(
"Cashu payments (BUD-07) are not supported in the bitvid Blossom bundle",
);
}
export const getEncodedToken = unsupported;
export const decodePaymentRequest = unsupported;
export const getDecodedToken = unsupported;
export default {};