NUT-20: signature on mint request #188
No reviewers
Labels
No labels
breaking change
bug
documentation
enhancement
needs discussion
needs implementation
new nut
ready
wallet-only
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo-admin/nuts!188
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "sign_mint_quote"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This NUT defines a protocol extension that enables signature-based authentication for mint quote redemption. When requesting a mint quote, clients can provide a public key. The mint will then require a valid signature from the corresponding secret key before processing the mint.
This is defined as an optional extension to NUT-04 and the intention is to reuse it and make it mandatory for bolt12 and onchain.
Another way how to fix the issue is to add the following at the end of the file:
This seems to be preferred way used in other documents.
@thesimplekid Should we make it clear that wallets should use an ephemeral (one time) key?
@ -16,6 +16,8 @@| 20005 | Quote is pending | [NUT-04][04], [NUT-05][05] |We need an error for the invalid witness as well.
Added note on this
nit: I think it's best to stick to the RFC 2219 keywords and definitions (i.e., CAN -> MAY or in this case SHOULD?).
We use CAN (or even can) many times elsewhere so this is by no means a blocking comment, but it's something I noticed in the spec that we SHOULD ( 😉 ) cleanup.
Good catch I thought CAN was a keyword.
Also why hash it again if everything that goes into the schnorr signature is hashed anyway?
calle and I were discussing whether it should be better to just JSON-serialize the entire payload and then use the utf-8 encoding of the
quote_idand the entire serialized payload.I'm fine with either approach what do you think?
For reference how I am doing it right now in my Nutshell branch (before having seen this):
Funny, my first thought was to do this until I looked at the sig all draft. But I think its better not to do the json as then we rely on the json libs the different implementation use to produce the same string for example escape chars and white space could be handled differently. The current implantation avoids this and is simple to implement
I used the wording from NUT-11. Its only hashed once maybe that wording is confusing and should be removed?
So yea I've also seen this other times in the NUTs. I personally think it's not needed but for the sake of consistency let's leave it like this. (Also we cannot change NUT-11 without breaking a lot of implementations)
Yeah I think its best this and NUT-11 match.
We should probably return the
pubkeyhere as well (so that it's clear that the quote is locked)We would also return
pubkeyhere if we did above.I think that was a misunderstanding. I was wondering if we should serialize the outputs as hex to bytes or as utf-8. I believe it would be more coherent to use utf-8 here so we can use the same encoding as for the quote ID. That's what I thought we refer to when we said "serialize as json".
i.e.
@ -16,6 +16,8 @@| 20005 | Quote is pending | [NUT-04][04], [NUT-05][05] |If we want to make a
requiredflag for the mint info, we would need an error code for theQuote without pubkeycaseMaybe "invalid witness" and "no witness provided" can be the same error.
Is
o.B_here the hex encoding of the pubkey?f866a2511c160870c0e250df176c595001b6d481
I wonder if the
requiredflag should be set by specific NUT. For BOLT12 and Onchain NUTs it will be aMUSTas it is already specified in the PRs for those but I don't think this should break wallets that don't implement it for NUT-04.I think we can remove the required flag here. Leaving it up to wallets to choose to use it or not for NUT04 and future nuts that want to require it (eg bolt12) can specify that there.
LGTM
ACK cccbb1dd068791557b4a1ccc6e5091a901056a09
@ -30,3 +32,4 @@[10]: 10.md@ -17,2 +17,4 @@| 20006 | Invoice already paid | [NUT-05][05] || 20007 | Quote is expired | [NUT-04][04], [NUT-05][05] || 20008 | Signature for mint request invalid | [NUT-20][20] || 20009 | Pubkey required for mint quote | [NUT-20][20] |Is this error still necessary?
@ -17,2 +17,4 @@| 20006 | Invoice already paid | [NUT-05][05] || 20007 | Quote is expired | [NUT-04][04], [NUT-05][05] || 20008 | Signature for mint request invalid | [NUT-20][20] || 20009 | Pubkey required for mint quote | [NUT-20][20] |Will be used for BOLT12 and onchain
For future reference: https://json-schema.org/understanding-json-schema/reference/object#required