diff --git a/libaxolotl/protobuf/LocalStorageProtocol.proto b/libaxolotl/protobuf/LocalStorageProtocol.proto new file mode 100644 index 0000000000..f1a72a4125 --- /dev/null +++ b/libaxolotl/protobuf/LocalStorageProtocol.proto @@ -0,0 +1,70 @@ +package textsecure; + +option java_package = "org.whispersystems.libaxolotl.state"; +option java_outer_classname = "StorageProtos"; + +message SessionStructure { + message Chain { + optional bytes senderEphemeral = 1; + optional bytes senderEphemeralPrivate = 2; + + message ChainKey { + optional uint32 index = 1; + optional bytes key = 2; + } + + optional ChainKey chainKey = 3; + + message MessageKey { + optional uint32 index = 1; + optional bytes cipherKey = 2; + optional bytes macKey = 3; + } + + repeated MessageKey messageKeys = 4; + } + + message PendingKeyExchange { + optional uint32 sequence = 1; + optional bytes localBaseKey = 2; + optional bytes localBaseKeyPrivate = 3; + optional bytes localEphemeralKey = 4; + optional bytes localEphemeralKeyPrivate = 5; + optional bytes localIdentityKey = 7; + optional bytes localIdentityKeyPrivate = 8; + } + + message PendingPreKey { + optional uint32 preKeyId = 1; + optional bytes baseKey = 2; + } + + optional uint32 sessionVersion = 1; + optional bytes localIdentityPublic = 2; + optional bytes remoteIdentityPublic = 3; + + optional bytes rootKey = 4; + optional uint32 previousCounter = 5; + + optional Chain senderChain = 6; + repeated Chain receiverChains = 7; + + optional PendingKeyExchange pendingKeyExchange = 8; + optional PendingPreKey pendingPreKey = 9; + + optional uint32 remoteRegistrationId = 10; + optional uint32 localRegistrationId = 11; + + optional bool needsRefresh = 12; +} + +message RecordStructure { + optional SessionStructure currentSession = 1; + repeated SessionStructure previousSessions = 2; +} + +message PreKeyRecordStructure { + optional uint32 id = 1; + optional bytes publicKey = 2; + optional bytes privateKey = 3; +} \ No newline at end of file diff --git a/libaxolotl/protobuf/Makefile b/libaxolotl/protobuf/Makefile index fae3824f15..a57c1ee759 100644 --- a/libaxolotl/protobuf/Makefile +++ b/libaxolotl/protobuf/Makefile @@ -1,3 +1,3 @@ all: - protoc --java_out=../src/main/java/ WhisperTextProtocol.proto + protoc --java_out=../src/main/java/ WhisperTextProtocol.proto LocalStorageProtocol.proto diff --git a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemoryPreKeyStore.java b/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemoryPreKeyStore.java index ab14789bc6..bd8ebbc88f 100644 --- a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemoryPreKeyStore.java +++ b/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemoryPreKeyStore.java @@ -4,25 +4,30 @@ import org.whispersystems.libaxolotl.InvalidKeyIdException; import org.whispersystems.libaxolotl.state.PreKeyRecord; import org.whispersystems.libaxolotl.state.PreKeyStore; +import java.io.IOException; import java.util.HashMap; import java.util.Map; public class InMemoryPreKeyStore implements PreKeyStore { - private final Map store = new HashMap<>(); + private final Map store = new HashMap<>(); @Override public PreKeyRecord load(int preKeyId) throws InvalidKeyIdException { - if (!store.containsKey(preKeyId)) { - throw new InvalidKeyIdException("No such prekeyrecord!"); - } + try { + if (!store.containsKey(preKeyId)) { + throw new InvalidKeyIdException("No such prekeyrecord!"); + } - return store.get(preKeyId); + return new PreKeyRecord(store.get(preKeyId)); + } catch (IOException e) { + throw new AssertionError(e); + } } @Override public void store(int preKeyId, PreKeyRecord record) { - store.put(preKeyId, record); + store.put(preKeyId, record.serialize()); } @Override diff --git a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionRecord.java b/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionRecord.java deleted file mode 100644 index 3186253c18..0000000000 --- a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionRecord.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.whispersystems.test; - -import org.whispersystems.libaxolotl.state.SessionRecord; -import org.whispersystems.libaxolotl.state.SessionState; - -import java.util.LinkedList; -import java.util.List; - -public class InMemorySessionRecord implements SessionRecord { - - private SessionState currentSessionState; - private List previousSessionStates; - - public InMemorySessionRecord() { - currentSessionState = new InMemorySessionState(); - previousSessionStates = new LinkedList<>(); - } - - public InMemorySessionRecord(SessionRecord copy) { - currentSessionState = new InMemorySessionState(copy.getSessionState()); - previousSessionStates = new LinkedList<>(); - - for (SessionState previousState : copy.getPreviousSessionStates()) { - previousSessionStates.add(new InMemorySessionState(previousState)); - } - } - - @Override - public SessionState getSessionState() { - return currentSessionState; - } - - @Override - public List getPreviousSessionStates() { - return previousSessionStates; - } - - @Override - public void reset() { - this.currentSessionState = new InMemorySessionState(); - this.previousSessionStates = new LinkedList<>(); - } - - @Override - public void archiveCurrentState() { - this.previousSessionStates.add(currentSessionState); - this.currentSessionState = new InMemorySessionState(); - } - - @Override - public byte[] serialize() { - throw new AssertionError(); - } -} diff --git a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionState.java b/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionState.java deleted file mode 100644 index bf246bab0c..0000000000 --- a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionState.java +++ /dev/null @@ -1,402 +0,0 @@ -package org.whispersystems.test; - -import org.whispersystems.libaxolotl.IdentityKey; -import org.whispersystems.libaxolotl.IdentityKeyPair; -import org.whispersystems.libaxolotl.InvalidKeyException; -import org.whispersystems.libaxolotl.ecc.Curve; -import org.whispersystems.libaxolotl.ecc.ECKeyPair; -import org.whispersystems.libaxolotl.ecc.ECPrivateKey; -import org.whispersystems.libaxolotl.ecc.ECPublicKey; -import org.whispersystems.libaxolotl.ratchet.ChainKey; -import org.whispersystems.libaxolotl.ratchet.MessageKeys; -import org.whispersystems.libaxolotl.ratchet.RootKey; -import org.whispersystems.libaxolotl.state.SessionState; -import org.whispersystems.libaxolotl.util.Pair; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import javax.crypto.spec.SecretKeySpec; - -public class InMemorySessionState implements SessionState { - - private Map receiverChains = new HashMap<>(); - - private boolean needsRefresh; - private int sessionVersion; - private IdentityKey remoteIdentityKey; - private IdentityKey localIdentityKey; - private int previousCounter; - private RootKey rootKey; - private ECKeyPair senderEphemeral; - private ChainKey senderChainKey; - private int pendingPreKeyid; - private ECPublicKey pendingPreKey; - private int remoteRegistrationId; - private int localRegistrationId; - - private InMemoryPendingKeyExchange pendingKeyExchange; - - public InMemorySessionState() {} - - public InMemorySessionState(SessionState sessionState) { - try { - this.needsRefresh = sessionState.getNeedsRefresh(); - this.sessionVersion = sessionState.getSessionVersion(); - - if (sessionState.getRemoteIdentityKey() != null) { - this.remoteIdentityKey = new IdentityKey(sessionState.getRemoteIdentityKey().serialize(), 0); - } - - if (sessionState.getLocalIdentityKey() != null) { - this.localIdentityKey = new IdentityKey(sessionState.getLocalIdentityKey().serialize(), 0); - } - - this.previousCounter = sessionState.getPreviousCounter(); - - if (sessionState.getRootKey() != null) { - this.rootKey = new RootKey(sessionState.getRootKey().getKeyBytes()); - } - - this.senderEphemeral = sessionState.getSenderEphemeralPair(); - - if (sessionState.getSenderChainKey() != null) { - this.senderChainKey = new ChainKey(sessionState.getSenderChainKey().getKey(), - sessionState.getSenderChainKey().getIndex()); - } - - if (sessionState.getPendingPreKey() != null) { - this.pendingPreKeyid = sessionState.getPendingPreKey().first(); - } - - if (sessionState.getPendingPreKey() != null) { - this.pendingPreKey = sessionState.getPendingPreKey().second(); - } - - this.remoteRegistrationId = sessionState.getRemoteRegistrationId(); - this.localRegistrationId = sessionState.getLocalRegistrationId(); - - if (sessionState.hasPendingKeyExchange()) { - pendingKeyExchange = new InMemoryPendingKeyExchange(); - pendingKeyExchange.sequence = sessionState.getPendingKeyExchangeSequence(); - pendingKeyExchange.localBaseKey = sessionState.getPendingKeyExchangeBaseKey() - .getPublicKey().serialize(); - pendingKeyExchange.localBaseKeyPrivate = sessionState.getPendingKeyExchangeBaseKey() - .getPrivateKey().serialize(); - pendingKeyExchange.localEphemeralKey = sessionState.getPendingKeyExchangeEphemeralKey() - .getPublicKey().serialize(); - pendingKeyExchange.localEphemeralKeyPrivate = sessionState.getPendingKeyExchangeEphemeralKey() - .getPrivateKey().serialize(); - pendingKeyExchange.localIdentityKey = sessionState.getPendingKeyExchangeIdentityKey() - .getPublicKey().serialize(); - pendingKeyExchange.localIdentityKeyPrivate = sessionState.getPendingKeyExchangeIdentityKey() - .getPrivateKey().serialize(); - } - - for (ECPublicKey key : ((InMemorySessionState)sessionState).receiverChains.keySet()) { - ECPublicKey chainKey = Curve.decodePoint(key.serialize(), 0); - InMemoryChain ourChain = new InMemoryChain(); - InMemoryChain theirChain = ((InMemorySessionState)sessionState).receiverChains.get(key); - - ourChain.chainKey = theirChain.chainKey; - ourChain.index = theirChain.index; - ourChain.messageKeys = theirChain.messageKeys; - receiverChains.put(chainKey, ourChain); - } - } catch (InvalidKeyException e) { - throw new AssertionError(e); - } - } - - @Override - public void setNeedsRefresh(boolean needsRefresh) { - this.needsRefresh = needsRefresh; - } - - @Override - public boolean getNeedsRefresh() { - return needsRefresh; - } - - @Override - public void setSessionVersion(int version) { - this.sessionVersion = version; - } - - @Override - public int getSessionVersion() { - return sessionVersion; - } - - @Override - public void setRemoteIdentityKey(IdentityKey identityKey) { - this.remoteIdentityKey = identityKey; - } - - @Override - public void setLocalIdentityKey(IdentityKey identityKey) { - this.localIdentityKey = identityKey; - - } - - @Override - public IdentityKey getRemoteIdentityKey() { - return remoteIdentityKey; - } - - @Override - public IdentityKey getLocalIdentityKey() { - return localIdentityKey; - } - - @Override - public int getPreviousCounter() { - return previousCounter; - } - - @Override - public void setPreviousCounter(int previousCounter) { - this.previousCounter = previousCounter; - } - - @Override - public RootKey getRootKey() { - return rootKey; - } - - @Override - public void setRootKey(RootKey rootKey) { - this.rootKey = rootKey; - } - - @Override - public ECPublicKey getSenderEphemeral() { - return senderEphemeral.getPublicKey(); - } - - @Override - public ECKeyPair getSenderEphemeralPair() { - return senderEphemeral; - } - - @Override - public boolean hasReceiverChain(ECPublicKey senderEphemeral) { - return receiverChains.containsKey(senderEphemeral); - } - - @Override - public boolean hasSenderChain() { - return senderChainKey != null; - } - - @Override - public ChainKey getReceiverChainKey(ECPublicKey senderEphemeral) { - InMemoryChain chain = receiverChains.get(senderEphemeral); - return new ChainKey(chain.chainKey, chain.index); - } - - @Override - public void addReceiverChain(ECPublicKey senderEphemeral, ChainKey chainKey) { - InMemoryChain chain = new InMemoryChain(); - chain.chainKey = chainKey.getKey(); - chain.index = chainKey.getIndex(); - - receiverChains.put(senderEphemeral, chain); - } - - @Override - public void setSenderChain(ECKeyPair senderEphemeralPair, ChainKey chainKey) { - this.senderEphemeral = senderEphemeralPair; - this.senderChainKey = chainKey; - } - - @Override - public ChainKey getSenderChainKey() { - return senderChainKey; - } - - @Override - public void setSenderChainKey(ChainKey nextChainKey) { - this.senderChainKey = nextChainKey; - } - - @Override - public boolean hasMessageKeys(ECPublicKey senderEphemeral, int counter) { - InMemoryChain chain = receiverChains.get(senderEphemeral); - - if (chain == null) return false; - - for (InMemoryChain.InMemoryMessageKey messageKey : chain.messageKeys) { - if (messageKey.index == counter) { - return true; - } - } - - return false; - } - - @Override - public MessageKeys removeMessageKeys(ECPublicKey senderEphemeral, int counter) { - InMemoryChain chain = receiverChains.get(senderEphemeral); - MessageKeys results = null; - - if (chain == null) return null; - - Iterator iterator = chain.messageKeys.iterator(); - - while (iterator.hasNext()) { - InMemoryChain.InMemoryMessageKey messageKey = iterator.next(); - - if (messageKey.index == counter) { - results = new MessageKeys(new SecretKeySpec(messageKey.cipherKey, "AES"), - new SecretKeySpec(messageKey.macKey, "HmacSHA256"), - messageKey.index); - - iterator.remove(); - break; - } - } - - return results; - } - - @Override - public void setMessageKeys(ECPublicKey senderEphemeral, MessageKeys messageKeys) { - InMemoryChain chain = receiverChains.get(senderEphemeral); - InMemoryChain.InMemoryMessageKey key = new InMemoryChain.InMemoryMessageKey(); - - key.cipherKey = messageKeys.getCipherKey().getEncoded(); - key.macKey = messageKeys.getMacKey().getEncoded(); - key.index = messageKeys.getCounter(); - - chain.messageKeys.add(key); - } - - @Override - public void setReceiverChainKey(ECPublicKey senderEphemeral, ChainKey chainKey) { - InMemoryChain chain = receiverChains.get(senderEphemeral); - chain.chainKey = chainKey.getKey(); - chain.index = chainKey.getIndex(); - } - - @Override - public void setPendingKeyExchange(int sequence, ECKeyPair ourBaseKey, ECKeyPair ourEphemeralKey, - IdentityKeyPair ourIdentityKey) - { - pendingKeyExchange = new InMemoryPendingKeyExchange(); - pendingKeyExchange.sequence = sequence; - pendingKeyExchange.localBaseKey = ourBaseKey.getPublicKey().serialize(); - pendingKeyExchange.localBaseKeyPrivate = ourBaseKey.getPrivateKey().serialize(); - pendingKeyExchange.localEphemeralKey = ourEphemeralKey.getPublicKey().serialize(); - pendingKeyExchange.localEphemeralKeyPrivate = ourEphemeralKey.getPrivateKey().serialize(); - pendingKeyExchange.localIdentityKey = ourIdentityKey.getPublicKey().serialize(); - pendingKeyExchange.localIdentityKeyPrivate = ourIdentityKey.getPrivateKey().serialize(); - } - - @Override - public int getPendingKeyExchangeSequence() { - return pendingKeyExchange == null ? 0 : pendingKeyExchange.sequence; - } - - @Override - public ECKeyPair getPendingKeyExchangeBaseKey() throws InvalidKeyException { - ECPublicKey publicKey = Curve.decodePoint(pendingKeyExchange.localBaseKey, 0); - ECPrivateKey privateKey = Curve.decodePrivatePoint(pendingKeyExchange.localBaseKeyPrivate); - - return new ECKeyPair(publicKey, privateKey); - } - - @Override - public ECKeyPair getPendingKeyExchangeEphemeralKey() throws InvalidKeyException { - ECPublicKey publicKey = Curve.decodePoint(pendingKeyExchange.localEphemeralKey, 0); - ECPrivateKey privateKey = Curve.decodePrivatePoint(pendingKeyExchange.localEphemeralKeyPrivate); - - return new ECKeyPair(publicKey, privateKey); - } - - @Override - public IdentityKeyPair getPendingKeyExchangeIdentityKey() throws InvalidKeyException { - IdentityKey publicKey = new IdentityKey(pendingKeyExchange.localIdentityKey, 0); - ECPrivateKey privateKey = Curve.decodePrivatePoint(pendingKeyExchange.localIdentityKeyPrivate); - - return new IdentityKeyPair(publicKey, privateKey); - } - - @Override - public boolean hasPendingKeyExchange() { - return pendingKeyExchange != null; - } - - @Override - public void setPendingPreKey(int preKeyId, ECPublicKey baseKey) { - this.pendingPreKeyid = preKeyId; - this.pendingPreKey = baseKey; - } - - @Override - public boolean hasPendingPreKey() { - return this.pendingPreKey != null; - } - - @Override - public Pair getPendingPreKey() { - return new Pair<>(pendingPreKeyid, pendingPreKey); - } - - @Override - public void clearPendingPreKey() { - this.pendingPreKey = null; - this.pendingPreKeyid = -1; - } - - @Override - public void setRemoteRegistrationId(int registrationId) { - this.remoteRegistrationId = registrationId; - } - - @Override - public int getRemoteRegistrationId() { - return remoteRegistrationId; - } - - @Override - public void setLocalRegistrationId(int registrationId) { - this.localRegistrationId = registrationId; - } - - @Override - public int getLocalRegistrationId() { - return localRegistrationId; - } - - @Override - public byte[] serialize() { - throw new AssertionError(); - } - - private static class InMemoryChain { - byte[] chainKey; - int index; - List messageKeys = new LinkedList<>(); - - public static class InMemoryMessageKey { - public InMemoryMessageKey(){} - int index; - byte[] cipherKey; - byte[] macKey; - } - } - - private static class InMemoryPendingKeyExchange { - int sequence; - byte[] localBaseKey; - byte[] localBaseKeyPrivate; - byte[] localEphemeralKey; - byte[] localEphemeralKeyPrivate; - byte[] localIdentityKey; - byte[] localIdentityKeyPrivate; - } -} diff --git a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionStore.java b/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionStore.java index c6293c966d..fc282d1bde 100644 --- a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionStore.java +++ b/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionStore.java @@ -4,6 +4,7 @@ import org.whispersystems.libaxolotl.state.SessionRecord; import org.whispersystems.libaxolotl.state.SessionStore; import org.whispersystems.libaxolotl.util.Pair; +import java.io.IOException; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -11,16 +12,20 @@ import java.util.Map; public class InMemorySessionStore implements SessionStore { - private Map, SessionRecord> sessions = new HashMap<>(); + private Map, byte[]> sessions = new HashMap<>(); public InMemorySessionStore() {} @Override public synchronized SessionRecord load(long recipientId, int deviceId) { - if (contains(recipientId, deviceId)) { - return new InMemorySessionRecord(sessions.get(new Pair<>(recipientId, deviceId))); - } else { - return new InMemorySessionRecord(); + try { + if (contains(recipientId, deviceId)) { + return new SessionRecord(sessions.get(new Pair<>(recipientId, deviceId))); + } else { + return new SessionRecord(); + } + } catch (IOException e) { + throw new AssertionError(e); } } @@ -39,7 +44,7 @@ public class InMemorySessionStore implements SessionStore { @Override public synchronized void store(long recipientId, int deviceId, SessionRecord record) { - sessions.put(new Pair<>(recipientId, deviceId), record); + sessions.put(new Pair<>(recipientId, deviceId), record.serialize()); } @Override diff --git a/libaxolotl/src/androidTest/java/org/whispersystems/test/SessionBuilderTest.java b/libaxolotl/src/androidTest/java/org/whispersystems/test/SessionBuilderTest.java index b5761c7ed4..713ef573b3 100644 --- a/libaxolotl/src/androidTest/java/org/whispersystems/test/SessionBuilderTest.java +++ b/libaxolotl/src/androidTest/java/org/whispersystems/test/SessionBuilderTest.java @@ -220,16 +220,13 @@ public class SessionBuilderTest extends AndroidTestCase { } } - private class InMemoryPreKey implements PreKey, PreKeyRecord { + private class InMemoryPreKey extends PreKeyRecord implements PreKey { - private final int keyId; - private final ECKeyPair keyPair; private final IdentityKey identityKey; private final int registrationId; public InMemoryPreKey(int keyId, ECKeyPair keyPair, IdentityKey identityKey, int registrationId) { - this.keyId = keyId; - this.keyPair = keyPair; + super(keyId, keyPair); this.identityKey = identityKey; this.registrationId = registrationId; } @@ -241,12 +238,12 @@ public class SessionBuilderTest extends AndroidTestCase { @Override public int getKeyId() { - return keyId; + return getId(); } @Override public ECPublicKey getPublicKey() { - return keyPair.getPublicKey(); + return getKeyPair().getPublicKey(); } @Override @@ -258,21 +255,6 @@ public class SessionBuilderTest extends AndroidTestCase { public int getRegistrationId() { return registrationId; } - - @Override - public int getId() { - return keyId; - } - - @Override - public ECKeyPair getKeyPair() { - return keyPair; - } - - @Override - public byte[] serialize() { - throw new AssertionError("nyi"); - } } } diff --git a/libaxolotl/src/androidTest/java/org/whispersystems/test/SessionCipherTest.java b/libaxolotl/src/androidTest/java/org/whispersystems/test/SessionCipherTest.java index 721f9fe40d..38b51b1852 100644 --- a/libaxolotl/src/androidTest/java/org/whispersystems/test/SessionCipherTest.java +++ b/libaxolotl/src/androidTest/java/org/whispersystems/test/SessionCipherTest.java @@ -25,8 +25,8 @@ public class SessionCipherTest extends AndroidTestCase { throws InvalidKeyException, DuplicateMessageException, LegacyMessageException, InvalidMessageException { - SessionRecord aliceSessionRecord = new InMemorySessionRecord(); - SessionRecord bobSessionRecord = new InMemorySessionRecord(); + SessionRecord aliceSessionRecord = new SessionRecord(); + SessionRecord bobSessionRecord = new SessionRecord(); initializeSessions(aliceSessionRecord.getSessionState(), bobSessionRecord.getSessionState()); diff --git a/libaxolotl/src/androidTest/java/org/whispersystems/test/ratchet/RatchetingSessionTest.java b/libaxolotl/src/androidTest/java/org/whispersystems/test/ratchet/RatchetingSessionTest.java index d8a429a0e7..379204b20f 100644 --- a/libaxolotl/src/androidTest/java/org/whispersystems/test/ratchet/RatchetingSessionTest.java +++ b/libaxolotl/src/androidTest/java/org/whispersystems/test/ratchet/RatchetingSessionTest.java @@ -4,7 +4,6 @@ import android.test.AndroidTestCase; import org.whispersystems.libaxolotl.IdentityKey; import org.whispersystems.libaxolotl.IdentityKeyPair; -import org.whispersystems.test.InMemorySessionState; import org.whispersystems.libaxolotl.InvalidKeyException; import org.whispersystems.libaxolotl.state.SessionState; import org.whispersystems.libaxolotl.ecc.Curve; @@ -106,7 +105,7 @@ public class RatchetingSessionTest extends AndroidTestCase { ECPublicKey aliceEphemeralPublicKey = Curve.decodePoint(aliceEphemeralPublic, 0); IdentityKey aliceIdentityPublicKey = new IdentityKey(aliceIdentityPublic, 0); - SessionState session = new InMemorySessionState(); + SessionState session = new SessionState(); RatchetingSession.initializeSession(session, bobBaseKey, aliceBasePublicKey, bobEphemeralKey, aliceEphemeralPublicKey, @@ -203,7 +202,7 @@ public class RatchetingSessionTest extends AndroidTestCase { ECPrivateKey aliceIdentityPrivateKey = Curve.decodePrivatePoint(aliceIdentityPrivate); IdentityKeyPair aliceIdentityKey = new IdentityKeyPair(aliceIdentityPublicKey, aliceIdentityPrivateKey); - SessionState session = new InMemorySessionState(); + SessionState session = new SessionState(); RatchetingSession.initializeSession(session, aliceBaseKey, bobBasePublicKey, aliceEphemeralKey, bobEphemeralPublicKey, diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKeyRecord.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKeyRecord.java index 4df6b5d436..0ea905f447 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKeyRecord.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKeyRecord.java @@ -1,25 +1,51 @@ package org.whispersystems.libaxolotl.state; +import com.google.protobuf.ByteString; + +import org.whispersystems.libaxolotl.InvalidKeyException; +import org.whispersystems.libaxolotl.ecc.Curve; import org.whispersystems.libaxolotl.ecc.ECKeyPair; +import org.whispersystems.libaxolotl.ecc.ECPrivateKey; +import org.whispersystems.libaxolotl.ecc.ECPublicKey; -/** - * An interface describing a locally stored PreKey. - * - * @author Moxie Marlinspike - */ -public interface PreKeyRecord { - /** - * @return the PreKey's ID. - */ - public int getId(); +import java.io.IOException; - /** - * @return the PreKey's key pair. - */ - public ECKeyPair getKeyPair(); +import static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure; - /** - * @return a serialized version of this PreKey. - */ - public byte[] serialize(); +public class PreKeyRecord { + + private PreKeyRecordStructure structure; + + public PreKeyRecord(int id, ECKeyPair keyPair) { + this.structure = PreKeyRecordStructure.newBuilder() + .setId(id) + .setPublicKey(ByteString.copyFrom(keyPair.getPublicKey() + .serialize())) + .setPrivateKey(ByteString.copyFrom(keyPair.getPrivateKey() + .serialize())) + .build(); + } + + public PreKeyRecord(byte[] serialized) throws IOException { + this.structure = PreKeyRecordStructure.parseFrom(serialized); + } + + public int getId() { + return this.structure.getId(); + } + + public ECKeyPair getKeyPair() { + try { + ECPublicKey publicKey = Curve.decodePoint(this.structure.getPublicKey().toByteArray(), 0); + ECPrivateKey privateKey = Curve.decodePrivatePoint(this.structure.getPrivateKey().toByteArray()); + + return new ECKeyPair(publicKey, privateKey); + } catch (InvalidKeyException e) { + throw new AssertionError(e); + } + } + + public byte[] serialize() { + return this.structure.toByteArray(); + } } diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionRecord.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionRecord.java index 2a8bf977ac..8cfbbe9c4e 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionRecord.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionRecord.java @@ -1,45 +1,84 @@ package org.whispersystems.libaxolotl.state; +import java.io.IOException; +import java.util.LinkedList; import java.util.List; +import static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure; +import static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure; + /** * A SessionRecord encapsulates the state of an ongoing session. - *

- * It contains the current {@link org.whispersystems.libaxolotl.state.SessionState}, - * in addition to previous {@link SessionState}s for the same recipient, which need - * to be maintained in some situations. * * @author Moxie Marlinspike */ -public interface SessionRecord { +public class SessionRecord { - /** - * @return the current {@link org.whispersystems.libaxolotl.state.SessionState} - */ - public SessionState getSessionState(); + private SessionState sessionState = new SessionState(); + private List previousStates = new LinkedList<>(); + + public SessionRecord() {} + + public SessionRecord(SessionState sessionState) { + this.sessionState = sessionState; + } + + public SessionRecord(byte[] serialized) throws IOException { + RecordStructure record = RecordStructure.parseFrom(serialized); + this.sessionState = new SessionState(record.getCurrentSession()); + + for (SessionStructure previousStructure : record.getPreviousSessionsList()) { + previousStates.add(new SessionState(previousStructure)); + } + } + + public SessionState getSessionState() { + return sessionState; + } /** * @return the list of all currently maintained "previous" session states. */ - public List getPreviousSessionStates(); + public List getPreviousSessionStates() { + return previousStates; + } /** * Reset the current SessionRecord, clearing all "previous" session states, * and resetting the current {@link org.whispersystems.libaxolotl.state.SessionState} * to a fresh state. */ - public void reset(); + public void reset() { + this.sessionState = new SessionState(); + this.previousStates = new LinkedList<>(); + } /** * Move the current {@link SessionState} into the list of "previous" session states, * and replace the current {@link org.whispersystems.libaxolotl.state.SessionState} * with a fresh reset instance. */ - public void archiveCurrentState(); + public void archiveCurrentState() { + this.previousStates.add(sessionState); + this.sessionState = new SessionState(); + } /** * @return a serialized version of the current SessionRecord. */ - public byte[] serialize(); + public byte[] serialize() { + List previousStructures = new LinkedList<>(); + + for (SessionState previousState : previousStates) { + previousStructures.add(previousState.getStructure()); + } + + RecordStructure record = RecordStructure.newBuilder() + .setCurrentSession(sessionState.getStructure()) + .addAllPreviousSessions(previousStructures) + .build(); + + return record.toByteArray(); + } } diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionState.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionState.java index 53720008cc..8555721822 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionState.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionState.java @@ -1,62 +1,453 @@ +/** + * Copyright (C) 2014 Open Whisper Systems + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package org.whispersystems.libaxolotl.state; +import android.util.Log; + +import com.google.protobuf.ByteString; + import org.whispersystems.libaxolotl.IdentityKey; import org.whispersystems.libaxolotl.IdentityKeyPair; import org.whispersystems.libaxolotl.InvalidKeyException; +import org.whispersystems.libaxolotl.ecc.Curve; import org.whispersystems.libaxolotl.ecc.ECKeyPair; +import org.whispersystems.libaxolotl.ecc.ECPrivateKey; import org.whispersystems.libaxolotl.ecc.ECPublicKey; import org.whispersystems.libaxolotl.ratchet.ChainKey; import org.whispersystems.libaxolotl.ratchet.MessageKeys; import org.whispersystems.libaxolotl.ratchet.RootKey; import org.whispersystems.libaxolotl.util.Pair; +import org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain; +import org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange; +import org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import javax.crypto.spec.SecretKeySpec; + +import static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure; + +public class SessionState { + + private SessionStructure sessionStructure; + + public SessionState() { + this.sessionStructure = SessionStructure.newBuilder().build(); + } + + public SessionState(SessionStructure sessionStructure) { + this.sessionStructure = sessionStructure; + } + + public SessionStructure getStructure() { + return sessionStructure; + } + + public void setNeedsRefresh(boolean needsRefresh) { + this.sessionStructure = this.sessionStructure.toBuilder() + .setNeedsRefresh(needsRefresh) + .build(); + } + + public boolean getNeedsRefresh() { + return this.sessionStructure.getNeedsRefresh(); + } + + public void setSessionVersion(int version) { + this.sessionStructure = this.sessionStructure.toBuilder() + .setSessionVersion(version) + .build(); + } + + public int getSessionVersion() { + return this.sessionStructure.getSessionVersion(); + } + + public void setRemoteIdentityKey(IdentityKey identityKey) { + this.sessionStructure = this.sessionStructure.toBuilder() + .setRemoteIdentityPublic(ByteString.copyFrom(identityKey.serialize())) + .build(); + } + + public void setLocalIdentityKey(IdentityKey identityKey) { + this.sessionStructure = this.sessionStructure.toBuilder() + .setLocalIdentityPublic(ByteString.copyFrom(identityKey.serialize())) + .build(); + } + + public IdentityKey getRemoteIdentityKey() { + try { + if (!this.sessionStructure.hasRemoteIdentityPublic()) { + return null; + } + + return new IdentityKey(this.sessionStructure.getRemoteIdentityPublic().toByteArray(), 0); + } catch (InvalidKeyException e) { + Log.w("SessionRecordV2", e); + return null; + } + } + + public IdentityKey getLocalIdentityKey() { + try { + return new IdentityKey(this.sessionStructure.getLocalIdentityPublic().toByteArray(), 0); + } catch (InvalidKeyException e) { + throw new AssertionError(e); + } + } + + public int getPreviousCounter() { + return sessionStructure.getPreviousCounter(); + } + + public void setPreviousCounter(int previousCounter) { + this.sessionStructure = this.sessionStructure.toBuilder() + .setPreviousCounter(previousCounter) + .build(); + } + + public RootKey getRootKey() { + return new RootKey(this.sessionStructure.getRootKey().toByteArray()); + } + + public void setRootKey(RootKey rootKey) { + this.sessionStructure = this.sessionStructure.toBuilder() + .setRootKey(ByteString.copyFrom(rootKey.getKeyBytes())) + .build(); + } + + public ECPublicKey getSenderEphemeral() { + try { + return Curve.decodePoint(sessionStructure.getSenderChain().getSenderEphemeral().toByteArray(), 0); + } catch (InvalidKeyException e) { + throw new AssertionError(e); + } + } + + public ECKeyPair getSenderEphemeralPair() { + ECPublicKey publicKey = getSenderEphemeral(); + ECPrivateKey privateKey = Curve.decodePrivatePoint(sessionStructure.getSenderChain() + .getSenderEphemeralPrivate() + .toByteArray()); + + return new ECKeyPair(publicKey, privateKey); + } + + public boolean hasReceiverChain(ECPublicKey senderEphemeral) { + return getReceiverChain(senderEphemeral) != null; + } + + public boolean hasSenderChain() { + return sessionStructure.hasSenderChain(); + } + + private Pair getReceiverChain(ECPublicKey senderEphemeral) { + List receiverChains = sessionStructure.getReceiverChainsList(); + int index = 0; + + for (Chain receiverChain : receiverChains) { + try { + ECPublicKey chainSenderEphemeral = Curve.decodePoint(receiverChain.getSenderEphemeral().toByteArray(), 0); + + if (chainSenderEphemeral.equals(senderEphemeral)) { + return new Pair(receiverChain,index); + } + } catch (InvalidKeyException e) { + Log.w("SessionRecordV2", e); + } + + index++; + } + + return null; + } + + public ChainKey getReceiverChainKey(ECPublicKey senderEphemeral) { + Pair receiverChainAndIndex = getReceiverChain(senderEphemeral); + Chain receiverChain = receiverChainAndIndex.first(); + + if (receiverChain == null) { + return null; + } else { + return new ChainKey(receiverChain.getChainKey().getKey().toByteArray(), + receiverChain.getChainKey().getIndex()); + } + } + + public void addReceiverChain(ECPublicKey senderEphemeral, ChainKey chainKey) { + Chain.ChainKey chainKeyStructure = Chain.ChainKey.newBuilder() + .setKey(ByteString.copyFrom(chainKey.getKey())) + .setIndex(chainKey.getIndex()) + .build(); + + Chain chain = Chain.newBuilder() + .setChainKey(chainKeyStructure) + .setSenderEphemeral(ByteString.copyFrom(senderEphemeral.serialize())) + .build(); + + this.sessionStructure = this.sessionStructure.toBuilder().addReceiverChains(chain).build(); + + if (this.sessionStructure.getReceiverChainsList().size() > 5) { + this.sessionStructure = this.sessionStructure.toBuilder() + .removeReceiverChains(0) + .build(); + } + } + + public void setSenderChain(ECKeyPair senderEphemeralPair, ChainKey chainKey) { + Chain.ChainKey chainKeyStructure = Chain.ChainKey.newBuilder() + .setKey(ByteString.copyFrom(chainKey.getKey())) + .setIndex(chainKey.getIndex()) + .build(); + + Chain senderChain = Chain.newBuilder() + .setSenderEphemeral(ByteString.copyFrom(senderEphemeralPair.getPublicKey().serialize())) + .setSenderEphemeralPrivate(ByteString.copyFrom(senderEphemeralPair.getPrivateKey().serialize())) + .setChainKey(chainKeyStructure) + .build(); + + this.sessionStructure = this.sessionStructure.toBuilder().setSenderChain(senderChain).build(); + } + + public ChainKey getSenderChainKey() { + Chain.ChainKey chainKeyStructure = sessionStructure.getSenderChain().getChainKey(); + return new ChainKey(chainKeyStructure.getKey().toByteArray(), chainKeyStructure.getIndex()); + } + + + public void setSenderChainKey(ChainKey nextChainKey) { + Chain.ChainKey chainKey = Chain.ChainKey.newBuilder() + .setKey(ByteString.copyFrom(nextChainKey.getKey())) + .setIndex(nextChainKey.getIndex()) + .build(); + + Chain chain = sessionStructure.getSenderChain().toBuilder() + .setChainKey(chainKey).build(); + + this.sessionStructure = this.sessionStructure.toBuilder().setSenderChain(chain).build(); + } + + public boolean hasMessageKeys(ECPublicKey senderEphemeral, int counter) { + Pair chainAndIndex = getReceiverChain(senderEphemeral); + Chain chain = chainAndIndex.first(); + + if (chain == null) { + return false; + } + + List messageKeyList = chain.getMessageKeysList(); + + for (Chain.MessageKey messageKey : messageKeyList) { + if (messageKey.getIndex() == counter) { + return true; + } + } + + return false; + } + + public MessageKeys removeMessageKeys(ECPublicKey senderEphemeral, int counter) { + Pair chainAndIndex = getReceiverChain(senderEphemeral); + Chain chain = chainAndIndex.first(); + + if (chain == null) { + return null; + } + + List messageKeyList = new LinkedList(chain.getMessageKeysList()); + Iterator messageKeyIterator = messageKeyList.iterator(); + MessageKeys result = null; + + while (messageKeyIterator.hasNext()) { + Chain.MessageKey messageKey = messageKeyIterator.next(); + + if (messageKey.getIndex() == counter) { + result = new MessageKeys(new SecretKeySpec(messageKey.getCipherKey().toByteArray(), "AES"), + new SecretKeySpec(messageKey.getMacKey().toByteArray(), "HmacSHA256"), + messageKey.getIndex()); + + messageKeyIterator.remove(); + break; + } + } + + Chain updatedChain = chain.toBuilder().clearMessageKeys() + .addAllMessageKeys(messageKeyList) + .build(); + + this.sessionStructure = this.sessionStructure.toBuilder() + .setReceiverChains(chainAndIndex.second(), updatedChain) + .build(); + + return result; + } + + public void setMessageKeys(ECPublicKey senderEphemeral, MessageKeys messageKeys) { + Pair chainAndIndex = getReceiverChain(senderEphemeral); + Chain chain = chainAndIndex.first(); + Chain.MessageKey messageKeyStructure = Chain.MessageKey.newBuilder() + .setCipherKey(ByteString.copyFrom(messageKeys.getCipherKey().getEncoded())) + .setMacKey(ByteString.copyFrom(messageKeys.getMacKey().getEncoded())) + .setIndex(messageKeys.getCounter()) + .build(); + + Chain updatedChain = chain.toBuilder() + .addMessageKeys(messageKeyStructure) + .build(); + + this.sessionStructure = this.sessionStructure.toBuilder() + .setReceiverChains(chainAndIndex.second(), updatedChain) + .build(); + } + + public void setReceiverChainKey(ECPublicKey senderEphemeral, ChainKey chainKey) { + Pair chainAndIndex = getReceiverChain(senderEphemeral); + Chain chain = chainAndIndex.first(); + + Chain.ChainKey chainKeyStructure = Chain.ChainKey.newBuilder() + .setKey(ByteString.copyFrom(chainKey.getKey())) + .setIndex(chainKey.getIndex()) + .build(); + + Chain updatedChain = chain.toBuilder().setChainKey(chainKeyStructure).build(); + + this.sessionStructure = this.sessionStructure.toBuilder() + .setReceiverChains(chainAndIndex.second(), updatedChain) + .build(); + } -/** - * The current session state. - * - * @author Moxie Marlinspike - */ -public interface SessionState { - public void setNeedsRefresh(boolean needsRefresh); - public boolean getNeedsRefresh(); - public void setSessionVersion(int version); - public int getSessionVersion(); - public void setRemoteIdentityKey(IdentityKey identityKey); - public void setLocalIdentityKey(IdentityKey identityKey); - public IdentityKey getRemoteIdentityKey(); - public IdentityKey getLocalIdentityKey(); - public int getPreviousCounter(); - public void setPreviousCounter(int previousCounter); - public RootKey getRootKey(); - public void setRootKey(RootKey rootKey); - public ECPublicKey getSenderEphemeral(); - public ECKeyPair getSenderEphemeralPair(); - public boolean hasReceiverChain(ECPublicKey senderEphemeral); - public boolean hasSenderChain(); - public ChainKey getReceiverChainKey(ECPublicKey senderEphemeral); - public void addReceiverChain(ECPublicKey senderEphemeral, ChainKey chainKey); - public void setSenderChain(ECKeyPair senderEphemeralPair, ChainKey chainKey); - public ChainKey getSenderChainKey(); - public void setSenderChainKey(ChainKey nextChainKey); - public boolean hasMessageKeys(ECPublicKey senderEphemeral, int counter); - public MessageKeys removeMessageKeys(ECPublicKey senderEphemeral, int counter); - public void setMessageKeys(ECPublicKey senderEphemeral, MessageKeys messageKeys); - public void setReceiverChainKey(ECPublicKey senderEphemeral, ChainKey chainKey); public void setPendingKeyExchange(int sequence, ECKeyPair ourBaseKey, ECKeyPair ourEphemeralKey, - IdentityKeyPair ourIdentityKey); - public int getPendingKeyExchangeSequence(); - public ECKeyPair getPendingKeyExchangeBaseKey() throws InvalidKeyException; - public ECKeyPair getPendingKeyExchangeEphemeralKey() throws InvalidKeyException; - public IdentityKeyPair getPendingKeyExchangeIdentityKey() throws InvalidKeyException; - public boolean hasPendingKeyExchange(); - public void setPendingPreKey(int preKeyId, ECPublicKey baseKey); - public boolean hasPendingPreKey(); - public Pair getPendingPreKey(); - public void clearPendingPreKey(); - public void setRemoteRegistrationId(int registrationId); - public int getRemoteRegistrationId(); - public void setLocalRegistrationId(int registrationId); - public int getLocalRegistrationId(); - public byte[] serialize(); + IdentityKeyPair ourIdentityKey) + { + PendingKeyExchange structure = + PendingKeyExchange.newBuilder() + .setSequence(sequence) + .setLocalBaseKey(ByteString.copyFrom(ourBaseKey.getPublicKey().serialize())) + .setLocalBaseKeyPrivate(ByteString.copyFrom(ourBaseKey.getPrivateKey().serialize())) + .setLocalEphemeralKey(ByteString.copyFrom(ourEphemeralKey.getPublicKey().serialize())) + .setLocalEphemeralKeyPrivate(ByteString.copyFrom(ourEphemeralKey.getPrivateKey().serialize())) + .setLocalIdentityKey(ByteString.copyFrom(ourIdentityKey.getPublicKey().serialize())) + .setLocalIdentityKeyPrivate(ByteString.copyFrom(ourIdentityKey.getPrivateKey().serialize())) + .build(); + + this.sessionStructure = this.sessionStructure.toBuilder() + .setPendingKeyExchange(structure) + .build(); + } + + public int getPendingKeyExchangeSequence() { + return sessionStructure.getPendingKeyExchange().getSequence(); + } + + public ECKeyPair getPendingKeyExchangeBaseKey() throws InvalidKeyException { + ECPublicKey publicKey = Curve.decodePoint(sessionStructure.getPendingKeyExchange() + .getLocalBaseKey().toByteArray(), 0); + + ECPrivateKey privateKey = Curve.decodePrivatePoint(sessionStructure.getPendingKeyExchange() + .getLocalBaseKeyPrivate() + .toByteArray()); + + return new ECKeyPair(publicKey, privateKey); + } + + public ECKeyPair getPendingKeyExchangeEphemeralKey() throws InvalidKeyException { + ECPublicKey publicKey = Curve.decodePoint(sessionStructure.getPendingKeyExchange() + .getLocalEphemeralKey().toByteArray(), 0); + + ECPrivateKey privateKey = Curve.decodePrivatePoint(sessionStructure.getPendingKeyExchange() + .getLocalEphemeralKeyPrivate() + .toByteArray()); + + return new ECKeyPair(publicKey, privateKey); + } + + public IdentityKeyPair getPendingKeyExchangeIdentityKey() throws InvalidKeyException { + IdentityKey publicKey = new IdentityKey(sessionStructure.getPendingKeyExchange() + .getLocalIdentityKey().toByteArray(), 0); + + ECPrivateKey privateKey = Curve.decodePrivatePoint(sessionStructure.getPendingKeyExchange() + .getLocalIdentityKeyPrivate() + .toByteArray()); + + return new IdentityKeyPair(publicKey, privateKey); + } + + public boolean hasPendingKeyExchange() { + return sessionStructure.hasPendingKeyExchange(); + } + + public void setPendingPreKey(int preKeyId, ECPublicKey baseKey) { + PendingPreKey pending = PendingPreKey.newBuilder() + .setPreKeyId(preKeyId) + .setBaseKey(ByteString.copyFrom(baseKey.serialize())) + .build(); + + this.sessionStructure = this.sessionStructure.toBuilder() + .setPendingPreKey(pending) + .build(); + } + + public boolean hasPendingPreKey() { + return this.sessionStructure.hasPendingPreKey(); + } + + public Pair getPendingPreKey() { + try { + return new Pair(sessionStructure.getPendingPreKey().getPreKeyId(), + Curve.decodePoint(sessionStructure.getPendingPreKey() + .getBaseKey() + .toByteArray(), 0)); + } catch (InvalidKeyException e) { + throw new AssertionError(e); + } + } + + public void clearPendingPreKey() { + this.sessionStructure = this.sessionStructure.toBuilder() + .clearPendingPreKey() + .build(); + } + + public void setRemoteRegistrationId(int registrationId) { + this.sessionStructure = this.sessionStructure.toBuilder() + .setRemoteRegistrationId(registrationId) + .build(); + } + + public int getRemoteRegistrationId() { + return this.sessionStructure.getRemoteRegistrationId(); + } + + public void setLocalRegistrationId(int registrationId) { + this.sessionStructure = this.sessionStructure.toBuilder() + .setLocalRegistrationId(registrationId) + .build(); + } + + public int getLocalRegistrationId() { + return this.sessionStructure.getLocalRegistrationId(); + } + + public byte[] serialize() { + return sessionStructure.toByteArray(); + } } diff --git a/library/src/org/whispersystems/textsecure/storage/StorageProtos.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/StorageProtos.java similarity index 76% rename from library/src/org/whispersystems/textsecure/storage/StorageProtos.java rename to libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/StorageProtos.java index aac61042fc..d09c3c9021 100644 --- a/library/src/org/whispersystems/textsecure/storage/StorageProtos.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/StorageProtos.java @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: LocalStorageProtocol.proto -package org.whispersystems.textsecure.storage; +package org.whispersystems.libaxolotl.state; public final class StorageProtos { private StorageProtos() {} @@ -33,28 +33,28 @@ public final class StorageProtos { // optional .textsecure.SessionStructure.Chain senderChain = 6; boolean hasSenderChain(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain getSenderChain(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder getSenderChainOrBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getSenderChain(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder getSenderChainOrBuilder(); // repeated .textsecure.SessionStructure.Chain receiverChains = 7; - java.util.List + java.util.List getReceiverChainsList(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain getReceiverChains(int index); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getReceiverChains(int index); int getReceiverChainsCount(); - java.util.List + java.util.List getReceiverChainsOrBuilderList(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder getReceiverChainsOrBuilder( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder getReceiverChainsOrBuilder( int index); // optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; boolean hasPendingKeyExchange(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange getPendingKeyExchange(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder getPendingKeyExchangeOrBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange getPendingKeyExchange(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder getPendingKeyExchangeOrBuilder(); // optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; boolean hasPendingPreKey(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey getPendingPreKey(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKeyOrBuilder getPendingPreKeyOrBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey getPendingPreKey(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder getPendingPreKeyOrBuilder(); // optional uint32 remoteRegistrationId = 10; boolean hasRemoteRegistrationId(); @@ -88,12 +88,12 @@ public final class StorageProtos { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_fieldAccessorTable; } public interface ChainOrBuilder @@ -109,17 +109,17 @@ public final class StorageProtos { // optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; boolean hasChainKey(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey getChainKey(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder getChainKeyOrBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey getChainKey(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder getChainKeyOrBuilder(); // repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; - java.util.List + java.util.List getMessageKeysList(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey getMessageKeys(int index); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey getMessageKeys(int index); int getMessageKeysCount(); - java.util.List + java.util.List getMessageKeysOrBuilderList(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder getMessageKeysOrBuilder( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder getMessageKeysOrBuilder( int index); } public static final class Chain extends @@ -142,12 +142,12 @@ public final class StorageProtos { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_Chain_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_Chain_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_fieldAccessorTable; } public interface ChainKeyOrBuilder @@ -181,12 +181,12 @@ public final class StorageProtos { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_fieldAccessorTable; } private int bitField0_; @@ -261,41 +261,41 @@ public final class StorageProtos { return super.writeReplace(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey parseFrom(byte[] data) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey parseFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey parseDelimitedFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { @@ -304,7 +304,7 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey parseDelimitedFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -315,12 +315,12 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -330,7 +330,7 @@ public final class StorageProtos { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey prototype) { + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -343,18 +343,18 @@ public final class StorageProtos { } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder { + implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_fieldAccessorTable; } - // Construct using org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.newBuilder() + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -386,24 +386,24 @@ public final class StorageProtos { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.getDescriptor(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey getDefaultInstanceForType() { - return org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance(); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey build() { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey result = buildPartial(); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey build() { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey buildParsed() + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey result = buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); @@ -411,8 +411,8 @@ public final class StorageProtos { return result; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey buildPartial() { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey result = new org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey(this); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey buildPartial() { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey result = new org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { @@ -429,16 +429,16 @@ public final class StorageProtos { } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey) { - return mergeFrom((org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey)other); + if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey) { + return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey other) { - if (other == org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance()) return this; + public Builder mergeFrom(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey other) { + if (other == org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance()) return this; if (other.hasIndex()) { setIndex(other.getIndex()); } @@ -583,12 +583,12 @@ public final class StorageProtos { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_fieldAccessorTable; } private int bitField0_; @@ -681,41 +681,41 @@ public final class StorageProtos { return super.writeReplace(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey parseFrom(byte[] data) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey parseFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey parseDelimitedFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { @@ -724,7 +724,7 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey parseDelimitedFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -735,12 +735,12 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -750,7 +750,7 @@ public final class StorageProtos { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey prototype) { + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -763,18 +763,18 @@ public final class StorageProtos { } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder { + implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_fieldAccessorTable; } - // Construct using org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.newBuilder() + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -808,24 +808,24 @@ public final class StorageProtos { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.getDescriptor(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey getDefaultInstanceForType() { - return org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.getDefaultInstance(); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.getDefaultInstance(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey build() { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey result = buildPartial(); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey build() { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey buildParsed() + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey result = buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); @@ -833,8 +833,8 @@ public final class StorageProtos { return result; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey buildPartial() { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey result = new org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey(this); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey buildPartial() { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey result = new org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { @@ -855,16 +855,16 @@ public final class StorageProtos { } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey) { - return mergeFrom((org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey)other); + if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey) { + return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey other) { - if (other == org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.getDefaultInstance()) return this; + public Builder mergeFrom(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey other) { + if (other == org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.getDefaultInstance()) return this; if (other.hasIndex()) { setIndex(other.getIndex()); } @@ -1029,34 +1029,34 @@ public final class StorageProtos { // optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; public static final int CHAINKEY_FIELD_NUMBER = 3; - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey chainKey_; + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey chainKey_; public boolean hasChainKey() { return ((bitField0_ & 0x00000004) == 0x00000004); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey getChainKey() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey getChainKey() { return chainKey_; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder getChainKeyOrBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder getChainKeyOrBuilder() { return chainKey_; } // repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; public static final int MESSAGEKEYS_FIELD_NUMBER = 4; - private java.util.List messageKeys_; - public java.util.List getMessageKeysList() { + private java.util.List messageKeys_; + public java.util.List getMessageKeysList() { return messageKeys_; } - public java.util.List + public java.util.List getMessageKeysOrBuilderList() { return messageKeys_; } public int getMessageKeysCount() { return messageKeys_.size(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey getMessageKeys(int index) { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey getMessageKeys(int index) { return messageKeys_.get(index); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder getMessageKeysOrBuilder( + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder getMessageKeysOrBuilder( int index) { return messageKeys_.get(index); } @@ -1064,7 +1064,7 @@ public final class StorageProtos { private void initFields() { senderEphemeral_ = com.google.protobuf.ByteString.EMPTY; senderEphemeralPrivate_ = com.google.protobuf.ByteString.EMPTY; - chainKey_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance(); + chainKey_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance(); messageKeys_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; @@ -1128,41 +1128,41 @@ public final class StorageProtos { return super.writeReplace(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain parseFrom(byte[] data) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain parseFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain parseDelimitedFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { @@ -1171,7 +1171,7 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain parseDelimitedFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -1182,12 +1182,12 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -1197,7 +1197,7 @@ public final class StorageProtos { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain prototype) { + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -1210,18 +1210,18 @@ public final class StorageProtos { } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder { + implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_Chain_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_Chain_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_fieldAccessorTable; } - // Construct using org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.newBuilder() + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -1247,7 +1247,7 @@ public final class StorageProtos { senderEphemeralPrivate_ = com.google.protobuf.ByteString.EMPTY; bitField0_ = (bitField0_ & ~0x00000002); if (chainKeyBuilder_ == null) { - chainKey_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance(); + chainKey_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance(); } else { chainKeyBuilder_.clear(); } @@ -1267,24 +1267,24 @@ public final class StorageProtos { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDescriptor(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain getDefaultInstanceForType() { - return org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.getDefaultInstance(); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain build() { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain result = buildPartial(); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain build() { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain buildParsed() + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain result = buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); @@ -1292,8 +1292,8 @@ public final class StorageProtos { return result; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain buildPartial() { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain result = new org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain(this); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain buildPartial() { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain result = new org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { @@ -1327,16 +1327,16 @@ public final class StorageProtos { } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain) { - return mergeFrom((org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain)other); + if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain) { + return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain other) { - if (other == org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.getDefaultInstance()) return this; + public Builder mergeFrom(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain other) { + if (other == org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance()) return this; if (other.hasSenderEphemeral()) { setSenderEphemeral(other.getSenderEphemeral()); } @@ -1414,7 +1414,7 @@ public final class StorageProtos { break; } case 26: { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.Builder subBuilder = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.newBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.newBuilder(); if (hasChainKey()) { subBuilder.mergeFrom(getChainKey()); } @@ -1423,7 +1423,7 @@ public final class StorageProtos { break; } case 34: { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.Builder subBuilder = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.newBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.newBuilder(); input.readMessage(subBuilder, extensionRegistry); addMessageKeys(subBuilder.buildPartial()); break; @@ -1483,20 +1483,20 @@ public final class StorageProtos { } // optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey chainKey_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance(); + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey chainKey_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder> chainKeyBuilder_; + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder> chainKeyBuilder_; public boolean hasChainKey() { return ((bitField0_ & 0x00000004) == 0x00000004); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey getChainKey() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey getChainKey() { if (chainKeyBuilder_ == null) { return chainKey_; } else { return chainKeyBuilder_.getMessage(); } } - public Builder setChainKey(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey value) { + public Builder setChainKey(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey value) { if (chainKeyBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -1510,7 +1510,7 @@ public final class StorageProtos { return this; } public Builder setChainKey( - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.Builder builderForValue) { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder builderForValue) { if (chainKeyBuilder_ == null) { chainKey_ = builderForValue.build(); onChanged(); @@ -1520,12 +1520,12 @@ public final class StorageProtos { bitField0_ |= 0x00000004; return this; } - public Builder mergeChainKey(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey value) { + public Builder mergeChainKey(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey value) { if (chainKeyBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004) && - chainKey_ != org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance()) { + chainKey_ != org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance()) { chainKey_ = - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.newBuilder(chainKey_).mergeFrom(value).buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.newBuilder(chainKey_).mergeFrom(value).buildPartial(); } else { chainKey_ = value; } @@ -1538,7 +1538,7 @@ public final class StorageProtos { } public Builder clearChainKey() { if (chainKeyBuilder_ == null) { - chainKey_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance(); + chainKey_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance(); onChanged(); } else { chainKeyBuilder_.clear(); @@ -1546,12 +1546,12 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000004); return this; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.Builder getChainKeyBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder getChainKeyBuilder() { bitField0_ |= 0x00000004; onChanged(); return getChainKeyFieldBuilder().getBuilder(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder getChainKeyOrBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder getChainKeyOrBuilder() { if (chainKeyBuilder_ != null) { return chainKeyBuilder_.getMessageOrBuilder(); } else { @@ -1559,11 +1559,11 @@ public final class StorageProtos { } } private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder> + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder> getChainKeyFieldBuilder() { if (chainKeyBuilder_ == null) { chainKeyBuilder_ = new com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder>( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder>( chainKey_, getParentForChildren(), isClean()); @@ -1573,19 +1573,19 @@ public final class StorageProtos { } // repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; - private java.util.List messageKeys_ = + private java.util.List messageKeys_ = java.util.Collections.emptyList(); private void ensureMessageKeysIsMutable() { if (!((bitField0_ & 0x00000008) == 0x00000008)) { - messageKeys_ = new java.util.ArrayList(messageKeys_); + messageKeys_ = new java.util.ArrayList(messageKeys_); bitField0_ |= 0x00000008; } } private com.google.protobuf.RepeatedFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder> messageKeysBuilder_; + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder> messageKeysBuilder_; - public java.util.List getMessageKeysList() { + public java.util.List getMessageKeysList() { if (messageKeysBuilder_ == null) { return java.util.Collections.unmodifiableList(messageKeys_); } else { @@ -1599,7 +1599,7 @@ public final class StorageProtos { return messageKeysBuilder_.getCount(); } } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey getMessageKeys(int index) { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey getMessageKeys(int index) { if (messageKeysBuilder_ == null) { return messageKeys_.get(index); } else { @@ -1607,7 +1607,7 @@ public final class StorageProtos { } } public Builder setMessageKeys( - int index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey value) { + int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey value) { if (messageKeysBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -1621,7 +1621,7 @@ public final class StorageProtos { return this; } public Builder setMessageKeys( - int index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.Builder builderForValue) { + int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder builderForValue) { if (messageKeysBuilder_ == null) { ensureMessageKeysIsMutable(); messageKeys_.set(index, builderForValue.build()); @@ -1631,7 +1631,7 @@ public final class StorageProtos { } return this; } - public Builder addMessageKeys(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey value) { + public Builder addMessageKeys(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey value) { if (messageKeysBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -1645,7 +1645,7 @@ public final class StorageProtos { return this; } public Builder addMessageKeys( - int index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey value) { + int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey value) { if (messageKeysBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -1659,7 +1659,7 @@ public final class StorageProtos { return this; } public Builder addMessageKeys( - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.Builder builderForValue) { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder builderForValue) { if (messageKeysBuilder_ == null) { ensureMessageKeysIsMutable(); messageKeys_.add(builderForValue.build()); @@ -1670,7 +1670,7 @@ public final class StorageProtos { return this; } public Builder addMessageKeys( - int index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.Builder builderForValue) { + int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder builderForValue) { if (messageKeysBuilder_ == null) { ensureMessageKeysIsMutable(); messageKeys_.add(index, builderForValue.build()); @@ -1681,7 +1681,7 @@ public final class StorageProtos { return this; } public Builder addAllMessageKeys( - java.lang.Iterable values) { + java.lang.Iterable values) { if (messageKeysBuilder_ == null) { ensureMessageKeysIsMutable(); super.addAll(values, messageKeys_); @@ -1711,18 +1711,18 @@ public final class StorageProtos { } return this; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.Builder getMessageKeysBuilder( + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder getMessageKeysBuilder( int index) { return getMessageKeysFieldBuilder().getBuilder(index); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder getMessageKeysOrBuilder( + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder getMessageKeysOrBuilder( int index) { if (messageKeysBuilder_ == null) { return messageKeys_.get(index); } else { return messageKeysBuilder_.getMessageOrBuilder(index); } } - public java.util.List + public java.util.List getMessageKeysOrBuilderList() { if (messageKeysBuilder_ != null) { return messageKeysBuilder_.getMessageOrBuilderList(); @@ -1730,25 +1730,25 @@ public final class StorageProtos { return java.util.Collections.unmodifiableList(messageKeys_); } } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.Builder addMessageKeysBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder addMessageKeysBuilder() { return getMessageKeysFieldBuilder().addBuilder( - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.getDefaultInstance()); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.getDefaultInstance()); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.Builder addMessageKeysBuilder( + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder addMessageKeysBuilder( int index) { return getMessageKeysFieldBuilder().addBuilder( - index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.getDefaultInstance()); + index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.getDefaultInstance()); } - public java.util.List + public java.util.List getMessageKeysBuilderList() { return getMessageKeysFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder> + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder> getMessageKeysFieldBuilder() { if (messageKeysBuilder_ == null) { messageKeysBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder>( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder>( messageKeys_, ((bitField0_ & 0x00000008) == 0x00000008), getParentForChildren(), @@ -1820,12 +1820,12 @@ public final class StorageProtos { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_fieldAccessorTable; } private int bitField0_; @@ -1990,41 +1990,41 @@ public final class StorageProtos { return super.writeReplace(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange parseFrom(byte[] data) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange parseFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange parseDelimitedFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { @@ -2033,7 +2033,7 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange parseDelimitedFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -2044,12 +2044,12 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -2059,7 +2059,7 @@ public final class StorageProtos { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange prototype) { + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -2072,18 +2072,18 @@ public final class StorageProtos { } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder { + implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_fieldAccessorTable; } - // Construct using org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.newBuilder() + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -2125,24 +2125,24 @@ public final class StorageProtos { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDescriptor(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange getDefaultInstanceForType() { - return org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange build() { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange result = buildPartial(); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange build() { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange buildParsed() + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange result = buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); @@ -2150,8 +2150,8 @@ public final class StorageProtos { return result; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange buildPartial() { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange result = new org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange(this); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange buildPartial() { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange result = new org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { @@ -2188,16 +2188,16 @@ public final class StorageProtos { } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange) { - return mergeFrom((org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange)other); + if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange) { + return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange other) { - if (other == org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance()) return this; + public Builder mergeFrom(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange other) { + if (other == org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance()) return this; if (other.hasSequence()) { setSequence(other.getSequence()); } @@ -2498,12 +2498,12 @@ public final class StorageProtos { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_fieldAccessorTable; } private int bitField0_; @@ -2578,41 +2578,41 @@ public final class StorageProtos { return super.writeReplace(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey parseFrom(byte[] data) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey parseFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey parseDelimitedFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { @@ -2621,7 +2621,7 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey parseDelimitedFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -2632,12 +2632,12 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -2647,7 +2647,7 @@ public final class StorageProtos { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey prototype) { + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -2660,18 +2660,18 @@ public final class StorageProtos { } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKeyOrBuilder { + implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_fieldAccessorTable; } - // Construct using org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.newBuilder() + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -2703,24 +2703,24 @@ public final class StorageProtos { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.getDescriptor(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey getDefaultInstanceForType() { - return org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey build() { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey result = buildPartial(); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey build() { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey buildParsed() + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey result = buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); @@ -2728,8 +2728,8 @@ public final class StorageProtos { return result; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey buildPartial() { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey result = new org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey(this); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey buildPartial() { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey result = new org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { @@ -2746,16 +2746,16 @@ public final class StorageProtos { } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey) { - return mergeFrom((org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey)other); + if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey) { + return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey other) { - if (other == org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance()) return this; + public Builder mergeFrom(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey other) { + if (other == org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance()) return this; if (other.hasPreKeyId()) { setPreKeyId(other.getPreKeyId()); } @@ -2918,61 +2918,61 @@ public final class StorageProtos { // optional .textsecure.SessionStructure.Chain senderChain = 6; public static final int SENDERCHAIN_FIELD_NUMBER = 6; - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain senderChain_; + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain senderChain_; public boolean hasSenderChain() { return ((bitField0_ & 0x00000020) == 0x00000020); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain getSenderChain() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getSenderChain() { return senderChain_; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder getSenderChainOrBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder getSenderChainOrBuilder() { return senderChain_; } // repeated .textsecure.SessionStructure.Chain receiverChains = 7; public static final int RECEIVERCHAINS_FIELD_NUMBER = 7; - private java.util.List receiverChains_; - public java.util.List getReceiverChainsList() { + private java.util.List receiverChains_; + public java.util.List getReceiverChainsList() { return receiverChains_; } - public java.util.List + public java.util.List getReceiverChainsOrBuilderList() { return receiverChains_; } public int getReceiverChainsCount() { return receiverChains_.size(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain getReceiverChains(int index) { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getReceiverChains(int index) { return receiverChains_.get(index); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder getReceiverChainsOrBuilder( + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder getReceiverChainsOrBuilder( int index) { return receiverChains_.get(index); } // optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; public static final int PENDINGKEYEXCHANGE_FIELD_NUMBER = 8; - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange pendingKeyExchange_; + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange pendingKeyExchange_; public boolean hasPendingKeyExchange() { return ((bitField0_ & 0x00000040) == 0x00000040); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange getPendingKeyExchange() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange getPendingKeyExchange() { return pendingKeyExchange_; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder getPendingKeyExchangeOrBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder getPendingKeyExchangeOrBuilder() { return pendingKeyExchange_; } // optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; public static final int PENDINGPREKEY_FIELD_NUMBER = 9; - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey pendingPreKey_; + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey pendingPreKey_; public boolean hasPendingPreKey() { return ((bitField0_ & 0x00000080) == 0x00000080); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey getPendingPreKey() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey getPendingPreKey() { return pendingPreKey_; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKeyOrBuilder getPendingPreKeyOrBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder getPendingPreKeyOrBuilder() { return pendingPreKey_; } @@ -3012,10 +3012,10 @@ public final class StorageProtos { remoteIdentityPublic_ = com.google.protobuf.ByteString.EMPTY; rootKey_ = com.google.protobuf.ByteString.EMPTY; previousCounter_ = 0; - senderChain_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.getDefaultInstance(); + senderChain_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance(); receiverChains_ = java.util.Collections.emptyList(); - pendingKeyExchange_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); - pendingPreKey_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); + pendingKeyExchange_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); + pendingPreKey_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); remoteRegistrationId_ = 0; localRegistrationId_ = 0; needsRefresh_ = false; @@ -3137,41 +3137,41 @@ public final class StorageProtos { return super.writeReplace(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure parseFrom(byte[] data) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure parseFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure parseDelimitedFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { @@ -3180,7 +3180,7 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure parseDelimitedFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -3191,12 +3191,12 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -3206,7 +3206,7 @@ public final class StorageProtos { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure prototype) { + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -3219,18 +3219,18 @@ public final class StorageProtos { } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder { + implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_SessionStructure_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_fieldAccessorTable; } - // Construct using org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.newBuilder() + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -3264,7 +3264,7 @@ public final class StorageProtos { previousCounter_ = 0; bitField0_ = (bitField0_ & ~0x00000010); if (senderChainBuilder_ == null) { - senderChain_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.getDefaultInstance(); + senderChain_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance(); } else { senderChainBuilder_.clear(); } @@ -3276,13 +3276,13 @@ public final class StorageProtos { receiverChainsBuilder_.clear(); } if (pendingKeyExchangeBuilder_ == null) { - pendingKeyExchange_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); + pendingKeyExchange_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); } else { pendingKeyExchangeBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000080); if (pendingPreKeyBuilder_ == null) { - pendingPreKey_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); + pendingPreKey_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); } else { pendingPreKeyBuilder_.clear(); } @@ -3302,24 +3302,24 @@ public final class StorageProtos { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDescriptor(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure getDefaultInstanceForType() { - return org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.getDefaultInstance(); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure build() { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure result = buildPartial(); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure build() { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure buildParsed() + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure result = buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); @@ -3327,8 +3327,8 @@ public final class StorageProtos { return result; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure buildPartial() { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure result = new org.whispersystems.textsecure.storage.StorageProtos.SessionStructure(this); + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure buildPartial() { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure result = new org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { @@ -3402,16 +3402,16 @@ public final class StorageProtos { } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.textsecure.storage.StorageProtos.SessionStructure) { - return mergeFrom((org.whispersystems.textsecure.storage.StorageProtos.SessionStructure)other); + if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure) { + return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure other) { - if (other == org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.getDefaultInstance()) return this; + public Builder mergeFrom(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure other) { + if (other == org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance()) return this; if (other.hasSessionVersion()) { setSessionVersion(other.getSessionVersion()); } @@ -3528,7 +3528,7 @@ public final class StorageProtos { break; } case 50: { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder subBuilder = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.newBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.newBuilder(); if (hasSenderChain()) { subBuilder.mergeFrom(getSenderChain()); } @@ -3537,13 +3537,13 @@ public final class StorageProtos { break; } case 58: { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder subBuilder = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.newBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.newBuilder(); input.readMessage(subBuilder, extensionRegistry); addReceiverChains(subBuilder.buildPartial()); break; } case 66: { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.Builder subBuilder = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.newBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.newBuilder(); if (hasPendingKeyExchange()) { subBuilder.mergeFrom(getPendingKeyExchange()); } @@ -3552,7 +3552,7 @@ public final class StorageProtos { break; } case 74: { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.Builder subBuilder = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.newBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.newBuilder(); if (hasPendingPreKey()) { subBuilder.mergeFrom(getPendingPreKey()); } @@ -3696,20 +3696,20 @@ public final class StorageProtos { } // optional .textsecure.SessionStructure.Chain senderChain = 6; - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain senderChain_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.getDefaultInstance(); + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain senderChain_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder> senderChainBuilder_; + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder> senderChainBuilder_; public boolean hasSenderChain() { return ((bitField0_ & 0x00000020) == 0x00000020); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain getSenderChain() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getSenderChain() { if (senderChainBuilder_ == null) { return senderChain_; } else { return senderChainBuilder_.getMessage(); } } - public Builder setSenderChain(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain value) { + public Builder setSenderChain(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain value) { if (senderChainBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -3723,7 +3723,7 @@ public final class StorageProtos { return this; } public Builder setSenderChain( - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder builderForValue) { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder builderForValue) { if (senderChainBuilder_ == null) { senderChain_ = builderForValue.build(); onChanged(); @@ -3733,12 +3733,12 @@ public final class StorageProtos { bitField0_ |= 0x00000020; return this; } - public Builder mergeSenderChain(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain value) { + public Builder mergeSenderChain(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain value) { if (senderChainBuilder_ == null) { if (((bitField0_ & 0x00000020) == 0x00000020) && - senderChain_ != org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.getDefaultInstance()) { + senderChain_ != org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance()) { senderChain_ = - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.newBuilder(senderChain_).mergeFrom(value).buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.newBuilder(senderChain_).mergeFrom(value).buildPartial(); } else { senderChain_ = value; } @@ -3751,7 +3751,7 @@ public final class StorageProtos { } public Builder clearSenderChain() { if (senderChainBuilder_ == null) { - senderChain_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.getDefaultInstance(); + senderChain_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance(); onChanged(); } else { senderChainBuilder_.clear(); @@ -3759,12 +3759,12 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000020); return this; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder getSenderChainBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder getSenderChainBuilder() { bitField0_ |= 0x00000020; onChanged(); return getSenderChainFieldBuilder().getBuilder(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder getSenderChainOrBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder getSenderChainOrBuilder() { if (senderChainBuilder_ != null) { return senderChainBuilder_.getMessageOrBuilder(); } else { @@ -3772,11 +3772,11 @@ public final class StorageProtos { } } private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder> + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder> getSenderChainFieldBuilder() { if (senderChainBuilder_ == null) { senderChainBuilder_ = new com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder>( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder>( senderChain_, getParentForChildren(), isClean()); @@ -3786,19 +3786,19 @@ public final class StorageProtos { } // repeated .textsecure.SessionStructure.Chain receiverChains = 7; - private java.util.List receiverChains_ = + private java.util.List receiverChains_ = java.util.Collections.emptyList(); private void ensureReceiverChainsIsMutable() { if (!((bitField0_ & 0x00000040) == 0x00000040)) { - receiverChains_ = new java.util.ArrayList(receiverChains_); + receiverChains_ = new java.util.ArrayList(receiverChains_); bitField0_ |= 0x00000040; } } private com.google.protobuf.RepeatedFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder> receiverChainsBuilder_; + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder> receiverChainsBuilder_; - public java.util.List getReceiverChainsList() { + public java.util.List getReceiverChainsList() { if (receiverChainsBuilder_ == null) { return java.util.Collections.unmodifiableList(receiverChains_); } else { @@ -3812,7 +3812,7 @@ public final class StorageProtos { return receiverChainsBuilder_.getCount(); } } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain getReceiverChains(int index) { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getReceiverChains(int index) { if (receiverChainsBuilder_ == null) { return receiverChains_.get(index); } else { @@ -3820,7 +3820,7 @@ public final class StorageProtos { } } public Builder setReceiverChains( - int index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain value) { + int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain value) { if (receiverChainsBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -3834,7 +3834,7 @@ public final class StorageProtos { return this; } public Builder setReceiverChains( - int index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder builderForValue) { + int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder builderForValue) { if (receiverChainsBuilder_ == null) { ensureReceiverChainsIsMutable(); receiverChains_.set(index, builderForValue.build()); @@ -3844,7 +3844,7 @@ public final class StorageProtos { } return this; } - public Builder addReceiverChains(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain value) { + public Builder addReceiverChains(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain value) { if (receiverChainsBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -3858,7 +3858,7 @@ public final class StorageProtos { return this; } public Builder addReceiverChains( - int index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain value) { + int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain value) { if (receiverChainsBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -3872,7 +3872,7 @@ public final class StorageProtos { return this; } public Builder addReceiverChains( - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder builderForValue) { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder builderForValue) { if (receiverChainsBuilder_ == null) { ensureReceiverChainsIsMutable(); receiverChains_.add(builderForValue.build()); @@ -3883,7 +3883,7 @@ public final class StorageProtos { return this; } public Builder addReceiverChains( - int index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder builderForValue) { + int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder builderForValue) { if (receiverChainsBuilder_ == null) { ensureReceiverChainsIsMutable(); receiverChains_.add(index, builderForValue.build()); @@ -3894,7 +3894,7 @@ public final class StorageProtos { return this; } public Builder addAllReceiverChains( - java.lang.Iterable values) { + java.lang.Iterable values) { if (receiverChainsBuilder_ == null) { ensureReceiverChainsIsMutable(); super.addAll(values, receiverChains_); @@ -3924,18 +3924,18 @@ public final class StorageProtos { } return this; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder getReceiverChainsBuilder( + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder getReceiverChainsBuilder( int index) { return getReceiverChainsFieldBuilder().getBuilder(index); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder getReceiverChainsOrBuilder( + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder getReceiverChainsOrBuilder( int index) { if (receiverChainsBuilder_ == null) { return receiverChains_.get(index); } else { return receiverChainsBuilder_.getMessageOrBuilder(index); } } - public java.util.List + public java.util.List getReceiverChainsOrBuilderList() { if (receiverChainsBuilder_ != null) { return receiverChainsBuilder_.getMessageOrBuilderList(); @@ -3943,25 +3943,25 @@ public final class StorageProtos { return java.util.Collections.unmodifiableList(receiverChains_); } } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder addReceiverChainsBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder addReceiverChainsBuilder() { return getReceiverChainsFieldBuilder().addBuilder( - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.getDefaultInstance()); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance()); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder addReceiverChainsBuilder( + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder addReceiverChainsBuilder( int index) { return getReceiverChainsFieldBuilder().addBuilder( - index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.getDefaultInstance()); + index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance()); } - public java.util.List + public java.util.List getReceiverChainsBuilderList() { return getReceiverChainsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder> + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder> getReceiverChainsFieldBuilder() { if (receiverChainsBuilder_ == null) { receiverChainsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.ChainOrBuilder>( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder>( receiverChains_, ((bitField0_ & 0x00000040) == 0x00000040), getParentForChildren(), @@ -3972,20 +3972,20 @@ public final class StorageProtos { } // optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange pendingKeyExchange_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange pendingKeyExchange_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder> pendingKeyExchangeBuilder_; + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder> pendingKeyExchangeBuilder_; public boolean hasPendingKeyExchange() { return ((bitField0_ & 0x00000080) == 0x00000080); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange getPendingKeyExchange() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange getPendingKeyExchange() { if (pendingKeyExchangeBuilder_ == null) { return pendingKeyExchange_; } else { return pendingKeyExchangeBuilder_.getMessage(); } } - public Builder setPendingKeyExchange(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange value) { + public Builder setPendingKeyExchange(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange value) { if (pendingKeyExchangeBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -3999,7 +3999,7 @@ public final class StorageProtos { return this; } public Builder setPendingKeyExchange( - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.Builder builderForValue) { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder builderForValue) { if (pendingKeyExchangeBuilder_ == null) { pendingKeyExchange_ = builderForValue.build(); onChanged(); @@ -4009,12 +4009,12 @@ public final class StorageProtos { bitField0_ |= 0x00000080; return this; } - public Builder mergePendingKeyExchange(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange value) { + public Builder mergePendingKeyExchange(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange value) { if (pendingKeyExchangeBuilder_ == null) { if (((bitField0_ & 0x00000080) == 0x00000080) && - pendingKeyExchange_ != org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance()) { + pendingKeyExchange_ != org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance()) { pendingKeyExchange_ = - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.newBuilder(pendingKeyExchange_).mergeFrom(value).buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.newBuilder(pendingKeyExchange_).mergeFrom(value).buildPartial(); } else { pendingKeyExchange_ = value; } @@ -4027,7 +4027,7 @@ public final class StorageProtos { } public Builder clearPendingKeyExchange() { if (pendingKeyExchangeBuilder_ == null) { - pendingKeyExchange_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); + pendingKeyExchange_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); onChanged(); } else { pendingKeyExchangeBuilder_.clear(); @@ -4035,12 +4035,12 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000080); return this; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.Builder getPendingKeyExchangeBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder getPendingKeyExchangeBuilder() { bitField0_ |= 0x00000080; onChanged(); return getPendingKeyExchangeFieldBuilder().getBuilder(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder getPendingKeyExchangeOrBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder getPendingKeyExchangeOrBuilder() { if (pendingKeyExchangeBuilder_ != null) { return pendingKeyExchangeBuilder_.getMessageOrBuilder(); } else { @@ -4048,11 +4048,11 @@ public final class StorageProtos { } } private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder> + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder> getPendingKeyExchangeFieldBuilder() { if (pendingKeyExchangeBuilder_ == null) { pendingKeyExchangeBuilder_ = new com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder>( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder>( pendingKeyExchange_, getParentForChildren(), isClean()); @@ -4062,20 +4062,20 @@ public final class StorageProtos { } // optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey pendingPreKey_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey pendingPreKey_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKeyOrBuilder> pendingPreKeyBuilder_; + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder> pendingPreKeyBuilder_; public boolean hasPendingPreKey() { return ((bitField0_ & 0x00000100) == 0x00000100); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey getPendingPreKey() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey getPendingPreKey() { if (pendingPreKeyBuilder_ == null) { return pendingPreKey_; } else { return pendingPreKeyBuilder_.getMessage(); } } - public Builder setPendingPreKey(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey value) { + public Builder setPendingPreKey(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey value) { if (pendingPreKeyBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -4089,7 +4089,7 @@ public final class StorageProtos { return this; } public Builder setPendingPreKey( - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.Builder builderForValue) { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder builderForValue) { if (pendingPreKeyBuilder_ == null) { pendingPreKey_ = builderForValue.build(); onChanged(); @@ -4099,12 +4099,12 @@ public final class StorageProtos { bitField0_ |= 0x00000100; return this; } - public Builder mergePendingPreKey(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey value) { + public Builder mergePendingPreKey(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey value) { if (pendingPreKeyBuilder_ == null) { if (((bitField0_ & 0x00000100) == 0x00000100) && - pendingPreKey_ != org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance()) { + pendingPreKey_ != org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance()) { pendingPreKey_ = - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.newBuilder(pendingPreKey_).mergeFrom(value).buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.newBuilder(pendingPreKey_).mergeFrom(value).buildPartial(); } else { pendingPreKey_ = value; } @@ -4117,7 +4117,7 @@ public final class StorageProtos { } public Builder clearPendingPreKey() { if (pendingPreKeyBuilder_ == null) { - pendingPreKey_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); + pendingPreKey_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); onChanged(); } else { pendingPreKeyBuilder_.clear(); @@ -4125,12 +4125,12 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000100); return this; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.Builder getPendingPreKeyBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder getPendingPreKeyBuilder() { bitField0_ |= 0x00000100; onChanged(); return getPendingPreKeyFieldBuilder().getBuilder(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKeyOrBuilder getPendingPreKeyOrBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder getPendingPreKeyOrBuilder() { if (pendingPreKeyBuilder_ != null) { return pendingPreKeyBuilder_.getMessageOrBuilder(); } else { @@ -4138,11 +4138,11 @@ public final class StorageProtos { } } private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKeyOrBuilder> + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder> getPendingPreKeyFieldBuilder() { if (pendingPreKeyBuilder_ == null) { pendingPreKeyBuilder_ = new com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKeyOrBuilder>( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder>( pendingPreKey_, getParentForChildren(), isClean()); @@ -4230,17 +4230,17 @@ public final class StorageProtos { // optional .textsecure.SessionStructure currentSession = 1; boolean hasCurrentSession(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure getCurrentSession(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder getCurrentSessionOrBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getCurrentSession(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder getCurrentSessionOrBuilder(); // repeated .textsecure.SessionStructure previousSessions = 2; - java.util.List + java.util.List getPreviousSessionsList(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure getPreviousSessions(int index); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getPreviousSessions(int index); int getPreviousSessionsCount(); - java.util.List + java.util.List getPreviousSessionsOrBuilderList(); - org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder getPreviousSessionsOrBuilder( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder getPreviousSessionsOrBuilder( int index); } public static final class RecordStructure extends @@ -4263,51 +4263,51 @@ public final class StorageProtos { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_RecordStructure_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_RecordStructure_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_RecordStructure_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_RecordStructure_fieldAccessorTable; } private int bitField0_; // optional .textsecure.SessionStructure currentSession = 1; public static final int CURRENTSESSION_FIELD_NUMBER = 1; - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure currentSession_; + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure currentSession_; public boolean hasCurrentSession() { return ((bitField0_ & 0x00000001) == 0x00000001); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure getCurrentSession() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getCurrentSession() { return currentSession_; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder getCurrentSessionOrBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder getCurrentSessionOrBuilder() { return currentSession_; } // repeated .textsecure.SessionStructure previousSessions = 2; public static final int PREVIOUSSESSIONS_FIELD_NUMBER = 2; - private java.util.List previousSessions_; - public java.util.List getPreviousSessionsList() { + private java.util.List previousSessions_; + public java.util.List getPreviousSessionsList() { return previousSessions_; } - public java.util.List + public java.util.List getPreviousSessionsOrBuilderList() { return previousSessions_; } public int getPreviousSessionsCount() { return previousSessions_.size(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure getPreviousSessions(int index) { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getPreviousSessions(int index) { return previousSessions_.get(index); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder getPreviousSessionsOrBuilder( + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder getPreviousSessionsOrBuilder( int index) { return previousSessions_.get(index); } private void initFields() { - currentSession_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.getDefaultInstance(); + currentSession_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance(); previousSessions_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; @@ -4357,41 +4357,41 @@ public final class StorageProtos { return super.writeReplace(); } - public static org.whispersystems.textsecure.storage.StorageProtos.RecordStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.RecordStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.RecordStructure parseFrom(byte[] data) + public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.RecordStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.RecordStructure parseFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.RecordStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.RecordStructure parseDelimitedFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { @@ -4400,7 +4400,7 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.RecordStructure parseDelimitedFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -4411,12 +4411,12 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.RecordStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.RecordStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -4426,7 +4426,7 @@ public final class StorageProtos { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.textsecure.storage.StorageProtos.RecordStructure prototype) { + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -4439,18 +4439,18 @@ public final class StorageProtos { } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.textsecure.storage.StorageProtos.RecordStructureOrBuilder { + implements org.whispersystems.libaxolotl.state.StorageProtos.RecordStructureOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_RecordStructure_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_RecordStructure_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_RecordStructure_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_RecordStructure_fieldAccessorTable; } - // Construct using org.whispersystems.textsecure.storage.StorageProtos.RecordStructure.newBuilder() + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -4472,7 +4472,7 @@ public final class StorageProtos { public Builder clear() { super.clear(); if (currentSessionBuilder_ == null) { - currentSession_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.getDefaultInstance(); + currentSession_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance(); } else { currentSessionBuilder_.clear(); } @@ -4492,24 +4492,24 @@ public final class StorageProtos { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.textsecure.storage.StorageProtos.RecordStructure.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.getDescriptor(); } - public org.whispersystems.textsecure.storage.StorageProtos.RecordStructure getDefaultInstanceForType() { - return org.whispersystems.textsecure.storage.StorageProtos.RecordStructure.getDefaultInstance(); + public org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.getDefaultInstance(); } - public org.whispersystems.textsecure.storage.StorageProtos.RecordStructure build() { - org.whispersystems.textsecure.storage.StorageProtos.RecordStructure result = buildPartial(); + public org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure build() { + org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - private org.whispersystems.textsecure.storage.StorageProtos.RecordStructure buildParsed() + private org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.textsecure.storage.StorageProtos.RecordStructure result = buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); @@ -4517,8 +4517,8 @@ public final class StorageProtos { return result; } - public org.whispersystems.textsecure.storage.StorageProtos.RecordStructure buildPartial() { - org.whispersystems.textsecure.storage.StorageProtos.RecordStructure result = new org.whispersystems.textsecure.storage.StorageProtos.RecordStructure(this); + public org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure buildPartial() { + org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure result = new org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { @@ -4544,16 +4544,16 @@ public final class StorageProtos { } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.textsecure.storage.StorageProtos.RecordStructure) { - return mergeFrom((org.whispersystems.textsecure.storage.StorageProtos.RecordStructure)other); + if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure) { + return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(org.whispersystems.textsecure.storage.StorageProtos.RecordStructure other) { - if (other == org.whispersystems.textsecure.storage.StorageProtos.RecordStructure.getDefaultInstance()) return this; + public Builder mergeFrom(org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure other) { + if (other == org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.getDefaultInstance()) return this; if (other.hasCurrentSession()) { mergeCurrentSession(other.getCurrentSession()); } @@ -4615,7 +4615,7 @@ public final class StorageProtos { break; } case 10: { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder subBuilder = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.newBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.newBuilder(); if (hasCurrentSession()) { subBuilder.mergeFrom(getCurrentSession()); } @@ -4624,7 +4624,7 @@ public final class StorageProtos { break; } case 18: { - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder subBuilder = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.newBuilder(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.newBuilder(); input.readMessage(subBuilder, extensionRegistry); addPreviousSessions(subBuilder.buildPartial()); break; @@ -4636,20 +4636,20 @@ public final class StorageProtos { private int bitField0_; // optional .textsecure.SessionStructure currentSession = 1; - private org.whispersystems.textsecure.storage.StorageProtos.SessionStructure currentSession_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.getDefaultInstance(); + private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure currentSession_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder> currentSessionBuilder_; + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder> currentSessionBuilder_; public boolean hasCurrentSession() { return ((bitField0_ & 0x00000001) == 0x00000001); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure getCurrentSession() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getCurrentSession() { if (currentSessionBuilder_ == null) { return currentSession_; } else { return currentSessionBuilder_.getMessage(); } } - public Builder setCurrentSession(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure value) { + public Builder setCurrentSession(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure value) { if (currentSessionBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -4663,7 +4663,7 @@ public final class StorageProtos { return this; } public Builder setCurrentSession( - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder builderForValue) { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder builderForValue) { if (currentSessionBuilder_ == null) { currentSession_ = builderForValue.build(); onChanged(); @@ -4673,12 +4673,12 @@ public final class StorageProtos { bitField0_ |= 0x00000001; return this; } - public Builder mergeCurrentSession(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure value) { + public Builder mergeCurrentSession(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure value) { if (currentSessionBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && - currentSession_ != org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.getDefaultInstance()) { + currentSession_ != org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance()) { currentSession_ = - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.newBuilder(currentSession_).mergeFrom(value).buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.newBuilder(currentSession_).mergeFrom(value).buildPartial(); } else { currentSession_ = value; } @@ -4691,7 +4691,7 @@ public final class StorageProtos { } public Builder clearCurrentSession() { if (currentSessionBuilder_ == null) { - currentSession_ = org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.getDefaultInstance(); + currentSession_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance(); onChanged(); } else { currentSessionBuilder_.clear(); @@ -4699,12 +4699,12 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000001); return this; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder getCurrentSessionBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder getCurrentSessionBuilder() { bitField0_ |= 0x00000001; onChanged(); return getCurrentSessionFieldBuilder().getBuilder(); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder getCurrentSessionOrBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder getCurrentSessionOrBuilder() { if (currentSessionBuilder_ != null) { return currentSessionBuilder_.getMessageOrBuilder(); } else { @@ -4712,11 +4712,11 @@ public final class StorageProtos { } } private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder> + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder> getCurrentSessionFieldBuilder() { if (currentSessionBuilder_ == null) { currentSessionBuilder_ = new com.google.protobuf.SingleFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder>( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder>( currentSession_, getParentForChildren(), isClean()); @@ -4726,19 +4726,19 @@ public final class StorageProtos { } // repeated .textsecure.SessionStructure previousSessions = 2; - private java.util.List previousSessions_ = + private java.util.List previousSessions_ = java.util.Collections.emptyList(); private void ensurePreviousSessionsIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { - previousSessions_ = new java.util.ArrayList(previousSessions_); + previousSessions_ = new java.util.ArrayList(previousSessions_); bitField0_ |= 0x00000002; } } private com.google.protobuf.RepeatedFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder> previousSessionsBuilder_; + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder> previousSessionsBuilder_; - public java.util.List getPreviousSessionsList() { + public java.util.List getPreviousSessionsList() { if (previousSessionsBuilder_ == null) { return java.util.Collections.unmodifiableList(previousSessions_); } else { @@ -4752,7 +4752,7 @@ public final class StorageProtos { return previousSessionsBuilder_.getCount(); } } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure getPreviousSessions(int index) { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getPreviousSessions(int index) { if (previousSessionsBuilder_ == null) { return previousSessions_.get(index); } else { @@ -4760,7 +4760,7 @@ public final class StorageProtos { } } public Builder setPreviousSessions( - int index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure value) { + int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure value) { if (previousSessionsBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -4774,7 +4774,7 @@ public final class StorageProtos { return this; } public Builder setPreviousSessions( - int index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder builderForValue) { + int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder builderForValue) { if (previousSessionsBuilder_ == null) { ensurePreviousSessionsIsMutable(); previousSessions_.set(index, builderForValue.build()); @@ -4784,7 +4784,7 @@ public final class StorageProtos { } return this; } - public Builder addPreviousSessions(org.whispersystems.textsecure.storage.StorageProtos.SessionStructure value) { + public Builder addPreviousSessions(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure value) { if (previousSessionsBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -4798,7 +4798,7 @@ public final class StorageProtos { return this; } public Builder addPreviousSessions( - int index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure value) { + int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure value) { if (previousSessionsBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -4812,7 +4812,7 @@ public final class StorageProtos { return this; } public Builder addPreviousSessions( - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder builderForValue) { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder builderForValue) { if (previousSessionsBuilder_ == null) { ensurePreviousSessionsIsMutable(); previousSessions_.add(builderForValue.build()); @@ -4823,7 +4823,7 @@ public final class StorageProtos { return this; } public Builder addPreviousSessions( - int index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder builderForValue) { + int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder builderForValue) { if (previousSessionsBuilder_ == null) { ensurePreviousSessionsIsMutable(); previousSessions_.add(index, builderForValue.build()); @@ -4834,7 +4834,7 @@ public final class StorageProtos { return this; } public Builder addAllPreviousSessions( - java.lang.Iterable values) { + java.lang.Iterable values) { if (previousSessionsBuilder_ == null) { ensurePreviousSessionsIsMutable(); super.addAll(values, previousSessions_); @@ -4864,18 +4864,18 @@ public final class StorageProtos { } return this; } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder getPreviousSessionsBuilder( + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder getPreviousSessionsBuilder( int index) { return getPreviousSessionsFieldBuilder().getBuilder(index); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder getPreviousSessionsOrBuilder( + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder getPreviousSessionsOrBuilder( int index) { if (previousSessionsBuilder_ == null) { return previousSessions_.get(index); } else { return previousSessionsBuilder_.getMessageOrBuilder(index); } } - public java.util.List + public java.util.List getPreviousSessionsOrBuilderList() { if (previousSessionsBuilder_ != null) { return previousSessionsBuilder_.getMessageOrBuilderList(); @@ -4883,25 +4883,25 @@ public final class StorageProtos { return java.util.Collections.unmodifiableList(previousSessions_); } } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder addPreviousSessionsBuilder() { + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder addPreviousSessionsBuilder() { return getPreviousSessionsFieldBuilder().addBuilder( - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.getDefaultInstance()); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance()); } - public org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder addPreviousSessionsBuilder( + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder addPreviousSessionsBuilder( int index) { return getPreviousSessionsFieldBuilder().addBuilder( - index, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.getDefaultInstance()); + index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance()); } - public java.util.List + public java.util.List getPreviousSessionsBuilderList() { return getPreviousSessionsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder> + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder> getPreviousSessionsFieldBuilder() { if (previousSessionsBuilder_ == null) { previousSessionsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure, org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder, org.whispersystems.textsecure.storage.StorageProtos.SessionStructureOrBuilder>( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder>( previousSessions_, ((bitField0_ & 0x00000002) == 0x00000002), getParentForChildren(), @@ -4957,12 +4957,12 @@ public final class StorageProtos { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_fieldAccessorTable; } private int bitField0_; @@ -5055,41 +5055,41 @@ public final class StorageProtos { return super.writeReplace(); } - public static org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure parseFrom(byte[] data) + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure parseFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure parseDelimitedFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { @@ -5098,7 +5098,7 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure parseDelimitedFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -5109,12 +5109,12 @@ public final class StorageProtos { return null; } } - public static org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure parseFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -5124,7 +5124,7 @@ public final class StorageProtos { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure prototype) { + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -5137,18 +5137,18 @@ public final class StorageProtos { } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructureOrBuilder { + implements org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructureOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.storage.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_fieldAccessorTable; } - // Construct using org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure.newBuilder() + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -5182,24 +5182,24 @@ public final class StorageProtos { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.getDescriptor(); } - public org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure getDefaultInstanceForType() { - return org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure.getDefaultInstance(); + public org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.getDefaultInstance(); } - public org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure build() { - org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure result = buildPartial(); + public org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure build() { + org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - private org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure buildParsed() + private org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure result = buildPartial(); + org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); @@ -5207,8 +5207,8 @@ public final class StorageProtos { return result; } - public org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure buildPartial() { - org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure result = new org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure(this); + public org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure buildPartial() { + org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure result = new org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { @@ -5229,16 +5229,16 @@ public final class StorageProtos { } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure) { - return mergeFrom((org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure)other); + if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure) { + return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure other) { - if (other == org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure.getDefaultInstance()) return this; + public Builder mergeFrom(org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure other) { + if (other == org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.getDefaultInstance()) return this; if (other.hasId()) { setId(other.getId()); } @@ -5461,8 +5461,8 @@ public final class StorageProtos { "ructure\0226\n\020previousSessions\030\002 \003(\0132\034.text", "secure.SessionStructure\"J\n\025PreKeyRecordS" + "tructure\022\n\n\002id\030\001 \001(\r\022\021\n\tpublicKey\030\002 \001(\014\022" + - "\022\n\nprivateKey\030\003 \001(\014B6\n%org.whispersystem" + - "s.textsecure.storageB\rStorageProtos" + "\022\n\nprivateKey\030\003 \001(\014B4\n#org.whispersystem" + + "s.libaxolotl.stateB\rStorageProtos" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -5475,64 +5475,64 @@ public final class StorageProtos { com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_SessionStructure_descriptor, new java.lang.String[] { "SessionVersion", "LocalIdentityPublic", "RemoteIdentityPublic", "RootKey", "PreviousCounter", "SenderChain", "ReceiverChains", "PendingKeyExchange", "PendingPreKey", "RemoteRegistrationId", "LocalRegistrationId", "NeedsRefresh", }, - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.class, - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Builder.class); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.class, + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder.class); internal_static_textsecure_SessionStructure_Chain_descriptor = internal_static_textsecure_SessionStructure_descriptor.getNestedTypes().get(0); internal_static_textsecure_SessionStructure_Chain_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_SessionStructure_Chain_descriptor, new java.lang.String[] { "SenderEphemeral", "SenderEphemeralPrivate", "ChainKey", "MessageKeys", }, - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.class, - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.Builder.class); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.class, + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder.class); internal_static_textsecure_SessionStructure_Chain_ChainKey_descriptor = internal_static_textsecure_SessionStructure_Chain_descriptor.getNestedTypes().get(0); internal_static_textsecure_SessionStructure_Chain_ChainKey_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_SessionStructure_Chain_ChainKey_descriptor, new java.lang.String[] { "Index", "Key", }, - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.class, - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.ChainKey.Builder.class); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.class, + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder.class); internal_static_textsecure_SessionStructure_Chain_MessageKey_descriptor = internal_static_textsecure_SessionStructure_Chain_descriptor.getNestedTypes().get(1); internal_static_textsecure_SessionStructure_Chain_MessageKey_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_SessionStructure_Chain_MessageKey_descriptor, new java.lang.String[] { "Index", "CipherKey", "MacKey", }, - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.class, - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain.MessageKey.Builder.class); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.class, + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder.class); internal_static_textsecure_SessionStructure_PendingKeyExchange_descriptor = internal_static_textsecure_SessionStructure_descriptor.getNestedTypes().get(1); internal_static_textsecure_SessionStructure_PendingKeyExchange_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_SessionStructure_PendingKeyExchange_descriptor, new java.lang.String[] { "Sequence", "LocalBaseKey", "LocalBaseKeyPrivate", "LocalEphemeralKey", "LocalEphemeralKeyPrivate", "LocalIdentityKey", "LocalIdentityKeyPrivate", }, - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.class, - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange.Builder.class); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.class, + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder.class); internal_static_textsecure_SessionStructure_PendingPreKey_descriptor = internal_static_textsecure_SessionStructure_descriptor.getNestedTypes().get(2); internal_static_textsecure_SessionStructure_PendingPreKey_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_SessionStructure_PendingPreKey_descriptor, new java.lang.String[] { "PreKeyId", "BaseKey", }, - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.class, - org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey.Builder.class); + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.class, + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder.class); internal_static_textsecure_RecordStructure_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_textsecure_RecordStructure_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_RecordStructure_descriptor, new java.lang.String[] { "CurrentSession", "PreviousSessions", }, - org.whispersystems.textsecure.storage.StorageProtos.RecordStructure.class, - org.whispersystems.textsecure.storage.StorageProtos.RecordStructure.Builder.class); + org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.class, + org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.Builder.class); internal_static_textsecure_PreKeyRecordStructure_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_textsecure_PreKeyRecordStructure_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_PreKeyRecordStructure_descriptor, new java.lang.String[] { "Id", "PublicKey", "PrivateKey", }, - org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure.class, - org.whispersystems.textsecure.storage.StorageProtos.PreKeyRecordStructure.Builder.class); + org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.class, + org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.Builder.class); return null; } }; diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/util/ByteUtil.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/util/ByteUtil.java index e22b584d08..c213ba0bba 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/util/ByteUtil.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/util/ByteUtil.java @@ -78,6 +78,13 @@ public class ByteUtil { return result; } + public static byte[] copyFrom(byte[] input) { + byte[] output = new byte[input.length]; + System.arraycopy(input, 0, output, 0, output.length); + + return output; + } + public static byte intsToByteHighAndLow(int highValue, int lowValue) { return (byte)((highValue << 4 | lowValue) & 0xFF); } diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/util/KeyHelper.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/util/KeyHelper.java index 5cb6351ed2..9bc4ee6948 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/util/KeyHelper.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/util/KeyHelper.java @@ -1,10 +1,49 @@ package org.whispersystems.libaxolotl.util; +import org.whispersystems.libaxolotl.IdentityKey; +import org.whispersystems.libaxolotl.IdentityKeyPair; +import org.whispersystems.libaxolotl.ecc.Curve; +import org.whispersystems.libaxolotl.ecc.ECKeyPair; +import org.whispersystems.libaxolotl.state.PreKeyRecord; + import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; +import java.util.LinkedList; +import java.util.List; +/** + * Helper class for generating keys of different types. + * + * @author Moxie Marlinspike + */ public class KeyHelper { + /** + * Generate an identity key pair. Clients should only do this once, + * at install time. + * + * @return the generated IdentityKeyPair. + */ + public static IdentityKeyPair generateIdentityKeyPair() { + ECKeyPair keyPair = Curve.generateKeyPair(false); + IdentityKey publicKey = new IdentityKey(keyPair.getPublicKey()); + return new IdentityKeyPair(publicKey, keyPair.getPrivateKey()); + } + + /** + * Generate a registration ID. Clients should only do this once, + * at install time. + * + * @return the generated registration ID. + */ + public static int generateRegistrationId() { + try { + return SecureRandom.getInstance("SHA1PRNG").nextInt(16380) + 1; + } catch (NoSuchAlgorithmException e) { + throw new AssertionError(e); + } + } + public static int getRandomSequence(int max) { try { return SecureRandom.getInstance("SHA1PRNG").nextInt(max); @@ -13,4 +52,26 @@ public class KeyHelper { } } + /** + * Generate a list of PreKeys. Clients should do this at install time, and + * subsequently any time the list of PreKeys stored on the server runs low. + *

+ * PreKey IDs are shorts, so they will eventually be repeated. Clients should + * store PreKeys in a circular buffer, so that they are repeated as infrequently + * as possible. + * + * @param start The starting PreKey ID, inclusive. + * @param count The number of PreKeys to generate. + * @return the list of generated PreKeyRecords. + */ + public List generatePreKeys(int start, int count) { + List results = new LinkedList<>(); + + for (int i=0;i previousStates = new LinkedList<>(); - - private final MasterSecret masterSecret; - - public TextSecureSessionRecord(MasterSecret masterSecret) { - this.masterSecret = masterSecret; - } - - public TextSecureSessionRecord(MasterSecret masterSecret, FileInputStream in) - throws IOException, InvalidMessageException - { - this.masterSecret = masterSecret; - - int versionMarker = readInteger(in); - - if (versionMarker > CURRENT_VERSION) { - throw new AssertionError("Unknown version: " + versionMarker); - } - - MasterCipher cipher = new MasterCipher(masterSecret); - byte[] encryptedBlob = readBlob(in); - - if (versionMarker == SINGLE_STATE_VERSION) { - byte[] plaintextBytes = cipher.decryptBytes(encryptedBlob); - SessionStructure sessionStructure = SessionStructure.parseFrom(plaintextBytes); - this.sessionState = new TextSecureSessionState(sessionStructure); - } else if (versionMarker == ARCHIVE_STATES_VERSION) { - byte[] plaintextBytes = cipher.decryptBytes(encryptedBlob); - RecordStructure recordStructure = RecordStructure.parseFrom(plaintextBytes); - - this.sessionState = new TextSecureSessionState(recordStructure.getCurrentSession()); - this.previousStates = new LinkedList<>(); - - for (SessionStructure sessionStructure : recordStructure.getPreviousSessionsList()) { - this.previousStates.add(new TextSecureSessionState(sessionStructure)); - } - } else { - throw new AssertionError("Unknown version: " + versionMarker); - } - - in.close(); - } - - @Override - public SessionState getSessionState() { - return sessionState; - } - - @Override - public List getPreviousSessionStates() { - return previousStates; - } - - @Override - public void reset() { - this.sessionState = new TextSecureSessionState(SessionStructure.newBuilder().build()); - this.previousStates = new LinkedList<>(); - } - - @Override - public void archiveCurrentState() { - this.previousStates.add(sessionState); - this.sessionState = new TextSecureSessionState(SessionStructure.newBuilder().build()); - } - - @Override - public byte[] serialize() { - try { - List previousStructures = new LinkedList<>(); - - for (SessionState previousState : previousStates) { - previousStructures.add(((TextSecureSessionState)previousState).getStructure()); - } - - RecordStructure record = RecordStructure.newBuilder() - .setCurrentSession(sessionState.getStructure()) - .addAllPreviousSessions(previousStructures) - .build(); - - - ByteArrayOutputStream serialized = new ByteArrayOutputStream(); - MasterCipher cipher = new MasterCipher(masterSecret); - - writeInteger(CURRENT_VERSION, serialized); - writeBlob(cipher.encryptBytes(record.toByteArray()), serialized); - - return serialized.toByteArray(); - } catch (IOException e) { - throw new AssertionError(e); - } - } - - private byte[] readBlob(FileInputStream in) throws IOException { - int length = readInteger(in); - byte[] blobBytes = new byte[length]; - - in.read(blobBytes, 0, blobBytes.length); - return blobBytes; - } - - private void writeBlob(byte[] blobBytes, OutputStream out) throws IOException { - writeInteger(blobBytes.length, out); - out.write(blobBytes); - } - - private int readInteger(FileInputStream in) throws IOException { - byte[] integer = new byte[4]; - in.read(integer, 0, integer.length); - return Conversions.byteArrayToInt(integer); - } - - private void writeInteger(int value, OutputStream out) throws IOException { - byte[] valueBytes = Conversions.intToByteArray(value); - out.write(valueBytes); - } -} diff --git a/library/src/org/whispersystems/textsecure/storage/TextSecureSessionState.java b/library/src/org/whispersystems/textsecure/storage/TextSecureSessionState.java deleted file mode 100644 index e46671eeb7..0000000000 --- a/library/src/org/whispersystems/textsecure/storage/TextSecureSessionState.java +++ /dev/null @@ -1,449 +0,0 @@ -/** - * Copyright (C) 2014 Open Whisper Systems - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.whispersystems.textsecure.storage; - -import android.util.Log; - -import com.google.protobuf.ByteString; - -import org.whispersystems.libaxolotl.IdentityKey; -import org.whispersystems.libaxolotl.IdentityKeyPair; -import org.whispersystems.libaxolotl.InvalidKeyException; -import org.whispersystems.libaxolotl.state.SessionState; -import org.whispersystems.libaxolotl.ecc.Curve; -import org.whispersystems.libaxolotl.ecc.ECKeyPair; -import org.whispersystems.libaxolotl.ecc.ECPrivateKey; -import org.whispersystems.libaxolotl.ecc.ECPublicKey; -import org.whispersystems.libaxolotl.ratchet.ChainKey; -import org.whispersystems.libaxolotl.ratchet.MessageKeys; -import org.whispersystems.libaxolotl.ratchet.RootKey; -import org.whispersystems.libaxolotl.util.Pair; -import org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.Chain; -import org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingKeyExchange; -import org.whispersystems.textsecure.storage.StorageProtos.SessionStructure.PendingPreKey; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import javax.crypto.spec.SecretKeySpec; - -import static org.whispersystems.textsecure.storage.StorageProtos.SessionStructure; - -public class TextSecureSessionState implements SessionState { - - private SessionStructure sessionStructure; - - public TextSecureSessionState(SessionStructure sessionStructure) { - this.sessionStructure = sessionStructure; - } - - public SessionStructure getStructure() { - return sessionStructure; - } - - public void setNeedsRefresh(boolean needsRefresh) { - this.sessionStructure = this.sessionStructure.toBuilder() - .setNeedsRefresh(needsRefresh) - .build(); - } - - public boolean getNeedsRefresh() { - return this.sessionStructure.getNeedsRefresh(); - } - - public void setSessionVersion(int version) { - this.sessionStructure = this.sessionStructure.toBuilder() - .setSessionVersion(version) - .build(); - } - - public int getSessionVersion() { - return this.sessionStructure.getSessionVersion(); - } - - public void setRemoteIdentityKey(IdentityKey identityKey) { - this.sessionStructure = this.sessionStructure.toBuilder() - .setRemoteIdentityPublic(ByteString.copyFrom(identityKey.serialize())) - .build(); - } - - public void setLocalIdentityKey(IdentityKey identityKey) { - this.sessionStructure = this.sessionStructure.toBuilder() - .setLocalIdentityPublic(ByteString.copyFrom(identityKey.serialize())) - .build(); - } - - public IdentityKey getRemoteIdentityKey() { - try { - if (!this.sessionStructure.hasRemoteIdentityPublic()) { - return null; - } - - return new IdentityKey(this.sessionStructure.getRemoteIdentityPublic().toByteArray(), 0); - } catch (InvalidKeyException e) { - Log.w("SessionRecordV2", e); - return null; - } - } - - public IdentityKey getLocalIdentityKey() { - try { - return new IdentityKey(this.sessionStructure.getLocalIdentityPublic().toByteArray(), 0); - } catch (InvalidKeyException e) { - throw new AssertionError(e); - } - } - - public int getPreviousCounter() { - return sessionStructure.getPreviousCounter(); - } - - public void setPreviousCounter(int previousCounter) { - this.sessionStructure = this.sessionStructure.toBuilder() - .setPreviousCounter(previousCounter) - .build(); - } - - public RootKey getRootKey() { - return new RootKey(this.sessionStructure.getRootKey().toByteArray()); - } - - public void setRootKey(RootKey rootKey) { - this.sessionStructure = this.sessionStructure.toBuilder() - .setRootKey(ByteString.copyFrom(rootKey.getKeyBytes())) - .build(); - } - - public ECPublicKey getSenderEphemeral() { - try { - return Curve.decodePoint(sessionStructure.getSenderChain().getSenderEphemeral().toByteArray(), 0); - } catch (InvalidKeyException e) { - throw new AssertionError(e); - } - } - - public ECKeyPair getSenderEphemeralPair() { - ECPublicKey publicKey = getSenderEphemeral(); - ECPrivateKey privateKey = Curve.decodePrivatePoint(sessionStructure.getSenderChain() - .getSenderEphemeralPrivate() - .toByteArray()); - - return new ECKeyPair(publicKey, privateKey); - } - - public boolean hasReceiverChain(ECPublicKey senderEphemeral) { - return getReceiverChain(senderEphemeral) != null; - } - - public boolean hasSenderChain() { - return sessionStructure.hasSenderChain(); - } - - private Pair getReceiverChain(ECPublicKey senderEphemeral) { - List receiverChains = sessionStructure.getReceiverChainsList(); - int index = 0; - - for (Chain receiverChain : receiverChains) { - try { - ECPublicKey chainSenderEphemeral = Curve.decodePoint(receiverChain.getSenderEphemeral().toByteArray(), 0); - - if (chainSenderEphemeral.equals(senderEphemeral)) { - return new Pair(receiverChain,index); - } - } catch (InvalidKeyException e) { - Log.w("SessionRecordV2", e); - } - - index++; - } - - return null; - } - - public ChainKey getReceiverChainKey(ECPublicKey senderEphemeral) { - Pair receiverChainAndIndex = getReceiverChain(senderEphemeral); - Chain receiverChain = receiverChainAndIndex.first(); - - if (receiverChain == null) { - return null; - } else { - return new ChainKey(receiverChain.getChainKey().getKey().toByteArray(), - receiverChain.getChainKey().getIndex()); - } - } - - public void addReceiverChain(ECPublicKey senderEphemeral, ChainKey chainKey) { - Chain.ChainKey chainKeyStructure = Chain.ChainKey.newBuilder() - .setKey(ByteString.copyFrom(chainKey.getKey())) - .setIndex(chainKey.getIndex()) - .build(); - - Chain chain = Chain.newBuilder() - .setChainKey(chainKeyStructure) - .setSenderEphemeral(ByteString.copyFrom(senderEphemeral.serialize())) - .build(); - - this.sessionStructure = this.sessionStructure.toBuilder().addReceiverChains(chain).build(); - - if (this.sessionStructure.getReceiverChainsList().size() > 5) { - this.sessionStructure = this.sessionStructure.toBuilder() - .removeReceiverChains(0) - .build(); - } - } - - public void setSenderChain(ECKeyPair senderEphemeralPair, ChainKey chainKey) { - Chain.ChainKey chainKeyStructure = Chain.ChainKey.newBuilder() - .setKey(ByteString.copyFrom(chainKey.getKey())) - .setIndex(chainKey.getIndex()) - .build(); - - Chain senderChain = Chain.newBuilder() - .setSenderEphemeral(ByteString.copyFrom(senderEphemeralPair.getPublicKey().serialize())) - .setSenderEphemeralPrivate(ByteString.copyFrom(senderEphemeralPair.getPrivateKey().serialize())) - .setChainKey(chainKeyStructure) - .build(); - - this.sessionStructure = this.sessionStructure.toBuilder().setSenderChain(senderChain).build(); - } - - public ChainKey getSenderChainKey() { - Chain.ChainKey chainKeyStructure = sessionStructure.getSenderChain().getChainKey(); - return new ChainKey(chainKeyStructure.getKey().toByteArray(), chainKeyStructure.getIndex()); - } - - - public void setSenderChainKey(ChainKey nextChainKey) { - Chain.ChainKey chainKey = Chain.ChainKey.newBuilder() - .setKey(ByteString.copyFrom(nextChainKey.getKey())) - .setIndex(nextChainKey.getIndex()) - .build(); - - Chain chain = sessionStructure.getSenderChain().toBuilder() - .setChainKey(chainKey).build(); - - this.sessionStructure = this.sessionStructure.toBuilder().setSenderChain(chain).build(); - } - - public boolean hasMessageKeys(ECPublicKey senderEphemeral, int counter) { - Pair chainAndIndex = getReceiverChain(senderEphemeral); - Chain chain = chainAndIndex.first(); - - if (chain == null) { - return false; - } - - List messageKeyList = chain.getMessageKeysList(); - - for (Chain.MessageKey messageKey : messageKeyList) { - if (messageKey.getIndex() == counter) { - return true; - } - } - - return false; - } - - public MessageKeys removeMessageKeys(ECPublicKey senderEphemeral, int counter) { - Pair chainAndIndex = getReceiverChain(senderEphemeral); - Chain chain = chainAndIndex.first(); - - if (chain == null) { - return null; - } - - List messageKeyList = new LinkedList(chain.getMessageKeysList()); - Iterator messageKeyIterator = messageKeyList.iterator(); - MessageKeys result = null; - - while (messageKeyIterator.hasNext()) { - Chain.MessageKey messageKey = messageKeyIterator.next(); - - if (messageKey.getIndex() == counter) { - result = new MessageKeys(new SecretKeySpec(messageKey.getCipherKey().toByteArray(), "AES"), - new SecretKeySpec(messageKey.getMacKey().toByteArray(), "HmacSHA256"), - messageKey.getIndex()); - - messageKeyIterator.remove(); - break; - } - } - - Chain updatedChain = chain.toBuilder().clearMessageKeys() - .addAllMessageKeys(messageKeyList) - .build(); - - this.sessionStructure = this.sessionStructure.toBuilder() - .setReceiverChains(chainAndIndex.second(), updatedChain) - .build(); - - return result; - } - - public void setMessageKeys(ECPublicKey senderEphemeral, MessageKeys messageKeys) { - Pair chainAndIndex = getReceiverChain(senderEphemeral); - Chain chain = chainAndIndex.first(); - Chain.MessageKey messageKeyStructure = Chain.MessageKey.newBuilder() - .setCipherKey(ByteString.copyFrom(messageKeys.getCipherKey().getEncoded())) - .setMacKey(ByteString.copyFrom(messageKeys.getMacKey().getEncoded())) - .setIndex(messageKeys.getCounter()) - .build(); - - Chain updatedChain = chain.toBuilder() - .addMessageKeys(messageKeyStructure) - .build(); - - this.sessionStructure = this.sessionStructure.toBuilder() - .setReceiverChains(chainAndIndex.second(), updatedChain) - .build(); - } - - public void setReceiverChainKey(ECPublicKey senderEphemeral, ChainKey chainKey) { - Pair chainAndIndex = getReceiverChain(senderEphemeral); - Chain chain = chainAndIndex.first(); - - Chain.ChainKey chainKeyStructure = Chain.ChainKey.newBuilder() - .setKey(ByteString.copyFrom(chainKey.getKey())) - .setIndex(chainKey.getIndex()) - .build(); - - Chain updatedChain = chain.toBuilder().setChainKey(chainKeyStructure).build(); - - this.sessionStructure = this.sessionStructure.toBuilder() - .setReceiverChains(chainAndIndex.second(), updatedChain) - .build(); - } - - public void setPendingKeyExchange(int sequence, - ECKeyPair ourBaseKey, - ECKeyPair ourEphemeralKey, - IdentityKeyPair ourIdentityKey) - { - PendingKeyExchange structure = - PendingKeyExchange.newBuilder() - .setSequence(sequence) - .setLocalBaseKey(ByteString.copyFrom(ourBaseKey.getPublicKey().serialize())) - .setLocalBaseKeyPrivate(ByteString.copyFrom(ourBaseKey.getPrivateKey().serialize())) - .setLocalEphemeralKey(ByteString.copyFrom(ourEphemeralKey.getPublicKey().serialize())) - .setLocalEphemeralKeyPrivate(ByteString.copyFrom(ourEphemeralKey.getPrivateKey().serialize())) - .setLocalIdentityKey(ByteString.copyFrom(ourIdentityKey.getPublicKey().serialize())) - .setLocalIdentityKeyPrivate(ByteString.copyFrom(ourIdentityKey.getPrivateKey().serialize())) - .build(); - - this.sessionStructure = this.sessionStructure.toBuilder() - .setPendingKeyExchange(structure) - .build(); - } - - public int getPendingKeyExchangeSequence() { - return sessionStructure.getPendingKeyExchange().getSequence(); - } - - public ECKeyPair getPendingKeyExchangeBaseKey() throws InvalidKeyException { - ECPublicKey publicKey = Curve.decodePoint(sessionStructure.getPendingKeyExchange() - .getLocalBaseKey().toByteArray(), 0); - - ECPrivateKey privateKey = Curve.decodePrivatePoint(sessionStructure.getPendingKeyExchange() - .getLocalBaseKeyPrivate() - .toByteArray()); - - return new ECKeyPair(publicKey, privateKey); - } - - public ECKeyPair getPendingKeyExchangeEphemeralKey() throws InvalidKeyException { - ECPublicKey publicKey = Curve.decodePoint(sessionStructure.getPendingKeyExchange() - .getLocalEphemeralKey().toByteArray(), 0); - - ECPrivateKey privateKey = Curve.decodePrivatePoint(sessionStructure.getPendingKeyExchange() - .getLocalEphemeralKeyPrivate() - .toByteArray()); - - return new ECKeyPair(publicKey, privateKey); - } - - public IdentityKeyPair getPendingKeyExchangeIdentityKey() throws InvalidKeyException { - IdentityKey publicKey = new IdentityKey(sessionStructure.getPendingKeyExchange() - .getLocalIdentityKey().toByteArray(), 0); - - ECPrivateKey privateKey = Curve.decodePrivatePoint(sessionStructure.getPendingKeyExchange() - .getLocalIdentityKeyPrivate() - .toByteArray()); - - return new IdentityKeyPair(publicKey, privateKey); - } - - public boolean hasPendingKeyExchange() { - return sessionStructure.hasPendingKeyExchange(); - } - - public void setPendingPreKey(int preKeyId, ECPublicKey baseKey) { - PendingPreKey pending = PendingPreKey.newBuilder() - .setPreKeyId(preKeyId) - .setBaseKey(ByteString.copyFrom(baseKey.serialize())) - .build(); - - this.sessionStructure = this.sessionStructure.toBuilder() - .setPendingPreKey(pending) - .build(); - } - - public boolean hasPendingPreKey() { - return this.sessionStructure.hasPendingPreKey(); - } - - public Pair getPendingPreKey() { - try { - return new Pair(sessionStructure.getPendingPreKey().getPreKeyId(), - Curve.decodePoint(sessionStructure.getPendingPreKey() - .getBaseKey() - .toByteArray(), 0)); - } catch (InvalidKeyException e) { - throw new AssertionError(e); - } - } - - public void clearPendingPreKey() { - this.sessionStructure = this.sessionStructure.toBuilder() - .clearPendingPreKey() - .build(); - } - - public void setRemoteRegistrationId(int registrationId) { - this.sessionStructure = this.sessionStructure.toBuilder() - .setRemoteRegistrationId(registrationId) - .build(); - } - - public int getRemoteRegistrationId() { - return this.sessionStructure.getRemoteRegistrationId(); - } - - public void setLocalRegistrationId(int registrationId) { - this.sessionStructure = this.sessionStructure.toBuilder() - .setLocalRegistrationId(registrationId) - .build(); - } - - public int getLocalRegistrationId() { - return this.sessionStructure.getLocalRegistrationId(); - } - - public byte[] serialize() { - return sessionStructure.toByteArray(); - } -} diff --git a/library/src/org/whispersystems/textsecure/storage/TextSecureSessionStore.java b/library/src/org/whispersystems/textsecure/storage/TextSecureSessionStore.java index 36b0f27e9e..c9ad6f7b0f 100644 --- a/library/src/org/whispersystems/textsecure/storage/TextSecureSessionStore.java +++ b/library/src/org/whispersystems/textsecure/storage/TextSecureSessionStore.java @@ -5,8 +5,11 @@ import android.util.Log; import org.whispersystems.libaxolotl.InvalidMessageException; import org.whispersystems.libaxolotl.state.SessionRecord; +import org.whispersystems.libaxolotl.state.SessionState; import org.whispersystems.libaxolotl.state.SessionStore; +import org.whispersystems.textsecure.crypto.MasterCipher; import org.whispersystems.textsecure.crypto.MasterSecret; +import org.whispersystems.textsecure.util.Conversions; import java.io.File; import java.io.FileInputStream; @@ -17,12 +20,18 @@ import java.nio.channels.FileChannel; import java.util.LinkedList; import java.util.List; +import static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure; + public class TextSecureSessionStore implements SessionStore { private static final String TAG = TextSecureSessionStore.class.getSimpleName(); private static final String SESSIONS_DIRECTORY_V2 = "sessions-v2"; private static final Object FILE_LOCK = new Object(); + private static final int SINGLE_STATE_VERSION = 1; + private static final int ARCHIVE_STATES_VERSION = 2; + private static final int CURRENT_VERSION = 2; + private final Context context; private final MasterSecret masterSecret; @@ -35,11 +44,30 @@ public class TextSecureSessionStore implements SessionStore { public SessionRecord load(long recipientId, int deviceId) { synchronized (FILE_LOCK) { try { - FileInputStream input = new FileInputStream(getSessionFile(recipientId, deviceId)); - return new TextSecureSessionRecord(masterSecret, input); + MasterCipher cipher = new MasterCipher(masterSecret); + FileInputStream in = new FileInputStream(getSessionFile(recipientId, deviceId)); + + int versionMarker = readInteger(in); + + if (versionMarker > CURRENT_VERSION) { + throw new AssertionError("Unknown version: " + versionMarker); + } + + byte[] serialized = cipher.decryptBytes(readBlob(in)); + in.close(); + + if (versionMarker == SINGLE_STATE_VERSION) { + SessionStructure sessionStructure = SessionStructure.parseFrom(serialized); + SessionState sessionState = new SessionState(sessionStructure); + return new SessionRecord(sessionState); + } else if (versionMarker == ARCHIVE_STATES_VERSION) { + return new SessionRecord(serialized); + } else { + throw new AssertionError("Unknown version: " + versionMarker); + } } catch (InvalidMessageException | IOException e) { Log.w(TAG, "No existing session information found."); - return new TextSecureSessionRecord(masterSecret); + return new SessionRecord(); } } } @@ -47,11 +75,13 @@ public class TextSecureSessionStore implements SessionStore { @Override public void store(long recipientId, int deviceId, SessionRecord record) { try { + MasterCipher masterCipher = new MasterCipher(masterSecret); RandomAccessFile sessionFile = new RandomAccessFile(getSessionFile(recipientId, deviceId), "rw"); FileChannel out = sessionFile.getChannel(); out.position(0); - out.write(ByteBuffer.wrap(record.serialize())); + writeInteger(CURRENT_VERSION, out); + writeBlob(masterCipher.encryptBytes(record.serialize()), out); out.truncate(out.position()); sessionFile.close(); @@ -126,4 +156,28 @@ public class TextSecureSessionStore implements SessionStore { return recipientId + (deviceId == RecipientDevice.DEFAULT_DEVICE_ID ? "" : "." + deviceId); } + private byte[] readBlob(FileInputStream in) throws IOException { + int length = readInteger(in); + byte[] blobBytes = new byte[length]; + + in.read(blobBytes, 0, blobBytes.length); + return blobBytes; + } + + private void writeBlob(byte[] blobBytes, FileChannel out) throws IOException { + writeInteger(blobBytes.length, out); + out.write(ByteBuffer.wrap(blobBytes)); + } + + private int readInteger(FileInputStream in) throws IOException { + byte[] integer = new byte[4]; + in.read(integer, 0, integer.length); + return Conversions.byteArrayToInt(integer); + } + + private void writeInteger(int value, FileChannel out) throws IOException { + byte[] valueBytes = Conversions.intToByteArray(value); + out.write(ByteBuffer.wrap(valueBytes)); + } + } diff --git a/library/src/org/whispersystems/textsecure/util/Util.java b/library/src/org/whispersystems/textsecure/util/Util.java index 376ae4e516..79263143fa 100644 --- a/library/src/org/whispersystems/textsecure/util/Util.java +++ b/library/src/org/whispersystems/textsecure/util/Util.java @@ -93,15 +93,6 @@ public class Util { return value == null || value.length() == 0; } - - public static int generateRegistrationId() { - try { - return SecureRandom.getInstance("SHA1PRNG").nextInt(16380) + 1; - } catch (NoSuchAlgorithmException e) { - throw new AssertionError(e); - } - } - public static String getSecret(int size) { try { byte[] secret = new byte[size]; diff --git a/src/org/thoughtcrime/securesms/service/RegistrationService.java b/src/org/thoughtcrime/securesms/service/RegistrationService.java index 081a57fc85..43c4d255b7 100644 --- a/src/org/thoughtcrime/securesms/service/RegistrationService.java +++ b/src/org/thoughtcrime/securesms/service/RegistrationService.java @@ -19,6 +19,7 @@ import org.thoughtcrime.securesms.util.DirectoryHelper; import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.whispersystems.libaxolotl.IdentityKey; import org.whispersystems.libaxolotl.state.PreKeyRecord; +import org.whispersystems.libaxolotl.util.KeyHelper; import org.whispersystems.textsecure.crypto.MasterSecret; import org.whispersystems.textsecure.crypto.PreKeyUtil; import org.whispersystems.textsecure.push.ExpectationFailedException; @@ -178,7 +179,7 @@ public class RegistrationService extends Service { int registrationId = TextSecurePreferences.getLocalRegistrationId(this); if (registrationId == 0) { - registrationId = Util.generateRegistrationId(); + registrationId = KeyHelper.generateRegistrationId(); TextSecurePreferences.setLocalRegistrationId(this, registrationId); }