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
| | `6` | `sigflag` | `uint` | Signature flag. `0` means `SIG_INPUTS`, `1` means `SIG_ALL`. If absent, the default is `0`. | | ||
| | `7` | `hash` | `bstr` | 32-byte SHA-256 digest for HTLCs. This replaces the legacy HTLC `data` field. | | ||
|
|
||
| Arbitrary tag tuples can be encoded with text-string keys and arbitrary CBOR values (`string: any`). These string-keyed entries are reserved for extensions and MUST NOT redefine the meaning of the integer keys above. |
There was a problem hiding this comment.
"...and MUST NOT redefine the meaning of the integer keys above."
Great call!
|
|
||
| An HTLC condition uses `hash`. Additional signature, locktime, and refund conditions use the same `pubkeys`, `locktime`, `refund`, `n_sigs`, `n_sigs_refund`, and `sigflag` keys defined above. | ||
|
|
||
| Unsigned integer keys not defined here MUST NOT be used unless specified by another NUT. |
|
I just noticed the Eg: a future NUT-10 type that uses |
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.