mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
Public interface of SocialBackupExchangeManager and Message encoder/parser
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
package org.briarproject.briar.socialbackup;
|
package org.briarproject.briar.api.socialbackup;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.briar.api.socialbackup.Shard;
|
import org.briarproject.briar.api.socialbackup.Shard;
|
||||||
|
|
||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
interface MessageEncoder {
|
public interface MessageEncoder {
|
||||||
|
|
||||||
byte[] encodeShardMessage(Shard shard);
|
byte[] encodeShardMessage(Shard shard);
|
||||||
|
|
||||||
byte[] encodeBackupMessage(int version, org.briarproject.briar.api.socialbackup.BackupPayload payload);
|
byte[] encodeBackupMessage(int version, org.briarproject.briar.api.socialbackup.BackupPayload payload);
|
||||||
|
|
||||||
|
byte[] encodeReturnShardPayload(ReturnShardPayload returnShardPayload);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package org.briarproject.briar.socialbackup;
|
package org.briarproject.briar.api.socialbackup;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.FormatException;
|
import org.briarproject.bramble.api.FormatException;
|
||||||
import org.briarproject.bramble.api.data.BdfList;
|
import org.briarproject.bramble.api.data.BdfList;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.briar.api.socialbackup.Shard;
|
|
||||||
|
|
||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
interface MessageParser {
|
public interface MessageParser {
|
||||||
|
|
||||||
Shard parseShardMessage(BdfList body) throws FormatException;
|
Shard parseShardMessage(BdfList body) throws FormatException;
|
||||||
|
|
||||||
org.briarproject.briar.api.socialbackup.BackupPayload parseBackupMessage(BdfList body) throws FormatException;
|
BackupPayload parseBackupMessage(BdfList body) throws FormatException;
|
||||||
|
|
||||||
|
ReturnShardPayload parseReturnShardPayload(BdfList body) throws FormatException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ public interface SocialBackupExchangeManager {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws DbException
|
* @throws DbException
|
||||||
*/
|
*/
|
||||||
public void sendReturnShard(DuplexTransportConnection conn,
|
void sendReturnShard(DuplexTransportConnection conn,
|
||||||
SecretKey masterKey,
|
SecretKey masterKey,
|
||||||
boolean verified) throws IOException, DbException;
|
boolean verified, ReturnShardPayload returnShardPayload) throws IOException, DbException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive a returned shard and encrypted backup from a custodian
|
* Receive a returned shard and encrypted backup from a custodian
|
||||||
@@ -31,7 +31,7 @@ public interface SocialBackupExchangeManager {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws DbException
|
* @throws DbException
|
||||||
*/
|
*/
|
||||||
public ReturnShardPayload receiveReturnShard(DuplexTransportConnection conn,
|
ReturnShardPayload receiveReturnShard(DuplexTransportConnection conn,
|
||||||
SecretKey masterKey, boolean verified)
|
SecretKey masterKey, boolean verified)
|
||||||
throws IOException, DbException;
|
throws IOException, DbException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,4 +55,7 @@ public interface SocialBackupManager extends
|
|||||||
Transaction txn, ContactId contactId) throws DbException;
|
Transaction txn, ContactId contactId) throws DbException;
|
||||||
|
|
||||||
boolean amCustodian(Transaction txn, ContactId contactId);
|
boolean amCustodian(Transaction txn, ContactId contactId);
|
||||||
|
|
||||||
|
ReturnShardPayload getReturnShardPayload(Transaction txn, ContactId contactId)
|
||||||
|
throws DbException;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user