Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Blog Sharing Client
The blog sharing client is a [BSP client](https://code.briarproject.org/briar/briar-spec/blob/master/protocols/BSP.md) that allows users to share blogs with their contacts, who may accept or decline the invitations. It is used in conjunction with the [blog client](blog client).
### Identifier
The client's identifier is `org.briarproject.briar.blog.sharing`. The major version is 0.
### Groups
The client uses a separate BSP group for communicating with each contact. The [group descriptor](https://code.briarproject.org/briar/briar-spec/blob/master/protocols/BSP.md#23-groups) is a [BDF list](https://code.briarproject.org/briar/briar-spec/blob/master/BDF.md) containing the unique IDs of the contacts' identities, sorted in ascending order as byte strings.
### Roles
All communication happens between two contacts, who have symmetrical roles.
### Sessions
The messages exchanged between two contacts referring to a given blog constitute a session. The blog's unique ID is used as the session ID.
### Message types
The protocol uses five message types.
**0: INVITE** - Sent by either party to start or restart a session. The message body is a BDF list with four elements: `messageType` (int), `previousMessageId` (unique ID or null), `descriptor` (list), and `text` (string or null).
`previousMessageId` is the ID of the previous message in this session, if any. `descriptor` is the [descriptor of the blog](Blog-Client#group-identifiers) being shared. The blog ID must be calculated from the descriptor, as it is used by subsequent messages in the session. `text` is an optional message from the inviter to the invitee explaining the invitation.
The sender sets the blog's visibility to VISIBLE when sending an invite message.
**1: ACCEPT** - Sent in response to an invite. The message body is a BDF list with three elements: `messageType` (int), `blogId` (unique ID), and `previousMessageId` (unique ID).
`previousMessageId` is the ID of the previous message in this session.
The sender sets the blog's visibility to SHARED when sending an accept message. The recipient sets the blog's visibility to SHARED when receiving an accept message.
**2: DECLINE** - Sent in response to an invite. The message body is a BDF list with three elements: `messageType` (int), `blogId` (unique ID), and `previousMessageId` (unique ID).
`previousMessageId` is the ID of the previous message in this session.
The inviter sets the blog's visibility to INVISIBLE when receiving a decline message.
**3: LEAVE** - Sent by either party when unsubscribing from the blog, if the blog's visibility is VISIBLE or SHARED. The message body is a BDF list with three elements: `messageType` (int), `blogId` (unique ID), and `previousMessageId` (unique ID).
`previousMessageId` is the ID of the previous message in this session.
The sender sets the blog's visibility to INVISIBLE when sending a leave message. The recipient sets the blog's visibility to INVISIBLE when receiving a leave message.
**4: ABORT** - Sent by either party when recieving a message that is valid but unexpected in the current state. The message body is a BDF list with three elements: `messageType` (int), `blogId` (unique ID), and `previousMessageId` (unique ID).
`previousMessageId` is the ID of the previous message in this session.
The sender sets the blog's visibility to INVISIBLE when sending an abort message. The recipient sets the blog's visibility to INVISIBLE when receiving an abort message.
### State machine

[state-machine-4.odg](/assets/clients/Blog-Sharing-Client/state-machine-4.odg)
Aborting from any state returns the session to the START state.
### Validity policy
* A message is valid if it is well-formed and its previous message (if any) is a valid message in the same session.
### Storage policy
* All messages are stored.
### Sharing policy
* All local messages are shared.