Define V3 binary secret encoding#389
Conversation
Co-authored-by: Rob Woodgate <robwoodgate@users.noreply.github.com>
Co-authored-by: Rob Woodgate <robwoodgate@users.noreply.github.com>
robwoodgate
left a comment
There was a problem hiding this comment.
Great work, Egge - you've captured everything we discussed really well.
I added one suggestion which was a tangential offline conversation.
| | `0x00` | `random` | Random bytes | | ||
| | `0x01` | `condition` | CBOR-encoded spending condition data | | ||
|
|
||
| For `SECRET_KIND = 0x00`, `DATA` SHOULD be 32 bytes generated by a CSPRNG. |
There was a problem hiding this comment.
I think we were planning to make this change too for v3 secrets.
| For `SECRET_KIND = 0x00`, `DATA` SHOULD be 32 bytes generated by a CSPRNG. | |
| For `SECRET_KIND = 0x00`, `DATA` SHOULD be a random 33 byte compressed secp256k1 public key. |
There was a problem hiding this comment.
Can you elaborate on the usecase? Making a standard random secret 33 bytes would mean it becomes distinguishable from deterministic secrets
There was a problem hiding this comment.
This was proposed to allow future possibilities, such as FROST.
|
I just noticed the Eg: a future NUT-10 type that uses |
|
Following offline discussions not to delay BLS for binary secrets,I had my clanker do a deeper review, bringing in #371 as this PR needs to build on the BLS. Here are the findings: Reviewed this against the current NUT-00/10/11/13/14 text and the BLS v3 keyset work. The envelope and CBOR maps read well. My main suggestion is structural: bind the binary format to its own keyset version byte rather than to "v3 keysets" in place, and don't gate the BLS keyset rollout on it. Then a few field-level gaps to close. Structural: give binary its own version byteThis PR makes binary mandatory for every v3 keyset ("For V3 keysets, Cleaner: let binary be a new keyset version profile (e.g. Field-level gaps (independent of the above)1. No transport encoding for the bytes (NUT-00). The secret is defined "before any transport encoding," but nothing downstream carries raw bytes. The mint JSON API ( 2. CBOR MUST be canonical (NUT-00 / NUT-10). The exact secret bytes are hashed into This is not hypothetical: cashu-ts's current CBOR encoder (used for V4 tokens) is non-canonical and could not even produce these maps as-is. Its map encoder emits keys in object-insertion order with no sort (fails §4.2.1), and it only emits text-string keys, so it cannot encode the integer keys ( 3. NUT-13 deterministic-secret conflict. The BLS keyset work defines a v3 deterministic secret as "the raw 32-byte HMAC digest." This PR makes a v3 secret 4. SIG_ALL over binary secrets (NUT-11). Legacy SIG_ALL concatenates 5. |
Description
Adds the general V3 binary secret envelope to NUT-00 and defines
the NUT-10 condition payload encoding for V3 secrets.
Changes:
extension tags as string: any.