-
Notifications
You must be signed in to change notification settings - Fork 87
Update NUT-29 signature message to include mint pubkey and timestamp #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
a1denvalu3
wants to merge
3
commits into
cashubtc:get-quotes-by-pubkeys
from
a1denvalu3:update-sig-nut-29
Closed
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # NUT-29 Test Vectors | ||
|
|
||
| ## Request Signature Validation | ||
|
|
||
| The following test vectors can be used to verify the signature required for the `POST /v1/mint/quote/{method}/pubkey` request. | ||
|
|
||
| The user generates a private key and derives the public key: | ||
|
|
||
| `private_key`: `1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef` | ||
| `pubkey`: `02bb50e2d89a4ed70663d080659fe0ad4b9bc3e06c17a227433966cb59ceee020d` | ||
|
|
||
| The user wants to look up quotes for this public key. The request contains the following parameters: | ||
|
|
||
| `timestamp`: `1714521600` | ||
| `mint_pubkey`: `0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798` | ||
|
|
||
| The message to sign `msg_to_sign` is the concatenation of `pubkey || timestamp || mint_pubkey`: | ||
| `msg_to_sign`: `02bb50e2d89a4ed70663d080659fe0ad4b9bc3e06c17a227433966cb59ceee020d17145216000279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798` | ||
|
|
||
| The SHA-256 hash of `msg_to_sign` is: | ||
| `hash`: `8802cf9f257a9d8e9ad702b2eb6e6b98016b866ae6d8593840c0cfa115985d3e` | ||
|
|
||
| The Schnorr signature (BIP340) on the `hash` using the `private_key` is: | ||
| `signature`: `51efc2cedc082bce9780cf428f534a008150e699383b017950944271bfd8806a01eeb7a3833187d25c675062239cbd6567ca1d28dd2c38f841debee8524b9b9a` | ||
|
|
||
| The wallet sends the following `PostMintQuotesByPubkeyRequest`: | ||
|
|
||
| ```json | ||
| { | ||
| "pubkeys": [ | ||
| "02bb50e2d89a4ed70663d080659fe0ad4b9bc3e06c17a227433966cb59ceee020d" | ||
| ], | ||
| "pubkey_signatures": [ | ||
| "51efc2cedc082bce9780cf428f534a008150e699383b017950944271bfd8806a01eeb7a3833187d25c675062239cbd6567ca1d28dd2c38f841debee8524b9b9a" | ||
| ], | ||
| "timestamp": 1714521600 | ||
| } | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a hard rule about acceptable timestamp age - eg, mint will reject any timestamp older than xx minutes, and any timestamp greater than current epoch