|
|
The private group client is a [BSP client](BSP) that synchronises messages among groups of devices. Only the creator of a group can invite other members. Any member can post messages to a group. Messages are signed by their authors.
|
|
|
|
|
|
### Group identifiers
|
|
|
|
|
|
The client's identifier is `org.briarproject.briar.privategroup`.
|
|
|
|
|
|
Each private group has its own BSP group. The [group descriptor](BSP#group-identifiers) is a [BDF list](BDF) with three elements: `creator` (list), `name` (string), and `salt` (raw).
|
|
|
|
|
|
`creator` is a list with three elements: `formatVersion` (int), `nickname` (string), and `publicKey` (raw). This identifies the user who created the private group. The salt is 32 random bytes, to prevent collisions between private groups with the same creator and name.
|
|
|
|
|
|
### Message types
|
|
|
|
|
|
**0: JOIN** - Sent by a new member to announce that she has joined the private group. The message body is a BDF list with four elements: `messageType` (int), `member` (list), `invite` (list or null), and `memberSignature` (raw).
|
|
|
|
|
|
`member` is a list with three elements: `formatVersion` (int), `nickname` (string), and `publicKey` (raw). This identifies the user who has joined the private group.
|
|
|
|
|
|
`invite` is null if the member created the private group. Otherwise it is a list with two elements: `inviteTimestamp` (int) and `inviteSignature` (raw). These are copied from the [invitation](Private-Group-Sharing-Client#message-types) sent by the creator.
|
|
|
|
|
|
`inviteSignature` covers a BDF list with four elements: `creatorId` (unique ID), `memberId` (unique ID), `privateGroupId` (unique ID), and `inviteTimestamp` (int). The public key from the group descriptor is used to verify `inviteSignature`.
|
|
|
|
|
|
`memberSignature` covers a BDF list with four elements: `privateGroupId` (unique ID), `timestamp` (int), `member` (list), and `invite` (list or null). The group ID and timestamp are taken from the message header. The public key from `member` is used to verify `memberSignature`.
|
|
|
|
|
|
**1: POST** - The message body is a BDF list with six elements: `messageType` (int), `member` (list), `parentId` (unique ID or null), `previousMessageId` (unique ID), `content` (string), and `signature` (raw).
|
|
|
|
|
|
`member` is a list with three elements: `formatVersion` (int), `nickname` (string), and `publicKey` (raw). This identifies the author of the message.
|
|
|
|
|
|
`parentId` is the optional ID of a message in the same private group to which this message replies. `previousMessageId` is the ID of the previous join or post message sent by this member to this private group.
|
|
|
|
|
|
The signature covers a BDF list with six elements: `groupId` (unique ID), `timestamp` (int), `member` (list), `parentId` (unique ID or null), `previousMessageId` (unique ID), and `content` (string). The group ID and timestamp are taken from the message header.
|
|
|
|
|
|
### Validity policy
|
|
|
|
|
|
* A join is valid if it is well-formed, has a valid signature from the new member, and has a valid signature from the creator unless the new member is the creator.
|
|
|
* A post is valid if it is well-formed, has a valid signature, and its parent (if any) is a valid post.
|
|
|
|
|
|
### Storage policy
|
|
|
|
|
|
* All messages are stored.
|
|
|
|
|
|
### Sharing policy
|
|
|
|
|
|
* All messages are shared. |