Skip to content

Commit

Permalink
NUT-00: remove binary spec for v3 token (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
Egge21M authored Dec 25, 2024
1 parent 83cadff commit 0cdbe77
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 39 deletions.
5 changes: 2 additions & 3 deletions 00.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,14 @@ cashuBo2F0gqJhaUgA_9SLj17PgGFwgaNhYQFhc3hAYWNjMTI0MzVlN2I4NDg0YzNjZjE4NTAxNDkyMT

#### Binary Token

V3 and V4 Token can be transmitted in a binary format when applicable (for example when transmitting via NFC).
Token can be transmitted in a binary format when applicable (for example when transmitting via NFC).
For this the serialised token is prepended with a prefix and a version byte.

```
utf8("craw") || utf8(<token_version>) || <serialised_token>
```

- Token V3 Version: `utf8("craw") || utf8("A") || cbor(token_object)`
- Token V4 Version: `utf8("craw") || utf8("B") || cbor(token_object)`
- Binary Encoding V4: `utf8("craw") || utf8("B") || cbor(token_v4_object)`

[00]: 00.md
[01]: 01.md
Expand Down
36 changes: 0 additions & 36 deletions tests/00-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,42 +193,6 @@ cashuBo2F0gqJhaUgA_9SLj17PgGFwgaNhYQFhc3hAYWNjMTI0MzVlN2I4NDg0YzNjZjE4NTAxNDkyMT

## Raw Token Serialization

### TokenV3

What follows is a TokenV3 Token serialized in its raw binary form. `h''` values are bytes in hex notation.

Token:

```json
{
"token": [
{
"mint": "https://8333.space:3338",
"proofs": [
{
"amount": 2,
"id": "009a1f293253e41e",
"secret": "407915bc212be61a77e3e6d2aeb4c727980bda51cd06a6afc29e2861768a7837",
"C": "02bc9097997d81afb2cc7346b5e4345a9346bd2a506eb7958598a72f0cf85163ea"
},
{
"amount": 8,
"id": "009a1f293253e41e",
"secret": "fe15109314e61d7756b0f8ee0f23a624acaa3f4e042f61433c728c7057b931be",
"C": "029e8e5050b890a7d6c0968db16bc1d5d5fa040ea1de284f6ec69d61299f671059"
}
]
}
],
"unit": "sat",
"memo": "Thank you."
}
```

Serialized to raw binary:

`h'6372617741a365746f6b656e81a2646d696e747768747470733a2f2f383333332e73706163653a333333386670726f6f667382a466616d6f756e740262696470303039613166323933323533653431656673656372657478403430373931356263323132626536316137376533653664326165623463373237393830626461353163643036613661666332396532383631373638613738333761437842303262633930393739393764383161666232636337333436623565343334356139333436626432613530366562373935383539386137326630636638353136336561a466616d6f756e74086269647030303961316632393332353365343165667365637265747840666531353130393331346536316437373536623066386565306632336136323461636161336634653034326636313433336337323863373035376239333162656143784230323965386535303530623839306137643663303936386462313662633164356435666130343065613164653238346636656336396436313239396636373130353964756e697463736174646d656d6f6a5468616e6b20796f752e'`

### TokenV4

What follows is a TokenV4 Token serialized in its raw binary form. `h''` values are bytes in hex notation.
Expand Down

0 comments on commit 0cdbe77

Please sign in to comment.