Include unique device ID in transport updates.

This commit is contained in:
akwizgran
2016-01-27 12:16:09 +00:00
parent 88475bdd54
commit c776d1e893
8 changed files with 79 additions and 18 deletions

View File

@@ -0,0 +1,16 @@
package org.briarproject.api;
import java.util.Arrays;
/** Type-safe wrapper for a byte array that uniquely identifies a device. */
public class DeviceId extends UniqueId {
public DeviceId(byte[] id) {
super(id);
}
@Override
public boolean equals(Object o) {
return o instanceof DeviceId && Arrays.equals(id, ((DeviceId) o).id);
}
}

View File

@@ -1,5 +1,6 @@
package org.briarproject.api.db;
import org.briarproject.api.DeviceId;
import org.briarproject.api.TransportId;
import org.briarproject.api.contact.Contact;
import org.briarproject.api.contact.ContactId;
@@ -137,6 +138,9 @@ public interface DatabaseComponent {
/** Returns all contacts associated with the given local pseudonym. */
Collection<ContactId> getContacts(AuthorId a) throws DbException;
/** Returns the unique ID for this device. */
DeviceId getDeviceId() throws DbException;
/** Returns the group with the given ID, if the user subscribes to it. */
Group getGroup(GroupId g) throws DbException;