Skip to content

Commit 155010e

Browse files
stevenjneil-iohk
andauthored
feat(docs): Add more doc definitions/specifications (#285)
* fix(docs): Updated TODO place holder text with context * fix(docs): Render docs with better placeholder * docs(docs): Add more detail to proposal document specification * docs(docs): Add details to the Proposal Comment document * docs(docs): Add more proposal submission actions specifications * docs(docs): random cleanups * docs(docs): fix markdown lint issues * docs(docs): Use a CID for the document hash * docs(docs): Add document revocations to proposals and comments * docs(docs): turn hash into a map for better future proofing * docs(docs): Use defined cbor tag and binary format for IPLD Content Identifiers (CID) * docs(docs): Removed obsolete cddl definition --------- Co-authored-by: neil-iohk <[email protected]>
1 parent f8aa68e commit 155010e

18 files changed

+990
-485
lines changed

docs/src/architecture/08_concepts/signed_doc/doc_relationships.d2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ copyright: |~md
100100
"ver": UUIDv7
101101
"template": Proposal Template
102102
"collaborators": Collaborators Reference List
103+
"revocations": Version Revocations
103104
"brand_id": Brand Parameters (Optional)
104105
"campaign_id": Campaign Parameters (Optional)
105106
"category_id": Category Parameters (Optional)
@@ -123,6 +124,7 @@ copyright: |~md
123124
"template": Proposal Comment Template
124125
"reply": Proposal Comment (Optional)
125126
"section": Section Reference
127+
"revocations": Version Revocations
126128
"brand_id": Brand Parameters (Optional)
127129
"campaign_id": Campaign Parameters (Optional)
128130
"category_id": Category Parameters (Optional)

docs/src/architecture/08_concepts/signed_doc/doc_relationships.svg

Lines changed: 304 additions & 304 deletions
Loading

docs/src/architecture/08_concepts/signed_doc/docs/comment_moderation_action.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,40 @@ Reference to a Linked Document or Documents.
106106
This is the primary hierarchical reference to a related document.
107107

108108
This is an Array of the format:
109-
`[[DocumentID, DocumentVer, DocumentHash],...]`
110109

111-
* `DocumentID` is the [UUIDv7][RFC9562-V7] ID of the Document being referenced.
112-
* `DocumentVer` is the [UUIDv7][RFC9562-V7] Version of the Document being referenced.
113-
* `DocumentHash` is the Blake2b-256 Hash of the entire document being referenced, not just its payload.
114-
It ensures that the intended referenced document is the one used, and there has been no substitution.
115-
Prevents substitutions where a new document with the same Document ID and Ver might be published over an existing one.
110+
```cddl
111+
[ 1* [ document_id, document_ver, document_locator ] ]
112+
```
113+
114+
If a reference is defined as required, there must be at least 1 reference specified.
115+
Some documents allow multiple references, and they are documented as required.
116+
117+
* `document_id` is the [UUIDv7][RFC9562-V7] ID of the Document being referenced.
118+
* `document_ver` is the [UUIDv7][RFC9562-V7] Version of the Document being referenced.
119+
* `document_locator` is a content unique locator for the document.
120+
This serves two purposes.
121+
122+
1. It ensures that the document referenced by an ID/Version is not substituted.
123+
In other words, that the document intended to be referenced, is actually referenced.
124+
2. Allow the document to be unambiguously located in decentralized storage systems.
125+
126+
There can be any number of Document Locations in any reference.
127+
The currently defined locations are:
128+
129+
* `cid` : A [CBOR Encoded IPLD Content Identifier][CBOR-TAG-42] ( AKA an [IPFS CID][IPFS-CID] ).
130+
* Others may be added when further storage mechanisms are defined.
131+
132+
The value set here does not guarantee that the document is actually stored.
133+
It only defines that if it were stored, this is the identifier that
134+
that is required to retrieve it.
116135

117136
#### Validation
118137

119-
Every Reference Document **MUST** Exist, and **MUST** be a valid reference to the document.
120-
The calculated Hash of the Referenced Document **MUST** match the Hash in the reference.
138+
The following must be true for a valid reference:
139+
140+
* The Referenced Document **MUST** Exist
141+
* Every value in the `document_locator` must consistently reference the exact same document.
142+
* The `document_id` and `document_ver` **MUST** match the values in the referenced document.
121143

122144
## Payload
123145

@@ -149,6 +171,8 @@ New versions of this document may be published by:
149171

150172
* First Published Version
151173

174+
[CBOR-TAG-42]: https://github.com/ipld/cid-cbor/
152175
[RFC9052-HeaderParameters]: https://www.rfc-editor.org/rfc/rfc8152#section-3.1
153176
[CC-BY-4.0]: https://creativecommons.org/licenses/by/4.0/legalcode
177+
[IPFS-CID]: https://docs.ipfs.tech/concepts/content-addressing/#what-is-a-cid
154178
[RFC9562-V7]: https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-7

docs/src/architecture/08_concepts/signed_doc/docs/proposal.md

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The payload of a proposal is controlled by its template.
2222
"ver": UUIDv7
2323
"template": Proposal Template
2424
"collaborators": Collaborators Reference List
25+
"revocations": Version Revocations
2526
"brand_id": Brand Parameters (Optional)
2627
"campaign_id": Campaign Parameters (Optional)
2728
"category_id": Category Parameters (Optional)
@@ -36,26 +37,40 @@ The payload of a proposal is controlled by its template.
3637

3738
### Validation
3839

39-
This specification outlines the required definitions for the current features.
40-
The document will be incrementally improved in future iterations as more functionality
41-
and features are added.
42-
This section will be included and updated in future iterations.
40+
The first version of a Proposal *MUST* be signed by the original author.
41+
It may optionally be co-signed by any of the listed [`collaborators`](../metadata.md#collaborators).
42+
It may not be signed by anyone else.
43+
44+
Subsequent Versions can be signed/co-signed by either the Original Author of the first version,
45+
OR any of the listed [`collaborators`](../metadata.md#collaborators) in the immediately previous version.
46+
This allows any collaborator to update the next version of a document, provided they are still a collaborator.
47+
It is valid for a proposal to be signed by a collaborator
48+
who is no longer listed as in the [`collaborators`](../metadata.md#collaborators)
49+
of the document they are signing, provided they are listed as a collaborator in the immediately previous document version.
50+
This allows for a collaborator to make an update to the document which removes themselves
51+
from the [`collaborators`](../metadata.md#collaborators) list.
52+
53+
All versions of the document *MUST* list the author as the original author.
54+
The Author can not be changed by any document revision.
4355

4456
### Business Logic
4557

4658
#### Front End
4759

48-
This specification outlines the required definitions for the current features.
49-
The document will be incrementally improved in future iterations as more functionality
50-
and features are added.
51-
This section will be included and updated in future iterations.
60+
As validity of the documents is currently enforced by the backend,
61+
the front end does not need to validate the document has been signed
62+
correctly.
63+
It may do so, but it is not required.
5264

5365
#### Back End
5466

55-
This specification outlines the required definitions for the current features.
56-
The document will be incrementally improved in future iterations as more functionality
57-
and features are added.
58-
This section will be included and updated in future iterations.
67+
Before accepting a new proposal to be published, the backend will ensure:
68+
69+
* The document has been signed by a valid author or collaborator.
70+
* That the signer of the document was a registered proposer
71+
* That the document was signed with their proposers key
72+
* That all listed [`collaborators`](../metadata.md#collaborators) are registered as proposers.
73+
* That the document has been signed validly according to the [validation](#validation) rules.
5974

6075
## [COSE Header Parameters][RFC9052-HeaderParameters]
6176

@@ -144,6 +159,33 @@ are permitting these potential collaborators to participate in the drafting and
144159
However, any document submission referencing a proposal MUST be signed by all collaborators in
145160
addition to the author.
146161

162+
### [`revocations`](../metadata.md#revocations)
163+
<!-- markdownlint-disable MD033 -->
164+
| Parameter | Value |
165+
| --- | --- |
166+
| Required | optional |
167+
| Format | [Version Revocations](../metadata.md#version-revocations) |
168+
<!-- markdownlint-enable MD033 -->
169+
A document may include a list of any prior versions which are considered to be revoked.
170+
Only the revocation list in the latest version of the document applies.
171+
Revoked documents are flagged as no longer valid, and should not be displayed.
172+
As a special case, if the revocations are set to `true` then all versions of the document
173+
are revoked, including the latest document.
174+
175+
In this case, when the latest document is revoked, the payload may be empty.
176+
Any older document that has [`revocations`](../metadata.md#revocations) set to `true` is always to be filtered
177+
and its payload is to be assumed to be invalid.
178+
179+
This allows for an entire document and any/all published versions to be revoked.
180+
A new version of the document that is published after this, may reinstate prior
181+
document versions, by not listing them as revoked.
182+
However, any document where revocations was set `true` can never be reinstated.
183+
184+
#### Validation
185+
186+
If the field is `true` the payload may be absent or invalid.
187+
Such documents may never be submitted.
188+
147189
### [`brand_id`](../metadata.md#brand_id)
148190
<!-- markdownlint-disable MD033 -->
149191
| Parameter | Value |

docs/src/architecture/08_concepts/signed_doc/docs/proposal_comment.md

Lines changed: 74 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
## Description
44

5-
## Proposal Comment Document
6-
75
A Proposal Comment is a document which comments on a referenced Proposal document.
86

97
Proposal Comments themselves are intentionally general, however they may be
@@ -23,6 +21,7 @@ The payload of a proposal comment is controlled by its template.
2321
"template": Proposal Comment Template
2422
"reply": Proposal Comment (Optional)
2523
"section": Section Reference
24+
"revocations": Version Revocations
2625
"brand_id": Brand Parameters (Optional)
2726
"campaign_id": Campaign Parameters (Optional)
2827
"category_id": Category Parameters (Optional)
@@ -39,26 +38,28 @@ The payload of a proposal comment is controlled by its template.
3938

4039
### Validation
4140

42-
This specification outlines the required definitions for the current features.
43-
The document will be incrementally improved in future iterations as more functionality
44-
and features are added.
45-
This section will be included and updated in future iterations.
41+
A comment which is a reply *MUST* reference the same document.
42+
It may reference a different version of the document.
4643

4744
### Business Logic
4845

4946
#### Front End
5047

51-
This specification outlines the required definitions for the current features.
52-
The document will be incrementally improved in future iterations as more functionality
53-
and features are added.
54-
This section will be included and updated in future iterations.
48+
Comments are valid for any version of the document, however
49+
as comments refer to a specific version of a document, they may
50+
lose context when displayed against the latest version of a document.
51+
In these cases, the front end should clearly show that a comment was on
52+
a different version of the document.
53+
54+
If the front end posts a reply to another comment:
55+
56+
* it should reference the comment being replied to in the [`reply`](../metadata.md#reply) field.
57+
* The [`ref`](../metadata.md#ref) field must refer to the same document, but can be a different version.
5558

5659
#### Back End
5760

58-
This specification outlines the required definitions for the current features.
59-
The document will be incrementally improved in future iterations as more functionality
60-
and features are added.
61-
This section will be included and updated in future iterations.
61+
The backend will only validate the document being referenced exists,
62+
and the integrity of the [`ref`](../metadata.md#ref) and [`reply`](../metadata.md#reply) metadata fields is correct.
6263

6364
## [COSE Header Parameters][RFC9052-HeaderParameters]
6465

@@ -123,18 +124,40 @@ Reference to a Linked Document or Documents.
123124
This is the primary hierarchical reference to a related document.
124125

125126
This is an Array of the format:
126-
`[[DocumentID, DocumentVer, DocumentHash],...]`
127127

128-
* `DocumentID` is the [UUIDv7][RFC9562-V7] ID of the Document being referenced.
129-
* `DocumentVer` is the [UUIDv7][RFC9562-V7] Version of the Document being referenced.
130-
* `DocumentHash` is the Blake2b-256 Hash of the entire document being referenced, not just its payload.
131-
It ensures that the intended referenced document is the one used, and there has been no substitution.
132-
Prevents substitutions where a new document with the same Document ID and Ver might be published over an existing one.
128+
```cddl
129+
[ 1* [ document_id, document_ver, document_locator ] ]
130+
```
131+
132+
If a reference is defined as required, there must be at least 1 reference specified.
133+
Some documents allow multiple references, and they are documented as required.
134+
135+
* `document_id` is the [UUIDv7][RFC9562-V7] ID of the Document being referenced.
136+
* `document_ver` is the [UUIDv7][RFC9562-V7] Version of the Document being referenced.
137+
* `document_locator` is a content unique locator for the document.
138+
This serves two purposes.
139+
140+
1. It ensures that the document referenced by an ID/Version is not substituted.
141+
In other words, that the document intended to be referenced, is actually referenced.
142+
2. Allow the document to be unambiguously located in decentralized storage systems.
143+
144+
There can be any number of Document Locations in any reference.
145+
The currently defined locations are:
146+
147+
* `cid` : A [CBOR Encoded IPLD Content Identifier][CBOR-TAG-42] ( AKA an [IPFS CID][IPFS-CID] ).
148+
* Others may be added when further storage mechanisms are defined.
149+
150+
The value set here does not guarantee that the document is actually stored.
151+
It only defines that if it were stored, this is the identifier that
152+
that is required to retrieve it.
133153

134154
#### Validation
135155

136-
Every Reference Document **MUST** Exist, and **MUST** be a valid reference to the document.
137-
The calculated Hash of the Referenced Document **MUST** match the Hash in the reference.
156+
The following must be true for a valid reference:
157+
158+
* The Referenced Document **MUST** Exist
159+
* Every value in the `document_locator` must consistently reference the exact same document.
160+
* The `document_id` and `document_ver` **MUST** match the values in the referenced document.
138161

139162
### [`template`](../metadata.md#template)
140163
<!-- markdownlint-disable MD033 -->
@@ -181,6 +204,33 @@ A Reference to the original document, or the comment being replied to.
181204
For a non-reply this must be a valid section reference into the referenced document.
182205
For a reply, this must be a valid section reference into the comment being replied to.
183206

207+
### [`revocations`](../metadata.md#revocations)
208+
<!-- markdownlint-disable MD033 -->
209+
| Parameter | Value |
210+
| --- | --- |
211+
| Required | optional |
212+
| Format | [Version Revocations](../metadata.md#version-revocations) |
213+
<!-- markdownlint-enable MD033 -->
214+
A document may include a list of any prior versions which are considered to be revoked.
215+
Only the revocation list in the latest version of the document applies.
216+
Revoked documents are flagged as no longer valid, and should not be displayed.
217+
As a special case, if the revocations are set to `true` then all versions of the document
218+
are revoked, including the latest document.
219+
220+
In this case, when the latest document is revoked, the payload may be empty.
221+
Any older document that has [`revocations`](../metadata.md#revocations) set to `true` is always to be filtered
222+
and its payload is to be assumed to be invalid.
223+
224+
This allows for an entire document and any/all published versions to be revoked.
225+
A new version of the document that is published after this, may reinstate prior
226+
document versions, by not listing them as revoked.
227+
However, any document where revocations was set `true` can never be reinstated.
228+
229+
#### Validation
230+
231+
If the field is `true` the payload may be absent or invalid.
232+
Such documents may never be submitted.
233+
184234
### [`brand_id`](../metadata.md#brand_id)
185235
<!-- markdownlint-disable MD033 -->
186236
| Parameter | Value |
@@ -301,7 +351,9 @@ New versions of this document may be published by:
301351

302352
* First Published Version
303353

354+
[CBOR-TAG-42]: https://github.com/ipld/cid-cbor/
304355
[RFC9052-HeaderParameters]: https://www.rfc-editor.org/rfc/rfc8152#section-3.1
305356
[CC-BY-4.0]: https://creativecommons.org/licenses/by/4.0/legalcode
357+
[IPFS-CID]: https://docs.ipfs.tech/concepts/content-addressing/#what-is-a-cid
306358
[RFC9562-V7]: https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-7
307359
[RFC8259]: https://www.rfc-editor.org/rfc/rfc8259.html

docs/src/architecture/08_concepts/signed_doc/docs/proposal_moderation_action.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,40 @@ Reference to a Linked Document or Documents.
106106
This is the primary hierarchical reference to a related document.
107107

108108
This is an Array of the format:
109-
`[[DocumentID, DocumentVer, DocumentHash],...]`
110109

111-
* `DocumentID` is the [UUIDv7][RFC9562-V7] ID of the Document being referenced.
112-
* `DocumentVer` is the [UUIDv7][RFC9562-V7] Version of the Document being referenced.
113-
* `DocumentHash` is the Blake2b-256 Hash of the entire document being referenced, not just its payload.
114-
It ensures that the intended referenced document is the one used, and there has been no substitution.
115-
Prevents substitutions where a new document with the same Document ID and Ver might be published over an existing one.
110+
```cddl
111+
[ 1* [ document_id, document_ver, document_locator ] ]
112+
```
113+
114+
If a reference is defined as required, there must be at least 1 reference specified.
115+
Some documents allow multiple references, and they are documented as required.
116+
117+
* `document_id` is the [UUIDv7][RFC9562-V7] ID of the Document being referenced.
118+
* `document_ver` is the [UUIDv7][RFC9562-V7] Version of the Document being referenced.
119+
* `document_locator` is a content unique locator for the document.
120+
This serves two purposes.
121+
122+
1. It ensures that the document referenced by an ID/Version is not substituted.
123+
In other words, that the document intended to be referenced, is actually referenced.
124+
2. Allow the document to be unambiguously located in decentralized storage systems.
125+
126+
There can be any number of Document Locations in any reference.
127+
The currently defined locations are:
128+
129+
* `cid` : A [CBOR Encoded IPLD Content Identifier][CBOR-TAG-42] ( AKA an [IPFS CID][IPFS-CID] ).
130+
* Others may be added when further storage mechanisms are defined.
131+
132+
The value set here does not guarantee that the document is actually stored.
133+
It only defines that if it were stored, this is the identifier that
134+
that is required to retrieve it.
116135

117136
#### Validation
118137

119-
Every Reference Document **MUST** Exist, and **MUST** be a valid reference to the document.
120-
The calculated Hash of the Referenced Document **MUST** match the Hash in the reference.
138+
The following must be true for a valid reference:
139+
140+
* The Referenced Document **MUST** Exist
141+
* Every value in the `document_locator` must consistently reference the exact same document.
142+
* The `document_id` and `document_ver` **MUST** match the values in the referenced document.
121143

122144
## Payload
123145

@@ -149,6 +171,8 @@ New versions of this document may be published by:
149171

150172
* First Published Version
151173

174+
[CBOR-TAG-42]: https://github.com/ipld/cid-cbor/
152175
[RFC9052-HeaderParameters]: https://www.rfc-editor.org/rfc/rfc8152#section-3.1
153176
[CC-BY-4.0]: https://creativecommons.org/licenses/by/4.0/legalcode
177+
[IPFS-CID]: https://docs.ipfs.tech/concepts/content-addressing/#what-is-a-cid
154178
[RFC9562-V7]: https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-7

0 commit comments

Comments
 (0)