mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
Use hex encoding for storing shards in shared preferences
This commit is contained in:
@@ -14,6 +14,7 @@ import org.briarproject.bramble.api.lifecycle.LifecycleManager;
|
|||||||
import org.briarproject.bramble.api.plugin.TransportId;
|
import org.briarproject.bramble.api.plugin.TransportId;
|
||||||
import org.briarproject.bramble.api.properties.TransportProperties;
|
import org.briarproject.bramble.api.properties.TransportProperties;
|
||||||
import org.briarproject.bramble.api.properties.TransportPropertyManager;
|
import org.briarproject.bramble.api.properties.TransportPropertyManager;
|
||||||
|
import org.briarproject.bramble.util.StringUtils;
|
||||||
import org.briarproject.briar.api.socialbackup.BackupPayload;
|
import org.briarproject.briar.api.socialbackup.BackupPayload;
|
||||||
import org.briarproject.briar.api.socialbackup.ContactData;
|
import org.briarproject.briar.api.socialbackup.ContactData;
|
||||||
import org.briarproject.briar.api.socialbackup.DarkCrystal;
|
import org.briarproject.briar.api.socialbackup.DarkCrystal;
|
||||||
@@ -168,7 +169,8 @@ public class RestoreAccountImpl implements RestoreAccount {
|
|||||||
LOG.info("Adding contact " + c.getAuthor().getName() +
|
LOG.info("Adding contact " + c.getAuthor().getName() +
|
||||||
" " + c.getAlias());
|
" " + c.getAlias());
|
||||||
if (c.getHandshakePublicKey() == null) {
|
if (c.getHandshakePublicKey() == null) {
|
||||||
LOG.warning("Warning: contact has no handshake public key");
|
LOG.warning(
|
||||||
|
"Warning: contact has no handshake public key");
|
||||||
}
|
}
|
||||||
ContactId contactId = contactManager
|
ContactId contactId = contactManager
|
||||||
.addContact(txn, c.getAuthor(), localAuthorId,
|
.addContact(txn, c.getAuthor(), localAuthorId,
|
||||||
@@ -202,7 +204,8 @@ public class RestoreAccountImpl implements RestoreAccount {
|
|||||||
public Set<String> getEncodedShards() {
|
public Set<String> getEncodedShards() {
|
||||||
Set<String> s = new HashSet();
|
Set<String> s = new HashSet();
|
||||||
for (ReturnShardPayload r : recoveredShards) {
|
for (ReturnShardPayload r : recoveredShards) {
|
||||||
s.add(new String(messageEncoder.encodeReturnShardPayload(r)));
|
s.add(StringUtils
|
||||||
|
.toHexString(messageEncoder.encodeReturnShardPayload(r)));
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@@ -211,8 +214,9 @@ public class RestoreAccountImpl implements RestoreAccount {
|
|||||||
for (String s : previousShards) {
|
for (String s : previousShards) {
|
||||||
try {
|
try {
|
||||||
addReturnShardPayload(messageParser.parseReturnShardPayload(
|
addReturnShardPayload(messageParser.parseReturnShardPayload(
|
||||||
clientHelper.toList(s.getBytes())));
|
clientHelper.toList(StringUtils.fromHexString(s))));
|
||||||
} catch (FormatException e) {
|
} catch (FormatException e) {
|
||||||
|
LOG.warning("Error parsing shard from previous session");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user