diff --git a/ForumApp.markdown b/ForumApp.markdown index 4c19e40..56b03d1 100644 --- a/ForumApp.markdown +++ b/ForumApp.markdown @@ -12,15 +12,15 @@ The application identifer is random: ### Message types -**0: INVITATION** - The content is a BDF list with three elements: `forum` (list), `salt` (raw), and `note` (string, may be null). `forum` is a list with two elements, `name` and `salt`, as described above. The random salt in the invitation `note` is an optional note from the inviter to the invitee. +**0: INVITATION** - The content is a BDF list with three elements: `forum` (list) and `note` (string, may be null). `forum` is a list with two elements, `name` and `salt`, as described above. `note` is an optional note from the inviter to the invitee. -**1: RESPONSE** - The content is a BDF list with three elements: `invitation_id` (raw, HASH_LEN bytes), `decision` (boolean), and `note` (string, may be null). `invitation_id` is the identifier of the INVITATION to which this is a response. `decision` indicates whether the invitee wishes to join the forum. `note` is an optional note from the invitee to the inviter. +**1: RESPONSE** - The content is a BDF list with three elements: `invitation_id` (raw), `decision` (boolean), and `note` (string, may be null). `invitation_id` is the identifier of an invitation created by the opposite device. `decision` indicates whether the invitee wishes to join the forum. `note` is an optional note from the invitee to the inviter. -**2: DEPARTURE** - The content +**2: DEPARTURE** - The content is a BDF list with one element: `invitation_id` (raw), which is the identifier of an invitation created by either device. **3: POST** - The content is a BDF list with two elements: `author` (list, may be null) and `content` (list). If `author` is null, the post is anonymous. Otherwise `author` is a list with two elements: `identity` (list) and `signature` (raw). `identity` is a list with two elements: `name` (string) and `public_key` (raw). `signature` is calculated over `content`. -`content` is a list with three elements: `parent_id` (raw, HASH_LEN bytes, may be null), `body` (string), and `attachments` (dictionary, may be null). If `parent_id` is not null, it is the identifier of a POST to which this is a response. Each key in `attachments` is the name of an attachment, and the value is a list with two elements: `mime_type` (string) and `message_id` (raw, HASH_LEN bytes). +`content` is a list with three elements: `parent_id` (raw, may be null), `body` (string), and `attachments` (dictionary, may be null). If `parent_id` is not null, it is the identifier of a POST to which this is a response. Each key in `attachments` is the name of an attachment, and the value is a list with two elements: `mime_type` (string) and `message_id` (raw). **4: ATTACHMENT** - The content is raw data. @@ -29,7 +29,8 @@ The application identifer is random: * An invitation or response must belong to the invitation channel. * A post or attachment must belong to a forum channel. * An invitation is valid if it is well-formed. -* A response is valid if it is well-formed and it references a valid invitation created by the opposite (local or remote) device. +* A response is valid if it is well-formed and references a valid invitation created by the opposite device. +* A departure is valid if it is well-formed and references a valid invitation created by either device. * A post is valid if it is well-formed, its parent (if any) is a valid post, and it is either anonymous or carries a valid signature over its content. * An attachment is always valid. @@ -37,15 +38,20 @@ Note that a post can be validated before its attachments have been received, and ### Storage policy -* All valid local messages are stored. -* All valid remote messages are stored. +For the invitation channel: +* All local messages are stored. +* All remote messages are stored. + +For forum channels: +* Local messages are stored while the local device belongs to the forum. +* Remote messages are stored while the local device belongs to the forum. ### Sharing policy For the invitation channel: -* A valid local message is shared with one remote device. +* Each local message is shared with one remote device. * Remote messages are not shared with other remote devices. For forum channels: -* Valid local messages are shared with all remote devices that belong to the forum. -* Valid remote messages are shared with all remote devices that belong to the forum. +* Local messages are shared with all remote devices that belong to the forum. +* Remote messages are shared with all remote devices that belong to the forum.