mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 20:59:54 +01:00
Add interfaces for social backup recovery tasks.
This commit is contained in:
@@ -0,0 +1,51 @@
|
|||||||
|
package org.briarproject.briar.api.socialbackup.recovery;
|
||||||
|
|
||||||
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
|
|
||||||
|
@NotNullByDefault
|
||||||
|
public interface CustodianTask {
|
||||||
|
|
||||||
|
void start(Observer observer);
|
||||||
|
|
||||||
|
void cancel();
|
||||||
|
|
||||||
|
interface Observer {
|
||||||
|
void onStateChanged(State state);
|
||||||
|
}
|
||||||
|
|
||||||
|
class State {
|
||||||
|
|
||||||
|
static class Connecting extends State {
|
||||||
|
}
|
||||||
|
|
||||||
|
static class SendingShard extends State {
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ReceivingAck extends State {
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Success extends State {
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Failure extends State {
|
||||||
|
|
||||||
|
enum Reason {
|
||||||
|
QR_CODE_INVALID,
|
||||||
|
QR_CODE_TOO_OLD,
|
||||||
|
QR_CODE_TOO_NEW,
|
||||||
|
NO_CONNECTION,
|
||||||
|
OTHER
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Reason reason;
|
||||||
|
|
||||||
|
Failure(Reason reason) {
|
||||||
|
this.reason = reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Reason getReason() {
|
||||||
|
return reason;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package org.briarproject.briar.api.socialbackup.recovery;
|
||||||
|
|
||||||
|
import org.briarproject.bramble.api.crypto.PublicKey;
|
||||||
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
|
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
|
@NotNullByDefault
|
||||||
|
public interface SecretOwnerTask {
|
||||||
|
|
||||||
|
void start(Observer observer);
|
||||||
|
|
||||||
|
void cancel();
|
||||||
|
|
||||||
|
interface Observer {
|
||||||
|
void onStateChanged(State state);
|
||||||
|
}
|
||||||
|
|
||||||
|
class State {
|
||||||
|
|
||||||
|
static class Listening extends State {
|
||||||
|
|
||||||
|
private final PublicKey publicKey;
|
||||||
|
private final InetSocketAddress socketAddress;
|
||||||
|
|
||||||
|
public Listening(PublicKey publicKey,
|
||||||
|
InetSocketAddress socketAddress) {
|
||||||
|
this.publicKey = publicKey;
|
||||||
|
this.socketAddress = socketAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicKey getPublicKey() {
|
||||||
|
return publicKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InetSocketAddress getSocketAddress() {
|
||||||
|
return socketAddress;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ReceivingShard extends State {
|
||||||
|
}
|
||||||
|
|
||||||
|
static class SendingAck extends State {
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Success extends State {
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Failure extends State {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user