Skip to content

Instantly share code, notes, and snippets.

@weex
Last active March 22, 2017 04:54
Show Gist options
  • Save weex/b9f7cf4663b5effbdb1a90ca7d7853fc to your computer and use it in GitHub Desktop.
Save weex/b9f7cf4663b5effbdb1a90ca7d7853fc to your computer and use it in GitHub Desktop.

JSON document format

In order to provide for easier parsing, verification and display of Rein documents, the document format is being changed from a colon-delimited form to the more standard JSON format. The JSON standard is well-known and widely-implemented with native support in Python, Javascript and many other languages.

Example signed document in the new format:

{
    "title": "Rein Job",
    "Job name": "Record a Rein Theme Song",
    "Job ID": "n0qlna45dgynluhtl0gf",
    ...
    "signature_address": "1dezq4MkERrT5vRKyMTLsugNz74JVy4U6",
    "signature": "whatever the signature would be"
}

The above dictionary (minus signature since it wouldn't have been generated yet) is serialized as follows before the entire blob is signed.

{"Job ID":"n0qlna45dgynluhtl0gf","Job name":"Record a Rein Theme Song",..."title": "Rein Job"}

The above string representation should be sorted by key so there is only one way to build the string representation. Checking a signature is straightforward if you have exactly all of the data ordered in only one possible way.

@alexanderdushkin
Copy link

Why use an underscore name for signature_address and a space delimited one for Job name? I mean, it's inconsistent and could lead to confusion. Personally, I prefer the underscore option as Rein documents are mostly used by programs and not by humans.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment