Public interface of SocialBackupExchangeManager and Message encoder/parser

This commit is contained in:
ameba23
2021-03-31 16:00:57 +02:00
parent c155020064
commit 4f42ce9a01
4 changed files with 15 additions and 9 deletions

View File

@@ -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.briar.api.socialbackup.Shard;
@NotNullByDefault
interface MessageEncoder {
public interface MessageEncoder {
byte[] encodeShardMessage(Shard shard);
byte[] encodeBackupMessage(int version, org.briarproject.briar.api.socialbackup.BackupPayload payload);
byte[] encodeReturnShardPayload(ReturnShardPayload returnShardPayload);
}

View File

@@ -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.data.BdfList;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.briar.api.socialbackup.Shard;
@NotNullByDefault
interface MessageParser {
public interface MessageParser {
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;
}

View File

@@ -18,9 +18,9 @@ public interface SocialBackupExchangeManager {
* @throws IOException
* @throws DbException
*/
public void sendReturnShard(DuplexTransportConnection conn,
void sendReturnShard(DuplexTransportConnection conn,
SecretKey masterKey,
boolean verified) throws IOException, DbException;
boolean verified, ReturnShardPayload returnShardPayload) throws IOException, DbException;
/**
* Receive a returned shard and encrypted backup from a custodian
@@ -31,7 +31,7 @@ public interface SocialBackupExchangeManager {
* @throws IOException
* @throws DbException
*/
public ReturnShardPayload receiveReturnShard(DuplexTransportConnection conn,
ReturnShardPayload receiveReturnShard(DuplexTransportConnection conn,
SecretKey masterKey, boolean verified)
throws IOException, DbException;
}

View File

@@ -55,4 +55,7 @@ public interface SocialBackupManager extends
Transaction txn, ContactId contactId) throws DbException;
boolean amCustodian(Transaction txn, ContactId contactId);
ReturnShardPayload getReturnShardPayload(Transaction txn, ContactId contactId)
throws DbException;
}