Skip to content

Commit

Permalink
add error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Dec 4, 2024
1 parent b7152f5 commit cccbb1d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
3 changes: 1 addition & 2 deletions 04.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ Where `quote` is the quote ID and `request` is the payment request to fulfill. `
- `"PAID"` means that the request has been paid.
- `"ISSUED"` means that the quote has already been issued.

> [!CAUTION]
> `quote` is a **unique and random** id generated by the mint to internally look up the payment state. `quote` **MUST** remain a secret between user and mint and **MUST NOT** be derivable from the payment request. A third party who knows the `quote` ID can front-run and steal the tokens that this operation mints.
> [!CAUTION] > `quote` is a **unique and random** id generated by the mint to internally look up the payment state. `quote` **MUST** remain a secret between user and mint and **MUST NOT** be derivable from the payment request. A third party who knows the `quote` ID can front-run and steal the tokens that this operation mints.
## Example

Expand Down
9 changes: 7 additions & 2 deletions 20.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

This NUT defines signature-based authentication for mint quote redemption. When requesting a mint quote, clients provide a public key. The mint will then require a valid signature from the corresponding secret key to process the mint operation.

> [!CAUTION]
> [NUT-04][04] mint quotes without a public key can be minted by anyone who knows the mint quote id without providing a signature.
> [!CAUTION] > [NUT-04][04] mint quotes without a public key can be minted by anyone who knows the mint quote id without providing a signature.
## Mint quote

Expand Down Expand Up @@ -163,6 +162,11 @@ Response of `Bob`:

If the wallet user `Alice` does not include a signature on the `PostMintBolt11Request` but did include a `pubkey` in the `PostMintBolt11QuoteRequest` then `Bob` **MUST** respond with an error. `Alice` **CAN** repeat the request with a valid signature.

See [Error Codes][errors]:

- `20008`: Mint quote with `pubkey` but no valid `signature` provided for mint request.
- `20009`: Mint quote requires `pubkey` but none given or invalid `pubkey`.

## Settings

The settings for this NUT indicate the support for requiring a signature before minting. They are part of the info response of the mint ([NUT-06][06]) which in this case reads
Expand All @@ -178,3 +182,4 @@ The settings for this NUT indicate the support for requiring a signature before
[00]: 00.md
[04]: 04.md
[06]: 06.md
[errors]: error_codes.md
36 changes: 18 additions & 18 deletions error_codes.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# NUT Errors

| Code | Description | Relevant nuts |
| ----- | ----------------------------------------------- | ---------------------------------------- |
| 10002 | Blinded message of output already signed | [NUT-03][03], [NUT-04][04], [NUT-05][05] |
| 10003 | Token could not be verified | [NUT-03][03], [NUT-05][05] |
| 11001 | Token is already spent | [NUT-03][03], [NUT-05][05] |
| 11002 | Transaction is not balanced (inputs != outputs) | [NUT-02][02], [NUT-03][03], [NUT-05][05] |
| 11005 | Unit in request is not supported | [NUT-04][04], [NUT-05][05] |
| 11006 | Amount outside of limit range | [NUT-04][04], [NUT-05][05] |
| 12001 | Keyset is not known | [NUT-02][02], [NUT-04][04] |
| 12002 | Keyset is inactive, cannot sign messages | [NUT-02][02], [NUT-03][03], [NUT-04][04] |
| 20001 | Quote request is not paid | [NUT-04][04] |
| 20002 | Tokens have already been issued for quote | [NUT-04][04] |
| 20003 | Minting is disabled | [NUT-04][04] |
| 20005 | Quote is pending | [NUT-04][04], [NUT-05][05] |
| 20006 | Invoice already paid | [NUT-05][05] |
| 20007 | Quote is expired | [NUT-04][04], [NUT-05][05] |
| 20008 | Witness on mint request not provided or invalid | [NUT-19][19] |
| 20009 | Pubkey required on mint quote | [NUT-19][19] |
| Code | Description | Relevant nuts |
| ----- | ------------------------------------------------- | ---------------------------------------- |
| 10002 | Blinded message of output already signed | [NUT-03][03], [NUT-04][04], [NUT-05][05] |
| 10003 | Token could not be verified | [NUT-03][03], [NUT-05][05] |
| 11001 | Token is already spent | [NUT-03][03], [NUT-05][05] |
| 11002 | Transaction is not balanced (inputs != outputs) | [NUT-02][02], [NUT-03][03], [NUT-05][05] |
| 11005 | Unit in request is not supported | [NUT-04][04], [NUT-05][05] |
| 11006 | Amount outside of limit range | [NUT-04][04], [NUT-05][05] |
| 12001 | Keyset is not known | [NUT-02][02], [NUT-04][04] |
| 12002 | Keyset is inactive, cannot sign messages | [NUT-02][02], [NUT-03][03], [NUT-04][04] |
| 20001 | Quote request is not paid | [NUT-04][04] |
| 20002 | Tokens have already been issued for quote | [NUT-04][04] |
| 20003 | Minting is disabled | [NUT-04][04] |
| 20005 | Quote is pending | [NUT-04][04], [NUT-05][05] |
| 20006 | Invoice already paid | [NUT-05][05] |
| 20007 | Quote is expired | [NUT-04][04], [NUT-05][05] |
| 20008 | Signature on mint request not provided or invalid | [NUT-19][19] |
| 20009 | Pubkey required on mint quote | [NUT-19][19] |

[00]: 00.md
[01]: 01.md
Expand Down

0 comments on commit cccbb1d

Please sign in to comment.