|
|
The blog sharing client is a [BSP client](BSP) that allows users to share blogs with their contacts, who may accept or decline the invitations.
|
|
|
|
|
|
### Group identifiers
|
|
|
|
|
|
The client's identifier is `org.briarproject.briar.blog.sharing`.
|
|
|
|
|
|
The client uses a separate group for each pair of contacts. The [group descriptor](BSP#group-identifiers) is a [BDF list](BDF) containing the unique IDs of the contacts' identities, sorted in ascending order as byte strings.
|
|
|
|
|
|
### Message types
|
|
|
|
|
|
The sharing protocol uses five message types. All communication happens solely between the inviter and the invitee. The messages referring to each forum constitute a session.
|
|
|
|
|
|
**0: INVITE** - Sent by the inviter to the invitee. The message body is a BDF list with four elements: `messageType` (int), `previousMessageId` (unique ID or null), `descriptor` (list), and `message` (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. `message` is an optional message from the inviter to the invitee. The blog ID must be calculated from the descriptor, as it is used by subsequent messages in the session.
|
|
|
|
|
|
The inviter sets the blog's visibility to VISIBLE when sending an invite message.
|
|
|
|
|
|
**1: ACCEPT** - Sent by the invitee to the inviter in response to an invite. The message body is a BDF list with three elements: `messageType` (int), `blogId` (unique ID), and `previousMessageId` (unique ID).
|
|
|
|
|
|
The invitee sets the blog's visibility to SHARED when sending an accept message. The inviter sets the blog's visibility to SHARED when receiving an accept message.
|
|
|
|
|
|
**2: DECLINE** - Sent by the invitee to the inviter in response to an invite. The message body is a BDF list with three elements: `messageType` (int), `blogId` (unique ID), and `previousMessageId` (unique ID).
|
|
|
|
|
|
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).
|
|
|
|
|
|
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).
|
|
|
|
|
|
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](/uploads/373807b51d3ba73d6f49a874b931ef0f/state-machine-4.png)
|
|
|
|
|
|
[state-machine-4.odg](/uploads/4606c2f4b9d7f3c00482bdbf46fec250/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.
|
|
|
|
|
|
### Storage policy
|
|
|
|
|
|
* All messages are stored.
|
|
|
|
|
|
### Sharing policy
|
|
|
|
|
|
* All local messages are shared. |