mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Allow ReturnShardPayload instances to be compared for equality
This commit is contained in:
@@ -22,4 +22,9 @@ public class ReturnShardPayload {
|
|||||||
public BackupPayload getBackupPayload() {
|
public BackupPayload getBackupPayload() {
|
||||||
return backupPayload;
|
return backupPayload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean equals(ReturnShardPayload otherReturnShardPayload) {
|
||||||
|
return shard.equals(otherReturnShardPayload.getShard()) && backupPayload
|
||||||
|
.equals(otherReturnShardPayload.getBackupPayload());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package org.briarproject.briar.api.socialbackup;
|
|||||||
|
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import javax.annotation.concurrent.Immutable;
|
import javax.annotation.concurrent.Immutable;
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
@@ -22,4 +24,9 @@ public class Shard {
|
|||||||
public byte[] getShard() {
|
public byte[] getShard() {
|
||||||
return shard;
|
return shard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean equals(Shard otherShard) {
|
||||||
|
return Arrays.equals(secretId, otherShard.getSecretId()) &&
|
||||||
|
Arrays.equals(shard, otherShard.getShard());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package org.briarproject.briar.api.socialbackup.recovery;
|
|||||||
|
|
||||||
import org.briarproject.bramble.api.crypto.PublicKey;
|
import org.briarproject.bramble.api.crypto.PublicKey;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
|
import org.briarproject.briar.api.socialbackup.ReturnShardPayload;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
@@ -39,11 +40,11 @@ public interface SecretOwnerTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Success extends State {
|
public static class Success extends State {
|
||||||
private final byte[] remotePayload;
|
private final ReturnShardPayload remotePayload;
|
||||||
|
|
||||||
public Success(byte[] remotePayload) { this.remotePayload = remotePayload; }
|
public Success(ReturnShardPayload remotePayload) { this.remotePayload = remotePayload; }
|
||||||
|
|
||||||
public byte[] getRemotePayload() { return remotePayload; }
|
public ReturnShardPayload getRemotePayload() { return remotePayload; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Failure extends State {
|
public static class Failure extends State {
|
||||||
|
|||||||
Reference in New Issue
Block a user