akwizgran created page: ForumApp

akwizgran
2015-04-13 13:58:08 +00:00
parent 398fcc92a4
commit fdf0d54ed9

@@ -1,22 +1,24 @@
ForumApp is an application that uses [BSP](BSP) to synchronise invitation-only forums.
ForumApp is a [BSP application](BSP) that synchronises forum posts between groups of devices.
### Channel identifiers
ForumApp uses a channel with a random identifier for forum invitations:
ForumApp has a single invitation channel with the following random identifier:
`667e 2acb da80 2e61 3168 98f2 8ec5 8102 fcf2 3d10 04ee 3086 f5e9 94d8 30f5 b773`
Each forum has its own channel with a hash identifier. The application data structure for generating the identifier is a [BDF](BDF) list with two elements: `name` (string) and `salt` (raw, exactly HASH_LEN bytes). The random salt prevents collisions between forums with the same name. The application identifer is random:
Each forum has its own channel with a [hash identifier](BSP#channel-identifiers). The application data structure for generating the identifier is a [BDF](BDF) list with two elements: `name` (string) and `salt` (raw, HASH_LEN bytes). The random salt prevents collisions between forums with the same name.
The application identifer is random:
`859a 7be5 0dca 035b 64bd 6902 fb79 7097 795a f837 abbf 8c16 d750 b3c2 ccc1 86ea`
### Message types
**0: INVITATION** - The content is a BDF list with two elements: `forum` (list) and `message` (string, may be null). `forum` is a list with two elements, `name` and `salt`, as described above. `message` is an optional note from the inviter to the invitee.
**0: INVITATION** - The content is a BDF list with two 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, exactly HASH_LEN bytes), `decision` (boolean), and `message` (string, may be null). `invitation_id` is the message identifier of the INVITATION to which this is a response. `decision` indicates whether the invitee wishes to join the forum. `message` is an optional note from the invitee to the inviter.
**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.
**2: 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`.
**2: 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, exactly HASH_LEN bytes, may be null), `body` (string), and `attachments` (dictionary, may be null). `parent_id` is the message identifier of a POST to which this is a response. The key for each attachment is its name, and the value is a list with two elements: `mime_type` (string), and `message_id` (raw, exactly HASH_LEN bytes).
`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).
**3: ATTACHMENT** - The content is raw data.
@@ -25,10 +27,12 @@ Each forum has its own channel with a hash identifier. The application data stru
* 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.
* A RESPONSE is valid if it is well-formed and it references a valid INVITATION created by the opposite (local or remote) 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.
* An ATTACHMENT is valid if it is referenced by a valid POST.
Note that a POST can be validated before its attachments have been received.
### Storage policy
* All valid local messages are stored.
@@ -38,7 +42,7 @@ Each forum has its own channel with a hash identifier. The application data stru
### Sharing policy
For the invitation channel:
* Each valid local message is shared with one remote device.
* A valid local message is shared with one remote device.
* Remote messages are not shared with other remote devices.
For forum channels: