Skip to content

Commit ab711be

Browse files
dominictarrduncan255
authored andcommitted
strings and numbers must be cannonical
link to the JSON.stringify spec, and that strings and numbers must be cannonically encoded (so that they restringify back to the same values that were parsed)
1 parent 4ad8427 commit ab711be

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,10 +829,16 @@ <h5>Implementations</h5>
829829
<li>Dictionary entries and list elements each on their own line.</li>
830830
<li>Empty dictionaries appear as <code>{}</code> and empty lists appear as <code>[]</code>.</li>
831831
<li>One space after the colon <code>:</code> for dictionary keys.</li>
832+
<li>Strings and numbers must be cannonically encoded. That is, they should be the form <em>produced</em> by <a href="https://www.ecma-international.org/ecma-262/6.0/#sec-json.stringify"><code>JSON.stringify</code></a></li>
832833
<li>No trailing newline.</li>
833834
</ul>
834835
<aside>
835-
<p>Dictionary keys can appear in any order you choose, however the order needs to be remembered for later.</p>
836+
<p>Dictionary keys can appear in any order you choose, however the order needs to be remembered for later.
837+
</p>
838+
</aside>
839+
<aside>
840+
<p>valid JSON accepts forms that JSON.stringify does not produce. Scuttlebutt messages are a subset of valid JSON, that will restringify to the same bytes that was parsed. The reference implementation parses messages received over the network, then reserializes them before validating the signature and will not accept messages with fields that are not cannonically encoded.
841+
</p>
836842
</aside>
837843
<p>Then sign the message by computing:</p>
838844
<pre><code>signature = nacl_sign_detached(

0 commit comments

Comments
 (0)