Remove new member announcement and add signature to invitation

This commit is contained in:
Torsten Grote
2016-11-03 12:24:56 -02:00
parent 4bad7076e7
commit 7125248677
11 changed files with 257 additions and 251 deletions

View File

@@ -1,9 +1,9 @@
package org.briarproject.api.clients;
import org.briarproject.api.contact.Contact;
import org.briarproject.api.identity.AuthorId;
import org.briarproject.api.sync.ClientId;
import org.briarproject.api.sync.Group;
import org.briarproject.api.sync.GroupFactory;
public interface ContactGroupFactory {
@@ -13,4 +13,11 @@ public interface ContactGroupFactory {
/** Creates a group for the given client to share with the given contact. */
Group createContactGroup(ClientId clientId, Contact contact);
/**
* Creates a group for the given client to share between the given authors
* identified by their AuthorIds.
*/
Group createContactGroup(ClientId clientId, AuthorId authorId1,
AuthorId authorId2);
}

View File

@@ -10,33 +10,29 @@ import org.jetbrains.annotations.Nullable;
public interface GroupMessageFactory {
/**
* Creates a new member announcement that contains the joiner's identity
* and is signed by the creator.
* <p>
* When a new member accepts an invitation to the group,
* the creator sends this new member announcement to the group.
*
* @param groupId The ID of the group the new member joined
* @param timestamp The current timestamp
* @param creator The creator of the group with {@param groupId}
* @param member The new member that has just accepted an invitation
*/
@CryptoExecutor
GroupMessage createNewMemberMessage(GroupId groupId, long timestamp,
LocalAuthor creator, Author member);
/**
* Creates a join announcement message
* that depends on a previous new member announcement.
* Creates a join announcement message for the creator of a group.
*
* @param groupId The ID of the Group that is being joined
* @param timestamp Must be equal to the timestamp of the new member message
* @param member Our own LocalAuthor
* @param newMemberId The MessageId of the new member message
* @param timestamp Must be greater than the timestamp of the invitation message
* @param creator The creator's LocalAuthor
*/
@CryptoExecutor
GroupMessage createJoinMessage(GroupId groupId, long timestamp,
LocalAuthor member, MessageId newMemberId);
LocalAuthor creator);
/**
* Creates a join announcement message for a joining member.
*
* @param groupId The ID of the Group that is being joined
* @param timestamp Must be greater than the timestamp of the
* invitation message
* @param member The member's LocalAuthor
* @param inviteTimestamp The timestamp of the group invitation message
* @param creatorSignature The creator's signature from the group invitation
*/
@CryptoExecutor
GroupMessage createJoinMessage(GroupId groupId, long timestamp,
LocalAuthor member, long inviteTimestamp, byte[] creatorSignature);
/**
* Creates a group message

View File

@@ -1,9 +1,8 @@
package org.briarproject.api.privategroup;
public enum MessageType {
NEW_MEMBER(0),
JOIN(1),
POST(2);
JOIN(0),
POST(1);
int value;

View File

@@ -21,12 +21,10 @@ public interface PrivateGroupManager extends MessageTracker {
* Adds a new private group and joins it.
*
* @param group The private group to add
* @param newMemberMsg The creator's message announcing herself as
* first new member
* @param joinMsg The creator's own join message
*/
void addPrivateGroup(PrivateGroup group, GroupMessage newMemberMsg,
GroupMessage joinMsg) throws DbException;
void addPrivateGroup(PrivateGroup group, GroupMessage joinMsg)
throws DbException;
/** Removes a dissolved private group. */
void removePrivateGroup(GroupId g) throws DbException;