Skip to content

Commit 48d3120

Browse files
committed
add CDDL definitions
1 parent 9ca6d89 commit 48d3120

File tree

1 file changed

+34
-11
lines changed

1 file changed

+34
-11
lines changed

rust/signed_doc/README.md

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,32 @@ which **must** be present (most of the fields originally defined by this
2626
* `content encoding` (CBOR type `text`): `br` CBOR type `text`
2727
(this parameter is used to indicate the content encodings algorithm of the payload data,
2828
in this particular case [brotli] compression data format is used).
29-
* `type` (CBOR type `text`): CBOR encoded UUID `#6.37(bytes)`.
30-
* `id` (CBOR type `text`): CBOR encoded ULID `#6.32780(bytes)`.
31-
* `ver` (CBOR type `text`): CBOR encoded ULID `#6.32780(bytes)`.
32-
* `ref` (CBOR type `text`): CBOR encoded ULID `#6.32780(bytes)`
33-
or array of ULIDs `[#6.32780(bytes), #6.32780(bytes)]`.
34-
* `template` (CBOR type `text`): CBOR encoded ULID `#6.32780(bytes)`
35-
or array of ULIDs `[#6.32780(bytes), #6.32780(bytes)]`.
36-
* `reply` (CBOR type `text`): CBOR encoded ULID `#6.32780(bytes)`
37-
or array of ULIDs `[#6.32780(bytes), #6.32780(bytes)]`.
38-
* `section` (CBOR type `text`): CBOR encoded string, type `text`.
39-
* `collabs` (CBOR type `text`): CBOR encoded array of any CBOR types `[+ any]`.
29+
* `type`: CBOR encoded UUID.
30+
* `id`: CBOR encoded ULID.
31+
* `ver`: CBOR encoded ULID `#6.32780(bytes)`.
32+
* `ref`: CBOR encoded ULID or two elements array of ULIDs (optional).
33+
* `template`: CBOR encoded ULID or two elements array of ULIDs (optional).
34+
* `reply`: CBOR encoded ULID or two elements array of ULIDs (optional).
35+
* `section`: CBOR encoded string (optional).
36+
* `collabs`: CBOR encoded array of any CBOR types (optional).
37+
38+
Precise CDDL definition
39+
40+
```cddl
41+
protected_header = {
42+
1 => -8, ; "alg": EdDSA
43+
3 => 30, ; "content type": Json
44+
"content encoding" => "br", ; payload content encoding, brotli compression
45+
"type" => #6.37(bytes), ; UUID
46+
"id" => #6.32780(bytes), ; ULID
47+
"ver" => #6.32780(bytes), ; ULID
48+
? "ref" => #6.32780(bytes) / [#6.32780(bytes), #6.32780(bytes)], ; either ULID or [ULID, ULID]
49+
? "template" => #6.32780(bytes) / [#6.32780(bytes), #6.32780(bytes)], ; either ULID or [ULID, ULID]
50+
? "reply" => #6.32780(bytes) / [#6.32780(bytes), #6.32780(bytes)], ; either ULID or [ULID, ULID]
51+
? "section" => text,
52+
? "collabs" => [+any],
53+
}
54+
```
4055

4156
### COSE payload
4257

@@ -55,6 +70,14 @@ each Catalyst signed document [COSE] signature **must** include the following pr
5570

5671
* `kid`: CBOR encoded `bytes` type.
5772

73+
Precise CDDL definition
74+
75+
```cddl
76+
signature_protected_header = {
77+
4 => bytes ; "kid"
78+
}
79+
```
80+
5881
## Example
5982

6083
Generate a `ed25519` private and public keys

0 commit comments

Comments
 (0)