Generate message and group IDs in a forward-compatible way.

This commit is contained in:
akwizgran
2018-04-18 16:34:02 +01:00
parent 8decc73f4d
commit 9196169561
7 changed files with 46 additions and 33 deletions

View File

@@ -10,6 +10,11 @@ public class Group {
SHARED // The group is visible and messages are shared
}
/**
* The current version of the group format.
*/
public static final int FORMAT_VERSION = 1;
private final GroupId id;
private final ClientId clientId;
private final byte[] descriptor;

View File

@@ -5,6 +5,11 @@ import static org.briarproject.bramble.api.sync.SyncConstants.MESSAGE_HEADER_LEN
public class Message {
/**
* The current version of the message format.
*/
public static final int FORMAT_VERSION = 1;
private final MessageId id;
private final GroupId groupId;
private final long timestamp;

View File

@@ -16,7 +16,13 @@ public class MessageId extends UniqueId {
/**
* Label for hashing messages to calculate their identifiers.
*/
public static final String LABEL = "org.briarproject.bramble/MESSAGE_ID";
public static final String ID_LABEL = "org.briarproject.bramble/MESSAGE_ID";
/**
* Label for hashing the root blocks of messages.
*/
public static final String ROOT_LABEL =
"org.briarproject.bramble/MESSAGE_ROOT";
public MessageId(byte[] id) {
super(id);