diff --git a/29.md b/29.md index 7d3937a6..c53d3438 100644 --- a/29.md +++ b/29.md @@ -222,7 +222,7 @@ msg_to_sign = quote_id[i] || B_0 || B_1 || ... || B_(n-1) Where: - `quote_id[i]` is the UTF-8 encoded quote ID at index `i` -- `B_0 ... B_(n-1)` are **all blinded messages** from the `outputs` array (regardless of amount splitting) +- `B_0 ... B_(n-1)` are UTF-8 encoded hex strings of **all blinded messages** from the `outputs` array (regardless of amount splitting) - `||` denotes concatenation The signature is a BIP340 Schnorr signature on the SHA-256 hash of `msg_to_sign`. diff --git a/tests/20-test.md b/tests/20-test.md index e534f948..d2832656 100644 --- a/tests/20-test.md +++ b/tests/20-test.md @@ -38,10 +38,22 @@ The following is a `PostMintBolt11Request` with a valid signature. Where the `pu The following is the expected message to sign on the above `PostMintBolt11Request`. +As a concatenated string: + +``` +9d745270-1405-46de-b5c5-e2762b4f5e000342e5bcc77f5b2a3c2afb40bb591a1e27da83cddc968abdc0ec4904201a201834032fd3c4dc49a2844a89998d5e9d5b0f0b00dde9310063acb8a92e2fdafa4126d4033b6fde50b6a0dfe61ad148fff167ad9cf8308ded5f6f6b2fe000a036c464c31102be5a55f03e5c0aaea77595d574bce92c6d57a2a0fb2b5955c0b87e4520e06b5302209fc2873f28521cbdde7f7b3bb1521002463f5979686fd156f23fe6a8aa2b79 +``` + +As UTF-8 bytes: + ``` [57, 100, 55, 52, 53, 50, 55, 48, 45, 49, 52, 48, 53, 45, 52, 54, 100, 101, 45, 98, 53, 99, 53, 45, 101, 50, 55, 54, 50, 98, 52, 102, 53, 101, 48, 48, 48, 51, 52, 50, 101, 53, 98, 99, 99, 55, 55, 102, 53, 98, 50, 97, 51, 99, 50, 97, 102, 98, 52, 48, 98, 98, 53, 57, 49, 97, 49, 101, 50, 55, 100, 97, 56, 51, 99, 100, 100, 99, 57, 54, 56, 97, 98, 100, 99, 48, 101, 99, 52, 57, 48, 52, 50, 48, 49, 97, 50, 48, 49, 56, 51, 52, 48, 51, 50, 102, 100, 51, 99, 52, 100, 99, 52, 57, 97, 50, 56, 52, 52, 97, 56, 57, 57, 57, 56, 100, 53, 101, 57, 100, 53, 98, 48, 102, 48, 98, 48, 48, 100, 100, 101, 57, 51, 49, 48, 48, 54, 51, 97, 99, 98, 56, 97, 57, 50, 101, 50, 102, 100, 97, 102, 97, 52, 49, 50, 54, 100, 52, 48, 51, 51, 98, 54, 102, 100, 101, 53, 48, 98, 54, 97, 48, 100, 102, 101, 54, 49, 97, 100, 49, 52, 56, 102, 102, 102, 49, 54, 55, 97, 100, 57, 99, 102, 56, 51, 48, 56, 100, 101, 100, 53, 102, 54, 102, 54, 98, 50, 102, 101, 48, 48, 48, 97, 48, 51, 54, 99, 52, 54, 52, 99, 51, 49, 49, 48, 50, 98, 101, 53, 97, 53, 53, 102, 48, 51, 101, 53, 99, 48, 97, 97, 101, 97, 55, 55, 53, 57, 53, 100, 53, 55, 52, 98, 99, 101, 57, 50, 99, 54, 100, 53, 55, 97, 50, 97, 48, 102, 98, 50, 98, 53, 57, 53, 53, 99, 48, 98, 56, 55, 101, 52, 53, 50, 48, 101, 48, 54, 98, 53, 51, 48, 50, 50, 48, 57, 102, 99, 50, 56, 55, 51, 102, 50, 56, 53, 50, 49, 99, 98, 100, 100, 101, 55, 102, 55, 98, 51, 98, 98, 49, 53, 50, 49, 48, 48, 50, 52, 54, 51, 102, 53, 57, 55, 57, 54, 56, 54, 102, 100, 49, 53, 54, 102, 50, 51, 102, 101, 54, 97, 56, 97, 97, 50, 98, 55, 57] ``` +The SHA-256 message hash is: `56b0ae5673e16308add75b19a6af8a747c8d3dfc24850fd838425792a22c99dc` + +--- + The following is a `PostMintBolt11Request` with an invalid signature. Where the `pubkey` in the `PostMintQuoteBolt11Request` is `03d56ce4e446a85bbdaa547b4ec2b073d40ff802831352b8272b7dd7a4de5a7cac`. ```json diff --git a/tests/29-tests.md b/tests/29-tests.md index c697e184..14f8ff94 100644 --- a/tests/29-tests.md +++ b/tests/29-tests.md @@ -130,9 +130,9 @@ The following is a valid NUT-20 batch mint request where the signature correctly ```shell quote: "locked-quote" pubkey: 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 -msg_to_sign_bytes: utf8("locked-quote") || B0 || B1 -msg_hash: 5ac550d5416e81c613b58e3f1fb095390fb828b55e8991fd9de231ca8e31e859 -signature[0]: 9408920d0b94cee5eb6df20f14d2a655e7ce2ce309dc1f1aeb69b219efe76716933b2206eba3a54f9a953c92edaa922ab3e6912e02383dda42a193409567a0dc +msg_to_sign_bytes: utf8("locked-quote") || utf8(B0) || utf8(B1) +msg_hash: a62f12934711693d6045ed2843ae4c5b33fd156df029fb9337dea3175c438263 +signature[0]: bd4d55f3fda33109fe3694c041aa9358c8e6e581236245ee310e7e225dfb075d9a2799b9672e646cb7e9fad9887f5b42a04d307a238d219783a4790b323194c0 ``` ```json @@ -151,7 +151,7 @@ signature[0]: 9408920d0b94cee5eb6df20f14d2a655e7ce2ce309dc1f1aeb69b219efe7671693 } ], "signatures": [ - "9408920d0b94cee5eb6df20f14d2a655e7ce2ce309dc1f1aeb69b219efe76716933b2206eba3a54f9a953c92edaa922ab3e6912e02383dda42a193409567a0dc" + "bd4d55f3fda33109fe3694c041aa9358c8e6e581236245ee310e7e225dfb075d9a2799b9672e646cb7e9fad9887f5b42a04d307a238d219783a4790b323194c0" ] } ```