@@ -16,9 +16,12 @@ to define the schema. JSON is the only recommended encoding.)
16
16
The standard data structure for storing a signed message is a JSON message of
17
17
the following form, called the "JSON envelope":
18
18
19
- ``` json
19
+ ``` jsonc
20
20
{
21
- "payload" : " <Base64(SERIALIZED_BODY)>" ,
21
+ // Exactly one of the following must be set:
22
+ " payload" : " <Base64Encode(SERIALIZED_BODY)>" ,
23
+ " payloadUtf8" : " <Utf8Decode(SERIALIZED_BODY)>" ,
24
+ // End oneof
22
25
" payloadType" : " <PAYLOAD_TYPE>" ,
23
26
" signatures" : [{
24
27
" keyid" : " <KEYID>" ,
@@ -29,9 +32,22 @@ the following form, called the "JSON envelope":
29
32
30
33
See [ Protocol] ( protocol.md ) for a definition of parameters and functions.
31
34
32
- Base64() is [ Base64 encoding] ( https://tools.ietf.org/html/rfc4648 ) , transforming
33
- a byte sequence to a unicode string. Either standard or URL-safe encoding is
34
- allowed.
35
+ Exactly one of ` payload ` or ` payloadUtf8 ` MUST be set:
36
+
37
+ - ` payload ` supports arbitrary SERIALIZED_BODY.
38
+ [ Base64Encode()] ( https://tools.ietf.org/html/rfc4648 ) transforms a byte
39
+ sequence to a Unicode string. Base64 has a fixed 33% space overhead but
40
+ supports payloads that are not necessarily valid UTF-8. Either standard or
41
+ URL-safe encoding is allowed.
42
+
43
+ - ` payloadUtf8 ` only supports valid
44
+ [ UTF-8] ( https://tools.ietf.org/html/rfc3629 ) SERIALIZED_BODY. ` Utf8Decode() `
45
+ converts that UTF-8 byte sequence to a Unicode string. Regular JSON string
46
+ escaping applies, but this is usually more compact and amenable to
47
+ compression than Base64.
48
+
49
+ Note: The choice of ` payload ` vs ` payloadUtf8 ` does not impact the
50
+ [ the signing or the signatures] ( protocol.md#signature-definition ) .
35
51
36
52
### Multiple signatures
37
53
@@ -54,8 +70,8 @@ envelopes with individual signatures.
54
70
55
71
### Parsing rules
56
72
57
- * The following fields are REQUIRED and MUST be set, even if empty: ` payload ` ,
58
- ` payloadType ` , ` signature ` , ` signature.sig ` .
73
+ * The following fields are REQUIRED and MUST be set, even if empty:
74
+ exactly one of { ` payload ` or ` payloadUtf8 ` }, ` payloadType ` , ` signature ` , ` signature.sig ` .
59
75
* The following fields are OPTIONAL and MAY be unset: ` signature.keyid ` .
60
76
An unset field MUST be treated the same as set-but-empty.
61
77
* Producers, or future versions of the spec, MAY add additional fields.
0 commit comments