From f1b79efa938fb8fcc6a08d583f5411c79dcdec3b Mon Sep 17 00:00:00 2001 From: akwizgran Date: Tue, 14 Apr 2015 11:48:41 +0000 Subject: [PATCH] akwizgran created page: BlogApp --- BlogApp.markdown | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 BlogApp.markdown diff --git a/BlogApp.markdown b/BlogApp.markdown new file mode 100644 index 0000000..7561576 --- /dev/null +++ b/BlogApp.markdown @@ -0,0 +1,57 @@ +BlogApp is a [BSP application](BSP) that synchronises blog posts among groups of devices. Each blog is associated with a public/private key pair that is used to sign posts. The creator of a blog or any subscriber may invite their contacts to subscribe. + +### Channel identifiers + +All blogs share a single invitation channel with the following random identifier: +`4f39 df93 e933 5027 9909 82bf 442f 7b40 75d3 b7f6 6139 34dd c6d1 b539 7a2a 65a3` + +Each blog 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 `public_key` (raw). + +The application identifer is random: +`dafb e56f 0c89 7136 5cea 4bb5 f08e c9a6 1d68 6e05 8b94 3997 b6ff 259b a423 f613` + +### Message types + +**0: INVITATION** - The content is a BDF list with three elements: `blog` (list) and `note` (string, may be null). `blog` is a list with two elements, `name` and `public_key`, 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), `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 subscribe. `note` is an optional note from the invitee to the inviter. + +**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: `signature` (raw) and `content` (list). `signature` is calculated over `content`. + +`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 follow-up. 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. + +### Validity policy + +* An invitation or response must belong to the invitation channel. +* A post or attachment must belong to a blog 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 device. +* A departure is valid if it is well-formed and it 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 carries a valid signature over its content. +* An attachment is always valid. + +Note that a post can be validated before its attachments have been received, and an attachment can be validated before it has been completely received. + +### Storage policy + +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 subscribes to the blog. +* Remote messages are stored while the local device subscribes to the blog. + +### Sharing policy + +For the invitation channel: +* Each local message is shared with one remote device. +* Remote messages are not shared with other remote devices. + +For forum channels: +* Local messages are shared with all remote devices that subscribe to the blog. +* Remote messages are shared with all remote devices that subscribe to the blog.