Skip to content

Commit d761e41

Browse files
committed
New SCEP 105.
1 parent f7c0a09 commit d761e41

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed

src/content/pages/sceps/scep0000.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Num Title
4747
|102| Certificates of existence
4848
|103| Standard filesystem representation method
4949
|104| Document handles and citation formats
50+
|105| Standard JSON representation method
5051
====== ===================
5152

5253

@@ -66,3 +67,4 @@ References
6667
.. |102| replace:: :raw-html:`<a href="scep0102.html">102</a>`
6768
.. |103| replace:: :raw-html:`<a href="scep0103.html">103</a>`
6869
.. |104| replace:: :raw-html:`<a href="scep0104.html">104</a>`
70+
.. |105| replace:: :raw-html:`<a href="scep0105.html">105</a>`
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
:SCEP: 105
2+
:Title: Standard JSON representation method
3+
:Author: Raphael ‘kena’ Poss
4+
:Status: Draft
5+
:Type: Standards Track
6+
:Created: 2014-06-20
7+
8+
The Structured Commons object model is defined semantically in SCEP
9+
101 [#SCEP-101]_, independently from its particular representation in a
10+
computer system. Conversely, there may exist multiple valid
11+
representations for an object.
12+
13+
This SCEP defines the canonical representation of Structured
14+
Commons objects as a JSON object, with method name "**json**".
15+
16+
Overview
17+
========
18+
19+
The ``json`` representation maps objects to a JSON object [#JSON]_.
20+
21+
Object files are represented by JSON character strings.
22+
23+
Object dictionaries are represented by JSON associative arrays.
24+
25+
Dictionary names that map to objects are represented by
26+
associative array entries that are the JSON representation
27+
of the enclosed object.
28+
29+
Dictionary names that map to fingerprints are represented by a JSON
30+
list containing one string entry containing the compact representation
31+
of the fingerprint.
32+
33+
Example
34+
=======
35+
36+
For example, the following Structured Commons object::
37+
38+
(root)
39+
|
40+
+-- hello.txt (file)
41+
| hello, world!
42+
|
43+
+-- link (fingerprint reference)
44+
(fp:0cYMtlAA_T4_vG2NBmtEeB7uh26b1tpzb-0qiDGHxGrIMw)
45+
46+
can be represented by the following JSON text:
47+
48+
.. code:: json
49+
50+
{
51+
"hello.txt" : "hello, world!"
52+
"link" : ["fp:0cYMtlAA_T4_vG2NBmtEeB7uh26b1tpzb-0qiDGHxGrIMw"]
53+
}
54+
55+
Alternate representation
56+
========================
57+
58+
When an object file contains many occurrences of byte codes outside of the
59+
printable range, the "direct" JSON representation using Unicode escape sequences ("``\uXXXX``")
60+
can incur a large space overhead, up to 500% of the length of the original byte string.
61+
62+
For applications where binary data is common, this specification provides an
63+
*alternate*, mutually compatible encoding for file objects: a
64+
JSON list containing one string containing the Base64 encoding
65+
of the object (using the special URL safe alphabet defined in [#BASE]_).
66+
67+
With this alternate representation, the example above can be encoded
68+
as follows:
69+
70+
.. code:: json
71+
72+
{
73+
"hello.txt" : ["aGVsbG8sIHdvcmxkIQ=="],
74+
"link" : ["fp:0cYMtlAA_T4_vG2NBmtEeB7uh26b1tpzb-0qiDGHxGrIMw"]
75+
}
76+
77+
The alternate encoding is not ambiguous with fingerprint references,
78+
since the Base64 encoding of a file object can never start with the
79+
three characters "``fp:``".
80+
81+
Example/reference implementation
82+
================================
83+
84+
Example code in Python is provided separately:
85+
86+
https://github.com/structured-commons/tools
87+
88+
References
89+
==========
90+
91+
.. [#SCEP-101] SCEP 101. "Structured Commons Object Model and Fingerprints".
92+
(http://www.structured-commons.org/scep0101.html)
93+
94+
.. [#JSON] RFC 7159. "The JavaScript Object Notation (JSON) Data Interchange Format".
95+
(https://tools.ietf.org/html/rfc7159)
96+
97+
.. [#BASE] RFC 4648. "The Base16, Base32, and Base64 Data Encodings".
98+
(https://tools.ietf.org/html/rfc4648)
99+
100+
Copyright
101+
=========
102+
103+
This document has been placed in the public domain.
104+
105+
106+
..
107+
Local Variables:
108+
mode: rst
109+
indent-tabs-mode: nil
110+
sentence-end-double-space: t
111+
fill-column: 70
112+
coding: utf-8
113+
End:

0 commit comments

Comments
 (0)