aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/analytics.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-07-10 21:46:40 -0700
committerAdam Soltys <[email protected]>2026-07-10 21:46:40 -0700
commitd466aab4451a89b2d69a2618f0a739b2e89903c5 (patch)
tree083502eec7f32d3b142f92ee40d94528a0edaf55 /scripts/analytics.ts
parentc5bcf51d6adb1c7718f08ff11a9652762c51669d (diff)
downloadcoinos-server-d466aab4451a89b2d69a2618f0a739b2e89903c5.tar.gz
coinos-server-d466aab4451a89b2d69a2618f0a739b2e89903c5.zip
invoices: sell merchant-supplied preimages via a usePreimage queue
Merchants POST /preimages (auth) to pre-load 32-byte hex preimages into a FIFO queue; creating an invoice with usePreimage: true consumes the next one so the invoice's payment hash is sha256(preimage). Paying the invoice reveals the merchant-chosen secret to the buyer — via their own wallet on external settlements, and via GET /invoice/:id once settled — enabling backend-less digital download stores (encrypted files on static hosting, preimage + public string = decryption key). - GET /preimages lists the queue with payment hashes so the merchant can map files to future invoices; POST /preimages/delete clears it - empty queue fails invoice creation rather than issuing a random preimage the buyer would pay for but couldn't decrypt with - preimages cln rejects as already used are discarded and the next tried - consumed preimages persist at preimage:${payment_hash} (TTL = invoice expiry) and credit() prefers them as the settlement ref, so internal coinos-to-coinos payments reveal the real preimage instead of the sender's uid Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'scripts/analytics.ts')
0 files changed, 0 insertions, 0 deletions