mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
Preliminaries for private group invitation protocol.
This commit is contained in:
@@ -1,25 +1,28 @@
|
||||
package org.briarproject.api.clients;
|
||||
|
||||
import org.briarproject.api.data.BdfDictionary;
|
||||
import org.briarproject.api.sync.BaseMessageContext;
|
||||
import org.briarproject.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class BdfMessageContext extends BaseMessageContext {
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
public class BdfMessageContext {
|
||||
|
||||
private final BdfDictionary dictionary;
|
||||
private final Collection<MessageId> dependencies;
|
||||
|
||||
public BdfMessageContext(@NotNull BdfDictionary dictionary,
|
||||
@NotNull Collection<MessageId> dependencies) {
|
||||
|
||||
super(dependencies);
|
||||
public BdfMessageContext(BdfDictionary dictionary,
|
||||
Collection<MessageId> dependencies) {
|
||||
this.dictionary = dictionary;
|
||||
this.dependencies = dependencies;
|
||||
}
|
||||
|
||||
public BdfMessageContext(@NotNull BdfDictionary dictionary) {
|
||||
public BdfMessageContext(BdfDictionary dictionary) {
|
||||
this(dictionary, Collections.<MessageId>emptyList());
|
||||
}
|
||||
|
||||
@@ -27,4 +30,7 @@ public class BdfMessageContext extends BaseMessageContext {
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
public Collection<MessageId> getDependencies() {
|
||||
return dependencies;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,14 +5,17 @@ import org.briarproject.api.data.BdfDictionary;
|
||||
import org.briarproject.api.data.BdfList;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
import org.briarproject.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.InvalidMessageException;
|
||||
import org.briarproject.api.sync.Message;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@NotNullByDefault
|
||||
public interface ClientHelper {
|
||||
|
||||
void addLocalMessage(Message m, BdfDictionary metadata, boolean shared)
|
||||
@@ -21,14 +24,21 @@ public interface ClientHelper {
|
||||
void addLocalMessage(Transaction txn, Message m, BdfDictionary metadata,
|
||||
boolean shared) throws DbException, FormatException;
|
||||
|
||||
Message createMessage(GroupId g, long timestamp, BdfDictionary body)
|
||||
throws FormatException;
|
||||
|
||||
Message createMessage(GroupId g, long timestamp, BdfList body)
|
||||
throws FormatException;
|
||||
|
||||
Message createMessageForStoringMetadata(GroupId g);
|
||||
|
||||
@Nullable
|
||||
Message getMessage(MessageId m) throws DbException;
|
||||
|
||||
@Nullable
|
||||
Message getMessage(Transaction txn, MessageId m) throws DbException;
|
||||
|
||||
@Nullable
|
||||
BdfList getMessageAsList(MessageId m) throws DbException, FormatException;
|
||||
|
||||
@Nullable
|
||||
BdfList getMessageAsList(Transaction txn, MessageId m) throws DbException,
|
||||
FormatException;
|
||||
|
||||
@@ -80,6 +90,8 @@ public interface ClientHelper {
|
||||
|
||||
BdfList toList(byte[] b) throws FormatException;
|
||||
|
||||
BdfList toList(Message m) throws FormatException;
|
||||
|
||||
byte[] sign(BdfList toSign, byte[] privateKey)
|
||||
throws FormatException, GeneralSecurityException;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.briarproject.api.clients;
|
||||
|
||||
import org.briarproject.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.api.sync.Group;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
@@ -13,7 +12,7 @@ public abstract class NamedGroup extends BaseGroup {
|
||||
private final String name;
|
||||
private final byte[] salt;
|
||||
|
||||
public NamedGroup(@NotNull Group group, @NotNull String name, byte[] salt) {
|
||||
public NamedGroup(Group group, String name, byte[] salt) {
|
||||
super(group);
|
||||
this.name = name;
|
||||
this.salt = salt;
|
||||
|
||||
Reference in New Issue
Block a user