From 90affdd4d9e87f4a82ed69e50ea7328ea2f821b4 Mon Sep 17 00:00:00 2001 From: hzrd149 <8001706+hzrd149@users.noreply.github.com> Date: Wed, 30 Jul 2025 12:55:58 -0500 Subject: [PATCH] Update to use cashu NUT-24 --- buds/07.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/buds/07.md b/buds/07.md index f996045..af8e278 100644 --- a/buds/07.md +++ b/buds/07.md @@ -10,12 +10,15 @@ Payment requirements for blob storage. ## Payment Required -Some servers MAY require payment for file storage. In such cases, these endpoints MUST return a **402 Payment Required** status code: +Some servers MAY require payment for uploads, downloads, or any other endpoint. In such cases, these endpoints MUST return a **402 Payment Required** status code. -- [HEAD /upload](./01.md#head-sha256---has-blob) (Optional, if [BUD-06](./06.md) is implemented) -- [PUT /upload](./02.md#put-upload---upload-blob) -- [HEAD /](./01.md#head-sha256---has-blob) -- [GET /](./01.md#get-sha256---get-blob) +Some endpoints a server may require payment for: + +- [`HEAD /upload`](./06.md) to signal that payment is required for the `PUT` request ( if [BUD-06](./06.md) is supported ) +- [`PUT /upload`](./02.md#put-upload---upload-blob) to require payment for uploads +- [`HEAD /`](./01.md#head-sha256---has-blob) to signal that payment is required for the `GET` request +- [`GET /`](./01.md#get-sha256---get-blob) to require payment for downloads ( maybe charge by MB downloaded? ) +- [`HEAD /media`](./05.md) and [`PUT /upload`](./05.md) to require payment for media optimizations ( if [BUD-06](./06.md) is supported ) When payment is required, the server MUST include one or more `X-{payment_method}` header(s), each corresponding to a supported payment method. @@ -25,7 +28,7 @@ The 402 status code and `X-{payment_method}` header is used by the server to inf Supported payment methods: -- `X-Cashu`: Payment details for the cashu payment method, adhering to the [NUT-18](https://github.com/cashubtc/nuts/blob/main/18.md) standard. +- `X-Cashu`: Payment details for the cashu payment method, adhering to the [NUT-24](https://github.com/cashubtc/nuts/blob/main/24.md) standard. - `X-Lightning`: Payment details for the lightning payment method, adhering to the [BOLT-11](https://github.com/lightning/bolts/blob/master/11-payment-encoding.md) standard. If a server supports multiple payment methods, it MAY send multiple `X-{payment_method}` headers in the same response. @@ -39,7 +42,7 @@ X-{payment_method}: "" ### `X-Cashu` Header -When using the X-Cashu header, the server MUST adhere to the [NUT-23](https://github.com/cashubtc/nuts/pull/239) standard. +When using the X-Cashu header, the server MUST adhere to the [NUT-24](https://github.com/cashubtc/nuts/blob/main/24.md) standard. Example for cashu: @@ -64,7 +67,7 @@ Clients MUST parse and validate the `X-{payment_method}` header received from th The client MUST provide the payment proof when re-trying the request using the same `X-{payment_method}` header that was chosen. The payment proof MUST align with the payment method specification: -- For cashu the payment proof should be a serialized cashu token according to [NUT-00](https://github.com/cashubtc/nuts/blob/main/00.md#v4-tokens). +- For cashu the payment proof should be a serialized `cashuB` token in the `X-Cashu` header according to [NUT-24](https://github.com/cashubtc/nuts/blob/main/24.md#client-payment). - For lightning the payment proof should be the preimage of the payment request according to [BOLT-11](https://github.com/lightning/bolts/blob/master/11-payment-encoding.md). Schema: @@ -82,7 +85,7 @@ X-Cashu: cashuBo2F0gqJhaUgA_9SLj17PgGFwgaNhYQFhc3hAYWNjMTI0MzVlN2I4NDg0YzNjZjE4N Example for Lightning: ```http -X-Lightning: "966fcb8f153339372f9a187f725384ff4ceae0047c25b9ce607488d7c7e93bba" +X-Lightning: 966fcb8f153339372f9a187f725384ff4ceae0047c25b9ce607488d7c7e93bba ``` **Special Note on HEAD Requests** @@ -99,4 +102,4 @@ To support future payment methods (e.g., other Layer 2 solutions), the specifica New methods MUST use a unique `X-{payment_method}` header containing the specific payment details. -New methods MUST adhere their own specification, which MUST be publicly available and linked in the header. \ No newline at end of file +New methods MUST adhere their own specification, which MUST be publicly available and linked in the header.