diff --git a/build.gradle b/build.gradle index 113d1c444..cb48867c2 100644 --- a/build.gradle +++ b/build.gradle @@ -51,7 +51,7 @@ dependencyVerification { 'com.astuetz:pagerslidingtabstrip:f1641396732c7132a7abb837e482e5ee2b0ebb8d10813fc52bbaec2c15c184c2', 'org.w3c:smil:085dc40f2bb249651578bfa07499fd08b16ad0886dbe2c4078586a408da62f9b', 'org.apache.httpcomponents:httpclient-android:6f56466a9bd0d42934b90bfbfe9977a8b654c058bf44a12bdc2877c4e1f033f1', - 'com.google.protobuf:protobuf-java:ad9769a22989e688a46af4d3accc348cc501ced22118033230542bc916e33f0b', + 'com.google.protobuf:protobuf-java:e0c1c64575c005601725e7c6a02cebf9e1285e888f756b2a1d73ffa8d725cc74', 'com.madgag:sc-light-jdk15on:931f39d351429fb96c2f749e7ecb1a256a8ebbf5edca7995c9cc085b94d1841d', 'com.googlecode.libphonenumber:libphonenumber:eba17eae81dd622ea89a00a3a8c025b2f25d342e0d9644c5b62e16f15687c3ab', 'org.whispersystems:gson:08f4f7498455d1539c9233e5aac18e9b1805815ef29221572996508eb512fe51', diff --git a/libaxolotl/build.gradle b/libaxolotl/build.gradle index 3f418839a..9f8ab1e89 100644 --- a/libaxolotl/build.gradle +++ b/libaxolotl/build.gradle @@ -4,7 +4,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:0.9.+' + classpath 'com.android.tools.build:gradle:0.11.+' } } @@ -15,7 +15,7 @@ repositories { } dependencies { - compile 'com.google.protobuf:protobuf-java:2.4.1' + compile 'com.google.protobuf:protobuf-java:2.5.0' } android { diff --git a/libaxolotl/protobuf/LocalStorageProtocol.proto b/libaxolotl/protobuf/LocalStorageProtocol.proto index 9339bb706..15e710114 100644 --- a/libaxolotl/protobuf/LocalStorageProtocol.proto +++ b/libaxolotl/protobuf/LocalStorageProtocol.proto @@ -35,8 +35,9 @@ message SessionStructure { } message PendingPreKey { - optional uint32 preKeyId = 1; - optional bytes baseKey = 2; + optional uint32 preKeyId = 1; + optional int32 deviceKeyId = 3; + optional bytes baseKey = 2; } optional uint32 sessionVersion = 1; @@ -56,6 +57,7 @@ message SessionStructure { optional uint32 localRegistrationId = 11; optional bool needsRefresh = 12; + optional bytes aliceBaseKey = 13; } message RecordStructure { @@ -69,6 +71,14 @@ message PreKeyRecordStructure { optional bytes privateKey = 3; } +message DeviceKeyRecordStructure { + optional uint32 id = 1; + optional bytes publicKey = 2; + optional bytes privateKey = 3; + optional bytes signature = 4; + optional fixed64 timestamp = 5; +} + message IdentityKeyPairStructure { optional bytes publicKey = 1; optional bytes privateKey = 2; diff --git a/libaxolotl/protobuf/WhisperTextProtocol.proto b/libaxolotl/protobuf/WhisperTextProtocol.proto index a0b0a5d0d..23ca2091d 100644 --- a/libaxolotl/protobuf/WhisperTextProtocol.proto +++ b/libaxolotl/protobuf/WhisperTextProtocol.proto @@ -12,10 +12,11 @@ message WhisperMessage { message PreKeyWhisperMessage { optional uint32 registrationId = 5; - optional uint32 preKeyId = 1; - optional bytes baseKey = 2; - optional bytes identityKey = 3; - optional bytes message = 4; // WhisperMessage + optional uint32 preKeyId = 1; + optional uint32 deviceKeyId = 6; + optional bytes baseKey = 2; + optional bytes identityKey = 3; + optional bytes message = 4; // WhisperMessage } message KeyExchangeMessage { diff --git a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemoryDeviceKeyStore.java b/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemoryDeviceKeyStore.java new file mode 100644 index 000000000..4457adc79 --- /dev/null +++ b/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemoryDeviceKeyStore.java @@ -0,0 +1,58 @@ +package org.whispersystems.test; + +import org.whispersystems.libaxolotl.InvalidKeyIdException; +import org.whispersystems.libaxolotl.state.DeviceKeyRecord; +import org.whispersystems.libaxolotl.state.DeviceKeyStore; + +import java.io.IOException; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +public class InMemoryDeviceKeyStore implements DeviceKeyStore { + + private final Map store = new HashMap<>(); + + @Override + public DeviceKeyRecord loadDeviceKey(int deviceKeyId) throws InvalidKeyIdException { + try { + if (!store.containsKey(deviceKeyId)) { + throw new InvalidKeyIdException("No such devicekeyrecord!"); + } + + return new DeviceKeyRecord(store.get(deviceKeyId)); + } catch (IOException e) { + throw new AssertionError(e); + } + } + + public List loadDeviceKeys() { + try { + List results = new LinkedList<>(); + + for (byte[] serialized : store.values()) { + results.add(new DeviceKeyRecord(serialized)); + } + + return results; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + @Override + public void storeDeviceKey(int deviceKeyId, DeviceKeyRecord record) { + store.put(deviceKeyId, record.serialize()); + } + + @Override + public boolean containsDeviceKey(int deviceKeyId) { + return store.containsKey(deviceKeyId); + } + + @Override + public void removeDeviceKey(int deviceKeyId) { + store.remove(deviceKeyId); + } +} diff --git a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemoryPreKeyStore.java b/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemoryPreKeyStore.java index bd8ebbc88..7c3cea08b 100644 --- a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemoryPreKeyStore.java +++ b/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemoryPreKeyStore.java @@ -13,7 +13,7 @@ public class InMemoryPreKeyStore implements PreKeyStore { private final Map store = new HashMap<>(); @Override - public PreKeyRecord load(int preKeyId) throws InvalidKeyIdException { + public PreKeyRecord loadPreKey(int preKeyId) throws InvalidKeyIdException { try { if (!store.containsKey(preKeyId)) { throw new InvalidKeyIdException("No such prekeyrecord!"); @@ -26,17 +26,17 @@ public class InMemoryPreKeyStore implements PreKeyStore { } @Override - public void store(int preKeyId, PreKeyRecord record) { + public void storePreKey(int preKeyId, PreKeyRecord record) { store.put(preKeyId, record.serialize()); } @Override - public boolean contains(int preKeyId) { + public boolean containsPreKey(int preKeyId) { return store.containsKey(preKeyId); } @Override - public void remove(int preKeyId) { + public void removePreKey(int preKeyId) { store.remove(preKeyId); } } diff --git a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionStore.java b/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionStore.java index fc282d1bd..0d148ab03 100644 --- a/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionStore.java +++ b/libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySessionStore.java @@ -17,9 +17,9 @@ public class InMemorySessionStore implements SessionStore { public InMemorySessionStore() {} @Override - public synchronized SessionRecord load(long recipientId, int deviceId) { + public synchronized SessionRecord loadSession(long recipientId, int deviceId) { try { - if (contains(recipientId, deviceId)) { + if (containsSession(recipientId, deviceId)) { return new SessionRecord(sessions.get(new Pair<>(recipientId, deviceId))); } else { return new SessionRecord(); @@ -43,22 +43,22 @@ public class InMemorySessionStore implements SessionStore { } @Override - public synchronized void store(long recipientId, int deviceId, SessionRecord record) { + public synchronized void storeSession(long recipientId, int deviceId, SessionRecord record) { sessions.put(new Pair<>(recipientId, deviceId), record.serialize()); } @Override - public synchronized boolean contains(long recipientId, int deviceId) { + public synchronized boolean containsSession(long recipientId, int deviceId) { return sessions.containsKey(new Pair<>(recipientId, deviceId)); } @Override - public synchronized void delete(long recipientId, int deviceId) { + public synchronized void deleteSession(long recipientId, int deviceId) { sessions.remove(new Pair<>(recipientId, deviceId)); } @Override - public synchronized void deleteAll(long recipientId) { + public synchronized void deleteAllSessions(long recipientId) { for (Pair key : sessions.keySet()) { if (key.first() == recipientId) { sessions.remove(key); diff --git a/libaxolotl/src/androidTest/java/org/whispersystems/test/SessionBuilderTest.java b/libaxolotl/src/androidTest/java/org/whispersystems/test/SessionBuilderTest.java index 01980a0ae..3024181d4 100644 --- a/libaxolotl/src/androidTest/java/org/whispersystems/test/SessionBuilderTest.java +++ b/libaxolotl/src/androidTest/java/org/whispersystems/test/SessionBuilderTest.java @@ -3,7 +3,6 @@ package org.whispersystems.test; import android.test.AndroidTestCase; import org.whispersystems.libaxolotl.DuplicateMessageException; -import org.whispersystems.libaxolotl.IdentityKey; import org.whispersystems.libaxolotl.InvalidKeyException; import org.whispersystems.libaxolotl.InvalidKeyIdException; import org.whispersystems.libaxolotl.InvalidMessageException; @@ -15,12 +14,13 @@ import org.whispersystems.libaxolotl.StaleKeyExchangeException; import org.whispersystems.libaxolotl.UntrustedIdentityException; import org.whispersystems.libaxolotl.ecc.Curve; import org.whispersystems.libaxolotl.ecc.ECKeyPair; -import org.whispersystems.libaxolotl.ecc.ECPublicKey; import org.whispersystems.libaxolotl.protocol.CiphertextMessage; import org.whispersystems.libaxolotl.protocol.KeyExchangeMessage; import org.whispersystems.libaxolotl.protocol.PreKeyWhisperMessage; +import org.whispersystems.libaxolotl.state.DeviceKeyRecord; +import org.whispersystems.libaxolotl.state.DeviceKeyStore; import org.whispersystems.libaxolotl.state.IdentityKeyStore; -import org.whispersystems.libaxolotl.state.PreKey; +import org.whispersystems.libaxolotl.state.PreKeyBundle; import org.whispersystems.libaxolotl.state.PreKeyRecord; import org.whispersystems.libaxolotl.state.PreKeyStore; import org.whispersystems.libaxolotl.state.SessionStore; @@ -34,30 +34,37 @@ public class SessionBuilderTest extends AndroidTestCase { private static final long ALICE_RECIPIENT_ID = 5L; private static final long BOB_RECIPIENT_ID = 2L; - public void testBasicPreKey() + public void testBasicPreKeyV2() throws InvalidKeyException, InvalidVersionException, InvalidMessageException, InvalidKeyIdException, DuplicateMessageException, LegacyMessageException, UntrustedIdentityException { SessionStore aliceSessionStore = new InMemorySessionStore(); + DeviceKeyStore aliceDeviceKeyStore = new InMemoryDeviceKeyStore(); PreKeyStore alicePreKeyStore = new InMemoryPreKeyStore(); IdentityKeyStore aliceIdentityKeyStore = new InMemoryIdentityKeyStore(); SessionBuilder aliceSessionBuilder = new SessionBuilder(aliceSessionStore, alicePreKeyStore, + aliceDeviceKeyStore, aliceIdentityKeyStore, BOB_RECIPIENT_ID, 1); SessionStore bobSessionStore = new InMemorySessionStore(); PreKeyStore bobPreKeyStore = new InMemoryPreKeyStore(); + DeviceKeyStore bobDeviceKeyStore = new InMemoryDeviceKeyStore(); IdentityKeyStore bobIdentityKeyStore = new InMemoryIdentityKeyStore(); SessionBuilder bobSessionBuilder = new SessionBuilder(bobSessionStore, bobPreKeyStore, + bobDeviceKeyStore, bobIdentityKeyStore, ALICE_RECIPIENT_ID, 1); - InMemoryPreKey bobPreKey = new InMemoryPreKey(31337, Curve.generateKeyPair(true), - bobIdentityKeyStore.getIdentityKeyPair().getPublicKey(), - bobIdentityKeyStore.getLocalRegistrationId()); + ECKeyPair bobPreKeyPair = Curve.generateKeyPair(true); + PreKeyBundle bobPreKey = new PreKeyBundle(bobIdentityKeyStore.getLocalRegistrationId(), 1, + 31337, bobPreKeyPair.getPublicKey(), + 0, null, null, + bobIdentityKeyStore.getIdentityKeyPair().getPublicKey()); aliceSessionBuilder.process(bobPreKey); - assertTrue(aliceSessionStore.contains(BOB_RECIPIENT_ID, 1)); - assertTrue(!aliceSessionStore.load(BOB_RECIPIENT_ID, 1).getSessionState().getNeedsRefresh()); + assertTrue(aliceSessionStore.containsSession(BOB_RECIPIENT_ID, 1)); + assertTrue(!aliceSessionStore.loadSession(BOB_RECIPIENT_ID, 1).getSessionState().getNeedsRefresh()); + assertTrue(aliceSessionStore.loadSession(BOB_RECIPIENT_ID, 1).getSessionState().getSessionVersion() == 2); String originalMessage = "L'homme est condamné à être libre"; SessionCipher aliceSessionCipher = new SessionCipher(aliceSessionStore, BOB_RECIPIENT_ID, 1); @@ -66,10 +73,11 @@ public class SessionBuilderTest extends AndroidTestCase { assertTrue(outgoingMessage.getType() == CiphertextMessage.PREKEY_TYPE); PreKeyWhisperMessage incomingMessage = new PreKeyWhisperMessage(outgoingMessage.serialize()); - bobPreKeyStore.store(31337, bobPreKey); + bobPreKeyStore.storePreKey(31337, new PreKeyRecord(bobPreKey.getPreKeyId(), bobPreKeyPair)); bobSessionBuilder.process(incomingMessage); - assertTrue(bobSessionStore.contains(ALICE_RECIPIENT_ID, 1)); + assertTrue(bobSessionStore.containsSession(ALICE_RECIPIENT_ID, 1)); + assertTrue(bobSessionStore.loadSession(ALICE_RECIPIENT_ID, 1).getSessionState().getSessionVersion() == 2); SessionCipher bobSessionCipher = new SessionCipher(bobSessionStore, ALICE_RECIPIENT_ID, 1); byte[] plaintext = bobSessionCipher.decrypt(incomingMessage.getWhisperMessage().serialize()); @@ -87,15 +95,17 @@ public class SessionBuilderTest extends AndroidTestCase { aliceSessionStore = new InMemorySessionStore(); aliceIdentityKeyStore = new InMemoryIdentityKeyStore(); aliceSessionBuilder = new SessionBuilder(aliceSessionStore, alicePreKeyStore, + aliceDeviceKeyStore, aliceIdentityKeyStore, BOB_RECIPIENT_ID, 1); aliceSessionCipher = new SessionCipher(aliceSessionStore, BOB_RECIPIENT_ID, 1); - bobPreKey = new InMemoryPreKey(31338, Curve.generateKeyPair(true), - bobIdentityKeyStore.getIdentityKeyPair().getPublicKey(), - bobIdentityKeyStore.getLocalRegistrationId()); + bobPreKeyPair = Curve.generateKeyPair(true); + bobPreKey = new PreKeyBundle(bobIdentityKeyStore.getLocalRegistrationId(), + 1, 31338, bobPreKeyPair.getPublicKey(), + 0, null, null, bobIdentityKeyStore.getIdentityKeyPair().getPublicKey()); - bobPreKeyStore.store(31338, bobPreKey); + bobPreKeyStore.storePreKey(31338, new PreKeyRecord(bobPreKey.getPreKeyId(), bobPreKeyPair)); aliceSessionBuilder.process(bobPreKey); outgoingMessage = aliceSessionCipher.encrypt(originalMessage.getBytes()); @@ -111,9 +121,10 @@ public class SessionBuilderTest extends AndroidTestCase { plaintext = bobSessionCipher.decrypt(new PreKeyWhisperMessage(outgoingMessage.serialize()).getWhisperMessage().serialize()); assertTrue(new String(plaintext).equals(originalMessage)); - bobPreKey = new InMemoryPreKey(31337, Curve.generateKeyPair(true), - aliceIdentityKeyStore.getIdentityKeyPair().getPublicKey(), - bobIdentityKeyStore.getLocalRegistrationId()); + bobPreKey = new PreKeyBundle(bobIdentityKeyStore.getLocalRegistrationId(), 1, + 31337, Curve.generateKeyPair(true).getPublicKey(), + 0, null, null, + aliceIdentityKeyStore.getIdentityKeyPair().getPublicKey()); try { aliceSessionBuilder.process(bobPreKey); @@ -123,18 +134,315 @@ public class SessionBuilderTest extends AndroidTestCase { } } - public void testBasicKeyExchange() throws InvalidKeyException, LegacyMessageException, InvalidMessageException, DuplicateMessageException, UntrustedIdentityException, StaleKeyExchangeException { + public void testBasicPreKeyV3() + throws InvalidKeyException, InvalidVersionException, InvalidMessageException, InvalidKeyIdException, DuplicateMessageException, LegacyMessageException, UntrustedIdentityException { SessionStore aliceSessionStore = new InMemorySessionStore(); + DeviceKeyStore aliceDeviceKeyStore = new InMemoryDeviceKeyStore(); PreKeyStore alicePreKeyStore = new InMemoryPreKeyStore(); IdentityKeyStore aliceIdentityKeyStore = new InMemoryIdentityKeyStore(); SessionBuilder aliceSessionBuilder = new SessionBuilder(aliceSessionStore, alicePreKeyStore, + aliceDeviceKeyStore, aliceIdentityKeyStore, BOB_RECIPIENT_ID, 1); SessionStore bobSessionStore = new InMemorySessionStore(); PreKeyStore bobPreKeyStore = new InMemoryPreKeyStore(); + DeviceKeyStore bobDeviceKeyStore = new InMemoryDeviceKeyStore(); IdentityKeyStore bobIdentityKeyStore = new InMemoryIdentityKeyStore(); SessionBuilder bobSessionBuilder = new SessionBuilder(bobSessionStore, bobPreKeyStore, + bobDeviceKeyStore, + bobIdentityKeyStore, + ALICE_RECIPIENT_ID, 1); + + ECKeyPair bobPreKeyPair = Curve.generateKeyPair(true); + ECKeyPair bobDeviceKeyPair = Curve.generateKeyPair(true); + byte[] bobDeviceKeySignature = Curve.calculateSignature(bobIdentityKeyStore.getIdentityKeyPair().getPrivateKey(), + bobDeviceKeyPair.getPublicKey().serialize()); + + PreKeyBundle bobPreKey = new PreKeyBundle(bobIdentityKeyStore.getLocalRegistrationId(), 1, + 31337, bobPreKeyPair.getPublicKey(), + 22, bobDeviceKeyPair.getPublicKey(), bobDeviceKeySignature, + bobIdentityKeyStore.getIdentityKeyPair().getPublicKey()); + + aliceSessionBuilder.process(bobPreKey); + + assertTrue(aliceSessionStore.containsSession(BOB_RECIPIENT_ID, 1)); + assertTrue(!aliceSessionStore.loadSession(BOB_RECIPIENT_ID, 1).getSessionState().getNeedsRefresh()); + assertTrue(aliceSessionStore.loadSession(BOB_RECIPIENT_ID, 1).getSessionState().getSessionVersion() == 3); + + String originalMessage = "L'homme est condamné à être libre"; + SessionCipher aliceSessionCipher = new SessionCipher(aliceSessionStore, BOB_RECIPIENT_ID, 1); + CiphertextMessage outgoingMessage = aliceSessionCipher.encrypt(originalMessage.getBytes()); + + assertTrue(outgoingMessage.getType() == CiphertextMessage.PREKEY_TYPE); + + PreKeyWhisperMessage incomingMessage = new PreKeyWhisperMessage(outgoingMessage.serialize()); + bobPreKeyStore.storePreKey(31337, new PreKeyRecord(bobPreKey.getPreKeyId(), bobPreKeyPair)); + bobDeviceKeyStore.storeDeviceKey(22, new DeviceKeyRecord(22, System.currentTimeMillis(), bobDeviceKeyPair, bobDeviceKeySignature)); + bobSessionBuilder.process(incomingMessage); + + assertTrue(bobSessionStore.containsSession(ALICE_RECIPIENT_ID, 1)); + assertTrue(bobSessionStore.loadSession(ALICE_RECIPIENT_ID, 1).getSessionState().getSessionVersion() == 3); + assertTrue(bobSessionStore.loadSession(ALICE_RECIPIENT_ID, 1).getSessionState().getAliceBaseKey() != null); + + SessionCipher bobSessionCipher = new SessionCipher(bobSessionStore, ALICE_RECIPIENT_ID, 1); + byte[] plaintext = bobSessionCipher.decrypt(incomingMessage.getWhisperMessage().serialize()); + + assertTrue(originalMessage.equals(new String(plaintext))); + + CiphertextMessage bobOutgoingMessage = bobSessionCipher.encrypt(originalMessage.getBytes()); + assertTrue(bobOutgoingMessage.getType() == CiphertextMessage.WHISPER_TYPE); + + byte[] alicePlaintext = aliceSessionCipher.decrypt(bobOutgoingMessage.serialize()); + assertTrue(new String(alicePlaintext).equals(originalMessage)); + + runInteraction(aliceSessionStore, bobSessionStore); + + aliceSessionStore = new InMemorySessionStore(); + aliceIdentityKeyStore = new InMemoryIdentityKeyStore(); + aliceSessionBuilder = new SessionBuilder(aliceSessionStore, alicePreKeyStore, + aliceDeviceKeyStore, + aliceIdentityKeyStore, + BOB_RECIPIENT_ID, 1); + aliceSessionCipher = new SessionCipher(aliceSessionStore, BOB_RECIPIENT_ID, 1); + + bobPreKeyPair = Curve.generateKeyPair(true); + bobDeviceKeyPair = Curve.generateKeyPair(true); + bobDeviceKeySignature = Curve.calculateSignature(bobIdentityKeyStore.getIdentityKeyPair().getPrivateKey(), bobDeviceKeyPair.getPublicKey().serialize()); + bobPreKey = new PreKeyBundle(bobIdentityKeyStore.getLocalRegistrationId(), + 1, 31338, bobPreKeyPair.getPublicKey(), + 23, bobDeviceKeyPair.getPublicKey(), bobDeviceKeySignature, + bobIdentityKeyStore.getIdentityKeyPair().getPublicKey()); + + bobPreKeyStore.storePreKey(31338, new PreKeyRecord(bobPreKey.getPreKeyId(), bobPreKeyPair)); + bobDeviceKeyStore.storeDeviceKey(23, new DeviceKeyRecord(23, System.currentTimeMillis(), bobDeviceKeyPair, bobDeviceKeySignature)); + aliceSessionBuilder.process(bobPreKey); + + outgoingMessage = aliceSessionCipher.encrypt(originalMessage.getBytes()); + + try { + bobSessionBuilder.process(new PreKeyWhisperMessage(outgoingMessage.serialize())); + throw new AssertionError("shouldn't be trusted!"); + } catch (UntrustedIdentityException uie) { + bobIdentityKeyStore.saveIdentity(ALICE_RECIPIENT_ID, new PreKeyWhisperMessage(outgoingMessage.serialize()).getIdentityKey()); + bobSessionBuilder.process(new PreKeyWhisperMessage(outgoingMessage.serialize())); + } + + plaintext = bobSessionCipher.decrypt(new PreKeyWhisperMessage(outgoingMessage.serialize()).getWhisperMessage().serialize()); + assertTrue(new String(plaintext).equals(originalMessage)); + + bobPreKey = new PreKeyBundle(bobIdentityKeyStore.getLocalRegistrationId(), 1, + 31337, Curve.generateKeyPair(true).getPublicKey(), + 23, bobDeviceKeyPair.getPublicKey(), bobDeviceKeySignature, + aliceIdentityKeyStore.getIdentityKeyPair().getPublicKey()); + + try { + aliceSessionBuilder.process(bobPreKey); + throw new AssertionError("shoulnd't be trusted!"); + } catch (UntrustedIdentityException uie) { + // good + } + } + + public void testBadDeviceKeySignature() throws InvalidKeyException, UntrustedIdentityException { + SessionStore aliceSessionStore = new InMemorySessionStore(); + DeviceKeyStore aliceDeviceKeyStore = new InMemoryDeviceKeyStore(); + PreKeyStore alicePreKeyStore = new InMemoryPreKeyStore(); + IdentityKeyStore aliceIdentityKeyStore = new InMemoryIdentityKeyStore(); + SessionBuilder aliceSessionBuilder = new SessionBuilder(aliceSessionStore, alicePreKeyStore, + aliceDeviceKeyStore, + aliceIdentityKeyStore, + BOB_RECIPIENT_ID, 1); + + IdentityKeyStore bobIdentityKeyStore = new InMemoryIdentityKeyStore(); + + ECKeyPair bobPreKeyPair = Curve.generateKeyPair(true); + ECKeyPair bobDeviceKeyPair = Curve.generateKeyPair(true); + byte[] bobDeviceKeySignature = Curve.calculateSignature(bobIdentityKeyStore.getIdentityKeyPair().getPrivateKey(), + bobDeviceKeyPair.getPublicKey().serialize()); + + + for (int i=0;i aliceCiphertextMessages = new ArrayList<>(); + List alicePlaintextMessages = new ArrayList<>(); + + for (int i=0;i<50;i++) { + alicePlaintextMessages.add(("смерть за смерть " + i).getBytes()); + aliceCiphertextMessages.add(aliceCipher.encrypt(("смерть за смерть " + i).getBytes())); + } + + long seed = System.currentTimeMillis(); + + Collections.shuffle(aliceCiphertextMessages, new Random(seed)); + Collections.shuffle(alicePlaintextMessages, new Random(seed)); + + for (int i=0;i bobCiphertextMessages = new ArrayList<>(); + List bobPlaintextMessages = new ArrayList<>(); + + for (int i=0;i<20;i++) { + bobPlaintextMessages.add(("смерть за смерть " + i).getBytes()); + bobCiphertextMessages.add(bobCipher.encrypt(("смерть за смерть " + i).getBytes())); + } + + seed = System.currentTimeMillis(); + + Collections.shuffle(bobCiphertextMessages, new Random(seed)); + Collections.shuffle(bobPlaintextMessages, new Random(seed)); + + for (int i=0;i * Sessions are built from one of three different possible vectors: *
    - *
  1. A {@link org.whispersystems.libaxolotl.state.PreKey} retrieved from a server.
  2. + *
  3. A {@link org.whispersystems.libaxolotl.state.PreKeyBundle} retrieved from a server.
  4. *
  5. A {@link org.whispersystems.libaxolotl.protocol.PreKeyWhisperMessage} received from a client.
  6. *
  7. A {@link org.whispersystems.libaxolotl.protocol.KeyExchangeMessage} sent to or received from a client.
  8. *
@@ -41,6 +46,7 @@ public class SessionBuilder { private final SessionStore sessionStore; private final PreKeyStore preKeyStore; + private final DeviceKeyStore deviceKeyStore; private final IdentityKeyStore identityKeyStore; private final long recipientId; private final int deviceId; @@ -56,11 +62,13 @@ public class SessionBuilder { */ public SessionBuilder(SessionStore sessionStore, PreKeyStore preKeyStore, + DeviceKeyStore deviceKeyStore, IdentityKeyStore identityKeyStore, long recipientId, int deviceId) { this.sessionStore = sessionStore; this.preKeyStore = preKeyStore; + this.deviceKeyStore = deviceKeyStore; this.identityKeyStore = identityKeyStore; this.recipientId = recipientId; this.deviceId = deviceId; @@ -83,27 +91,93 @@ public class SessionBuilder { public void process(PreKeyWhisperMessage message) throws InvalidKeyIdException, InvalidKeyException, UntrustedIdentityException { - int preKeyId = message.getPreKeyId(); - ECPublicKey theirBaseKey = message.getBaseKey(); - ECPublicKey theirEphemeralKey = message.getWhisperMessage().getSenderEphemeral(); - IdentityKey theirIdentityKey = message.getIdentityKey(); + int messageVersion = message.getMessageVersion(); + IdentityKey theirIdentityKey = message.getIdentityKey(); if (!identityKeyStore.isTrustedIdentity(recipientId, theirIdentityKey)) { throw new UntrustedIdentityException(); } - if (!preKeyStore.contains(preKeyId) && - sessionStore.contains(recipientId, deviceId)) - { - Log.w(TAG, "We've already processed the prekey part, letting bundled message fall through..."); + if (messageVersion == 2) processV2(message); + else if (messageVersion == 3) processV3(message); + else throw new AssertionError("Unknown version: " + messageVersion); + + identityKeyStore.saveIdentity(recipientId, theirIdentityKey); + } + + private void processV3(PreKeyWhisperMessage message) + throws UntrustedIdentityException, InvalidKeyIdException, InvalidKeyException + { + SessionRecord sessionRecord = sessionStore.loadSession(recipientId, deviceId); + int preKeyId = message.getPreKeyId(); + int deviceKeyId = message.getDeviceKeyId(); + ECPublicKey theirBaseKey = message.getBaseKey(); + ECPublicKey theirEphemeralKey = message.getWhisperMessage().getSenderEphemeral(); + IdentityKey theirIdentityKey = message.getIdentityKey(); + + if (sessionRecord.hasSessionState(message.getMessageVersion(), theirBaseKey.serialize())) { + Log.w(TAG, "We've already setup a session for this V3 message, letting bundled message fall through..."); return; } - if (!preKeyStore.contains(preKeyId)) + if (preKeyId >=0 && !preKeyStore.containsPreKey(preKeyId)) throw new InvalidKeyIdException("No such prekey: " + preKeyId); - SessionRecord sessionRecord = sessionStore.load(recipientId, deviceId); - PreKeyRecord preKeyRecord = preKeyStore.load(preKeyId); + if (!deviceKeyStore.containsDeviceKey(deviceKeyId)) + throw new InvalidKeyIdException("No such device key: " + deviceKeyId); + + PreKeyRecord preKeyRecord = preKeyId >= 0 ? preKeyStore.loadPreKey(preKeyId) : null; + DeviceKeyRecord deviceKeyRecord = deviceKeyStore.loadDeviceKey(deviceKeyId); + ECKeyPair ourPreKey = preKeyRecord != null ? preKeyRecord.getKeyPair() : null; + ECPublicKey theirPreKey = theirBaseKey; + ECKeyPair ourBaseKey = deviceKeyRecord.getKeyPair(); + ECKeyPair ourEphemeralKey = ourBaseKey; + IdentityKeyPair ourIdentityKey = identityKeyStore.getIdentityKeyPair(); + boolean simultaneousInitiate = sessionRecord.getSessionState().hasPendingPreKey(); + + if (!simultaneousInitiate) sessionRecord.reset(); + else sessionRecord.archiveCurrentState(); + + RatchetingSessionV3.initializeSession(sessionRecord.getSessionState(), + ourBaseKey, theirBaseKey, + ourEphemeralKey, theirEphemeralKey, + ourPreKey, theirPreKey, + ourIdentityKey, theirIdentityKey); + + sessionRecord.getSessionState().setLocalRegistrationId(identityKeyStore.getLocalRegistrationId()); + sessionRecord.getSessionState().setRemoteRegistrationId(message.getRegistrationId()); + sessionRecord.getSessionState().setAliceBaseKey(theirBaseKey.serialize()); + sessionRecord.getSessionState().setSessionVersion(message.getMessageVersion()); + + if (simultaneousInitiate) sessionRecord.getSessionState().setNeedsRefresh(true); + + sessionStore.storeSession(recipientId, deviceId, sessionRecord); + + if (preKeyId >= 0 && preKeyId != Medium.MAX_VALUE) { + preKeyStore.removePreKey(preKeyId); + } + } + + private void processV2(PreKeyWhisperMessage message) + throws UntrustedIdentityException, InvalidKeyIdException, InvalidKeyException + { + int preKeyId = message.getPreKeyId(); + ECPublicKey theirBaseKey = message.getBaseKey(); + ECPublicKey theirEphemeralKey = message.getWhisperMessage().getSenderEphemeral(); + IdentityKey theirIdentityKey = message.getIdentityKey(); + + if (!preKeyStore.containsPreKey(preKeyId) && + sessionStore.containsSession(recipientId, deviceId)) + { + Log.w(TAG, "We've already processed the prekey part of this V2 session, letting bundled message fall through..."); + return; + } + + if (!preKeyStore.containsPreKey(preKeyId)) + throw new InvalidKeyIdException("No such prekey: " + preKeyId); + + SessionRecord sessionRecord = sessionStore.loadSession(recipientId, deviceId); + PreKeyRecord preKeyRecord = preKeyStore.loadPreKey(preKeyId); ECKeyPair ourBaseKey = preKeyRecord.getKeyPair(); ECKeyPair ourEphemeralKey = ourBaseKey; IdentityKeyPair ourIdentityKey = identityKeyStore.getIdentityKeyPair(); @@ -112,63 +186,77 @@ public class SessionBuilder { if (!simultaneousInitiate) sessionRecord.reset(); else sessionRecord.archiveCurrentState(); - RatchetingSession.initializeSession(sessionRecord.getSessionState(), - ourBaseKey, theirBaseKey, - ourEphemeralKey, theirEphemeralKey, - ourIdentityKey, theirIdentityKey); + RatchetingSessionV2.initializeSession(sessionRecord.getSessionState(), + ourBaseKey, theirBaseKey, + ourEphemeralKey, theirEphemeralKey, + ourIdentityKey, theirIdentityKey); sessionRecord.getSessionState().setLocalRegistrationId(identityKeyStore.getLocalRegistrationId()); sessionRecord.getSessionState().setRemoteRegistrationId(message.getRegistrationId()); + sessionRecord.getSessionState().setSessionVersion(message.getMessageVersion()); if (simultaneousInitiate) sessionRecord.getSessionState().setNeedsRefresh(true); - sessionStore.store(recipientId, deviceId, sessionRecord); + sessionStore.storeSession(recipientId, deviceId, sessionRecord); if (preKeyId != Medium.MAX_VALUE) { - preKeyStore.remove(preKeyId); + preKeyStore.removePreKey(preKeyId); } - - identityKeyStore.saveIdentity(recipientId, theirIdentityKey); } /** - * Build a new session from a {@link org.whispersystems.libaxolotl.state.PreKey} retrieved from + * Build a new session from a {@link org.whispersystems.libaxolotl.state.PreKeyBundle} retrieved from * a server. * * @param preKey A PreKey for the destination recipient, retrieved from a server. - * @throws InvalidKeyException when the {@link org.whispersystems.libaxolotl.state.PreKey} is + * @throws InvalidKeyException when the {@link org.whispersystems.libaxolotl.state.PreKeyBundle} is * badly formatted. * @throws org.whispersystems.libaxolotl.UntrustedIdentityException when the sender's * {@link IdentityKey} is not * trusted. */ - public void process(PreKey preKey) throws InvalidKeyException, UntrustedIdentityException { - + public void process(PreKeyBundle preKey) throws InvalidKeyException, UntrustedIdentityException { if (!identityKeyStore.isTrustedIdentity(recipientId, preKey.getIdentityKey())) { throw new UntrustedIdentityException(); } - SessionRecord sessionRecord = sessionStore.load(recipientId, deviceId); + if (preKey.getDeviceKey() != null && + !Curve.verifySignature(preKey.getIdentityKey().getPublicKey(), + preKey.getDeviceKey().serialize(), + preKey.getDeviceKeySignature())) + { + throw new InvalidKeyException("Invalid signature on device key!"); + } + + SessionRecord sessionRecord = sessionStore.loadSession(recipientId, deviceId); + IdentityKeyPair ourIdentityKey = identityKeyStore.getIdentityKeyPair(); ECKeyPair ourBaseKey = Curve.generateKeyPair(true); ECKeyPair ourEphemeralKey = Curve.generateKeyPair(true); - ECPublicKey theirBaseKey = preKey.getPublicKey(); - ECPublicKey theirEphemeralKey = theirBaseKey; + ECKeyPair ourPreKey = ourBaseKey; + IdentityKey theirIdentityKey = preKey.getIdentityKey(); - IdentityKeyPair ourIdentityKey = identityKeyStore.getIdentityKeyPair(); + ECPublicKey theirPreKey = preKey.getPreKey(); + ECPublicKey theirBaseKey = preKey.getDeviceKey() == null ? preKey.getPreKey() : preKey.getDeviceKey(); + ECPublicKey theirEphemeralKey = theirBaseKey; if (sessionRecord.getSessionState().getNeedsRefresh()) sessionRecord.archiveCurrentState(); else sessionRecord.reset(); - RatchetingSession.initializeSession(sessionRecord.getSessionState(), - ourBaseKey, theirBaseKey, ourEphemeralKey, - theirEphemeralKey, ourIdentityKey, theirIdentityKey); + if (preKey.getDeviceKey() == null) { + RatchetingSessionV2.initializeSession(sessionRecord.getSessionState(), + ourBaseKey, theirBaseKey, ourEphemeralKey, + theirEphemeralKey, ourIdentityKey, theirIdentityKey); + } else { + RatchetingSessionV3.initializeSession(sessionRecord.getSessionState(), + ourBaseKey, theirBaseKey, ourEphemeralKey, theirEphemeralKey, + ourPreKey, theirPreKey, ourIdentityKey, theirIdentityKey); + } - sessionRecord.getSessionState().setPendingPreKey(preKey.getKeyId(), ourBaseKey.getPublicKey()); + sessionRecord.getSessionState().setPendingPreKey(preKey.getPreKeyId(), preKey.getDeviceKeyId(), ourBaseKey.getPublicKey()); sessionRecord.getSessionState().setLocalRegistrationId(identityKeyStore.getLocalRegistrationId()); sessionRecord.getSessionState().setRemoteRegistrationId(preKey.getRegistrationId()); - sessionStore.store(recipientId, deviceId, sessionRecord); - + sessionStore.storeSession(recipientId, deviceId, sessionRecord); identityKeyStore.saveIdentity(recipientId, preKey.getIdentityKey()); } @@ -189,7 +277,7 @@ public class SessionBuilder { } KeyExchangeMessage responseMessage = null; - SessionRecord sessionRecord = sessionStore.load(recipientId, deviceId); + SessionRecord sessionRecord = sessionStore.loadSession(recipientId, deviceId); Log.w(TAG, "Received key exchange with sequence: " + message.getSequence()); @@ -222,13 +310,13 @@ public class SessionBuilder { sessionRecord.reset(); - RatchetingSession.initializeSession(sessionRecord.getSessionState(), - ourBaseKey, message.getBaseKey(), - ourEphemeralKey, message.getEphemeralKey(), - ourIdentityKey, message.getIdentityKey()); + RatchetingSessionV2.initializeSession(sessionRecord.getSessionState(), + ourBaseKey, message.getBaseKey(), + ourEphemeralKey, message.getEphemeralKey(), + ourIdentityKey, message.getIdentityKey()); sessionRecord.getSessionState().setSessionVersion(message.getVersion()); - sessionStore.store(recipientId, deviceId, sessionRecord); + sessionStore.storeSession(recipientId, deviceId, sessionRecord); identityKeyStore.saveIdentity(recipientId, message.getIdentityKey()); @@ -279,10 +367,10 @@ public class SessionBuilder { ECKeyPair baseKey = Curve.generateKeyPair(true); ECKeyPair ephemeralKey = Curve.generateKeyPair(true); IdentityKeyPair identityKey = identityKeyStore.getIdentityKeyPair(); - SessionRecord sessionRecord = sessionStore.load(recipientId, deviceId); + SessionRecord sessionRecord = sessionStore.loadSession(recipientId, deviceId); sessionRecord.getSessionState().setPendingKeyExchange(sequence, baseKey, ephemeralKey, identityKey); - sessionStore.store(recipientId, deviceId, sessionRecord); + sessionStore.storeSession(recipientId, deviceId, sessionRecord); return new KeyExchangeMessage(sequence, flags, baseKey.getPublicKey(), diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/SessionCipher.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/SessionCipher.java index dd910d437..7389d9bad 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/SessionCipher.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/SessionCipher.java @@ -83,30 +83,34 @@ public class SessionCipher { */ public CiphertextMessage encrypt(byte[] paddedMessage) { synchronized (SESSION_LOCK) { - SessionRecord sessionRecord = sessionStore.load(recipientId, deviceId); + SessionRecord sessionRecord = sessionStore.loadSession(recipientId, deviceId); SessionState sessionState = sessionRecord.getSessionState(); ChainKey chainKey = sessionState.getSenderChainKey(); MessageKeys messageKeys = chainKey.getMessageKeys(); ECPublicKey senderEphemeral = sessionState.getSenderEphemeral(); int previousCounter = sessionState.getPreviousCounter(); + int sessionVersion = sessionState.getSessionVersion(); byte[] ciphertextBody = getCiphertext(messageKeys, paddedMessage); - CiphertextMessage ciphertextMessage = new WhisperMessage(messageKeys.getMacKey(), + CiphertextMessage ciphertextMessage = new WhisperMessage(sessionVersion, messageKeys.getMacKey(), senderEphemeral, chainKey.getIndex(), previousCounter, ciphertextBody); if (sessionState.hasPendingPreKey()) { - Pair pendingPreKey = sessionState.getPendingPreKey(); - int localRegistrationId = sessionState.getLocalRegistrationId(); + int pendingPreKeyId = sessionState.getPendingPreKeyId(); + int pendingDeviceKeyId = sessionState.getPendingDeviceKeyId(); + ECPublicKey pendingBaseKey = sessionState.getPendingBaseKey(); + int localRegistrationId = sessionState.getLocalRegistrationId(); - ciphertextMessage = new PreKeyWhisperMessage(localRegistrationId, pendingPreKey.first(), - pendingPreKey.second(), + ciphertextMessage = new PreKeyWhisperMessage(sessionVersion, + localRegistrationId, pendingPreKeyId, + pendingDeviceKeyId, pendingBaseKey, sessionState.getLocalIdentityKey(), (WhisperMessage) ciphertextMessage); } sessionState.setSenderChainKey(chainKey.getNextChainKey()); - sessionStore.store(recipientId, deviceId, sessionRecord); + sessionStore.storeSession(recipientId, deviceId, sessionRecord); return ciphertextMessage; } } @@ -126,14 +130,14 @@ public class SessionCipher { throws InvalidMessageException, DuplicateMessageException, LegacyMessageException { synchronized (SESSION_LOCK) { - SessionRecord sessionRecord = sessionStore.load(recipientId, deviceId); + SessionRecord sessionRecord = sessionStore.loadSession(recipientId, deviceId); SessionState sessionState = sessionRecord.getSessionState(); List previousStates = sessionRecord.getPreviousSessionStates(); List exceptions = new LinkedList<>(); try { byte[] plaintext = decrypt(sessionState, ciphertext); - sessionStore.store(recipientId, deviceId, sessionRecord); + sessionStore.storeSession(recipientId, deviceId, sessionRecord); return plaintext; } catch (InvalidMessageException e) { @@ -143,7 +147,7 @@ public class SessionCipher { for (SessionState previousState : previousStates) { try { byte[] plaintext = decrypt(previousState, ciphertext); - sessionStore.store(recipientId, deviceId, sessionRecord); + sessionStore.storeSession(recipientId, deviceId, sessionRecord); return plaintext; } catch (InvalidMessageException e) { @@ -181,7 +185,7 @@ public class SessionCipher { public int getRemoteRegistrationId() { synchronized (SESSION_LOCK) { - SessionRecord record = sessionStore.load(recipientId, deviceId); + SessionRecord record = sessionStore.loadSession(recipientId, deviceId); return record.getSessionState().getRemoteRegistrationId(); } } diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/ecc/Curve.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/ecc/Curve.java index c69c3b826..4d26962da 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/ecc/Curve.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/ecc/Curve.java @@ -55,4 +55,24 @@ public class Curve { throw new InvalidKeyException("Unknown type: " + publicKey.getType()); } } + + public static boolean verifySignature(ECPublicKey signingKey, byte[] message, byte[] signature) + throws InvalidKeyException + { + if (signingKey.getType() == DJB_TYPE) { + return Curve25519.verifySignature(signingKey, message, signature); + } else { + throw new InvalidKeyException("Unknown type: " + signingKey.getType()); + } + } + + public static byte[] calculateSignature(ECPrivateKey signingKey, byte[] message) + throws InvalidKeyException + { + if (signingKey.getType() == DJB_TYPE) { + return Curve25519.calculateSignature(signingKey, message); + } else { + throw new InvalidKeyException("Unknown type: " + signingKey.getType()); + } + } } diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/CiphertextMessage.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/CiphertextMessage.java index b3213126b..52d11509a 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/CiphertextMessage.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/CiphertextMessage.java @@ -19,7 +19,7 @@ package org.whispersystems.libaxolotl.protocol; public interface CiphertextMessage { public static final int UNSUPPORTED_VERSION = 1; - public static final int CURRENT_VERSION = 2; + public static final int CURRENT_VERSION = 3; public static final int WHISPER_TYPE = 2; public static final int PREKEY_TYPE = 3; diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/PreKeyWhisperMessage.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/PreKeyWhisperMessage.java index 801babf53..f7f90346d 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/PreKeyWhisperMessage.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/PreKeyWhisperMessage.java @@ -34,6 +34,7 @@ public class PreKeyWhisperMessage implements CiphertextMessage { private final int version; private final int registrationId; private final int preKeyId; + private final int deviceKeyId; private final ECPublicKey baseKey; private final IdentityKey identityKey; private final WhisperMessage message; @@ -53,9 +54,10 @@ public class PreKeyWhisperMessage implements CiphertextMessage { = WhisperProtos.PreKeyWhisperMessage.parseFrom(ByteString.copyFrom(serialized, 1, serialized.length-1)); - if (!preKeyWhisperMessage.hasPreKeyId() || - !preKeyWhisperMessage.hasBaseKey() || - !preKeyWhisperMessage.hasIdentityKey() || + if ((version == 2 && !preKeyWhisperMessage.hasPreKeyId()) || + (version == 3 && !preKeyWhisperMessage.hasDeviceKeyId()) || + !preKeyWhisperMessage.hasBaseKey() || + !preKeyWhisperMessage.hasIdentityKey() || !preKeyWhisperMessage.hasMessage()) { throw new InvalidMessageException("Incomplete message."); @@ -63,32 +65,31 @@ public class PreKeyWhisperMessage implements CiphertextMessage { this.serialized = serialized; this.registrationId = preKeyWhisperMessage.getRegistrationId(); - this.preKeyId = preKeyWhisperMessage.getPreKeyId(); + this.preKeyId = preKeyWhisperMessage.hasPreKeyId() ? preKeyWhisperMessage.getPreKeyId() : -1; + this.deviceKeyId = preKeyWhisperMessage.hasDeviceKeyId() ? preKeyWhisperMessage.getDeviceKeyId() : -1; this.baseKey = Curve.decodePoint(preKeyWhisperMessage.getBaseKey().toByteArray(), 0); this.identityKey = new IdentityKey(Curve.decodePoint(preKeyWhisperMessage.getIdentityKey().toByteArray(), 0)); this.message = new WhisperMessage(preKeyWhisperMessage.getMessage().toByteArray()); - } catch (InvalidProtocolBufferException e) { - throw new InvalidMessageException(e); - } catch (InvalidKeyException e) { - throw new InvalidMessageException(e); - } catch (LegacyMessageException e) { + } catch (InvalidProtocolBufferException | InvalidKeyException | LegacyMessageException e) { throw new InvalidMessageException(e); } } - public PreKeyWhisperMessage(int registrationId, int preKeyId, ECPublicKey baseKey, - IdentityKey identityKey, WhisperMessage message) + public PreKeyWhisperMessage(int messageVersion, int registrationId, int preKeyId, int deviceKeyId, + ECPublicKey baseKey, IdentityKey identityKey, WhisperMessage message) { - this.version = CiphertextMessage.CURRENT_VERSION; + this.version = messageVersion; this.registrationId = registrationId; this.preKeyId = preKeyId; + this.deviceKeyId = deviceKeyId; this.baseKey = baseKey; this.identityKey = identityKey; this.message = message; - byte[] versionBytes = {ByteUtil.intsToByteHighAndLow(CURRENT_VERSION, this.version)}; + byte[] versionBytes = {ByteUtil.intsToByteHighAndLow(this.version, CURRENT_VERSION)}; byte[] messageBytes = WhisperProtos.PreKeyWhisperMessage.newBuilder() .setPreKeyId(preKeyId) + .setDeviceKeyId(deviceKeyId) .setBaseKey(ByteString.copyFrom(baseKey.serialize())) .setIdentityKey(ByteString.copyFrom(identityKey.serialize())) .setMessage(ByteString.copyFrom(message.serialize())) @@ -98,6 +99,10 @@ public class PreKeyWhisperMessage implements CiphertextMessage { this.serialized = ByteUtil.combine(versionBytes, messageBytes); } + public int getMessageVersion() { + return version; + } + public IdentityKey getIdentityKey() { return identityKey; } @@ -110,6 +115,10 @@ public class PreKeyWhisperMessage implements CiphertextMessage { return preKeyId; } + public int getDeviceKeyId() { + return deviceKeyId; + } + public ECPublicKey getBaseKey() { return baseKey; } diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperMessage.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperMessage.java index 53a9629c8..b104e237d 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperMessage.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperMessage.java @@ -37,6 +37,7 @@ public class WhisperMessage implements CiphertextMessage { private static final int MAC_LENGTH = 8; + private final int messageVersion; private final ECPublicKey senderEphemeral; private final int counter; private final int previousCounter; @@ -54,7 +55,7 @@ public class WhisperMessage implements CiphertextMessage { throw new LegacyMessageException("Legacy message: " + ByteUtil.highBitsToInt(version)); } - if (ByteUtil.highBitsToInt(version) != CURRENT_VERSION) { + if (ByteUtil.highBitsToInt(version) > CURRENT_VERSION) { throw new InvalidMessageException("Unknown version: " + ByteUtil.highBitsToInt(version)); } @@ -69,22 +70,19 @@ public class WhisperMessage implements CiphertextMessage { this.serialized = serialized; this.senderEphemeral = Curve.decodePoint(whisperMessage.getEphemeralKey().toByteArray(), 0); + this.messageVersion = ByteUtil.highBitsToInt(version); this.counter = whisperMessage.getCounter(); this.previousCounter = whisperMessage.getPreviousCounter(); this.ciphertext = whisperMessage.getCiphertext().toByteArray(); - } catch (InvalidProtocolBufferException e) { - throw new InvalidMessageException(e); - } catch (InvalidKeyException e) { - throw new InvalidMessageException(e); - } catch (ParseException e) { + } catch (InvalidProtocolBufferException | InvalidKeyException | ParseException e) { throw new InvalidMessageException(e); } } - public WhisperMessage(SecretKeySpec macKey, ECPublicKey senderEphemeral, + public WhisperMessage(int messageVersion, SecretKeySpec macKey, ECPublicKey senderEphemeral, int counter, int previousCounter, byte[] ciphertext) { - byte[] version = {ByteUtil.intsToByteHighAndLow(CURRENT_VERSION, CURRENT_VERSION)}; + byte[] version = {ByteUtil.intsToByteHighAndLow(messageVersion, CURRENT_VERSION)}; byte[] message = WhisperProtos.WhisperMessage.newBuilder() .setEphemeralKey(ByteString.copyFrom(senderEphemeral.serialize())) .setCounter(counter) @@ -98,12 +96,17 @@ public class WhisperMessage implements CiphertextMessage { this.counter = counter; this.previousCounter = previousCounter; this.ciphertext = ciphertext; + this.messageVersion = messageVersion; } public ECPublicKey getSenderEphemeral() { return senderEphemeral; } + public int getMessageVersion() { + return messageVersion; + } + public int getCounter() { return counter; } @@ -131,9 +134,7 @@ public class WhisperMessage implements CiphertextMessage { byte[] fullMac = mac.doFinal(serialized); return ByteUtil.trim(fullMac, MAC_LENGTH); - } catch (NoSuchAlgorithmException e) { - throw new AssertionError(e); - } catch (java.security.InvalidKeyException e) { + } catch (NoSuchAlgorithmException | java.security.InvalidKeyException e) { throw new AssertionError(e); } } diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperProtos.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperProtos.java index f971faddc..bf06328b7 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperProtos.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperProtos.java @@ -10,389 +10,95 @@ public final class WhisperProtos { } public interface WhisperMessageOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional bytes ephemeralKey = 1; + /** + * optional bytes ephemeralKey = 1; + */ boolean hasEphemeralKey(); + /** + * optional bytes ephemeralKey = 1; + */ com.google.protobuf.ByteString getEphemeralKey(); - + // optional uint32 counter = 2; + /** + * optional uint32 counter = 2; + */ boolean hasCounter(); + /** + * optional uint32 counter = 2; + */ int getCounter(); - + // optional uint32 previousCounter = 3; + /** + * optional uint32 previousCounter = 3; + */ boolean hasPreviousCounter(); + /** + * optional uint32 previousCounter = 3; + */ int getPreviousCounter(); - + // optional bytes ciphertext = 4; + /** + * optional bytes ciphertext = 4; + */ boolean hasCiphertext(); + /** + * optional bytes ciphertext = 4; + */ com.google.protobuf.ByteString getCiphertext(); } + /** + * Protobuf type {@code textsecure.WhisperMessage} + */ public static final class WhisperMessage extends com.google.protobuf.GeneratedMessage implements WhisperMessageOrBuilder { // Use WhisperMessage.newBuilder() to construct. - private WhisperMessage(Builder builder) { + private WhisperMessage(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private WhisperMessage(boolean noInit) {} - + private WhisperMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final WhisperMessage defaultInstance; public static WhisperMessage getDefaultInstance() { return defaultInstance; } - + public WhisperMessage getDefaultInstanceForType() { return defaultInstance; } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_fieldAccessorTable; - } - - private int bitField0_; - // optional bytes ephemeralKey = 1; - public static final int EPHEMERALKEY_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString ephemeralKey_; - public boolean hasEphemeralKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.google.protobuf.ByteString getEphemeralKey() { - return ephemeralKey_; - } - - // optional uint32 counter = 2; - public static final int COUNTER_FIELD_NUMBER = 2; - private int counter_; - public boolean hasCounter() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public int getCounter() { - return counter_; - } - - // optional uint32 previousCounter = 3; - public static final int PREVIOUSCOUNTER_FIELD_NUMBER = 3; - private int previousCounter_; - public boolean hasPreviousCounter() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public int getPreviousCounter() { - return previousCounter_; - } - - // optional bytes ciphertext = 4; - public static final int CIPHERTEXT_FIELD_NUMBER = 4; - private com.google.protobuf.ByteString ciphertext_; - public boolean hasCiphertext() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public com.google.protobuf.ByteString getCiphertext() { - return ciphertext_; - } - - private void initFields() { - ephemeralKey_ = com.google.protobuf.ByteString.EMPTY; - counter_ = 0; - previousCounter_ = 0; - ciphertext_ = com.google.protobuf.ByteString.EMPTY; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, ephemeralKey_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeUInt32(2, counter_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeUInt32(3, previousCounter_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(4, ciphertext_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, ephemeralKey_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(2, counter_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(3, previousCounter_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(4, ciphertext_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; + + private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; } - - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage 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.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( + private WhisperMessage( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_fieldAccessorTable; - } - - // Construct using org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - ephemeralKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - counter_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - previousCounter_ = 0; - bitField0_ = (bitField0_ & ~0x00000004); - ciphertext_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.getDescriptor(); - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage getDefaultInstanceForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.getDefaultInstance(); - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage build() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage buildPartial() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage result = new org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.ephemeralKey_ = ephemeralKey_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.counter_ = counter_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.previousCounter_ = previousCounter_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.ciphertext_ = ciphertext_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage) { - return mergeFrom((org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage other) { - if (other == org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.getDefaultInstance()) return this; - if (other.hasEphemeralKey()) { - setEphemeralKey(other.getEphemeralKey()); - } - if (other.hasCounter()) { - setCounter(other.getCounter()); - } - if (other.hasPreviousCounter()) { - setPreviousCounter(other.getPreviousCounter()); - } - if (other.hasCiphertext()) { - setCiphertext(other.getCiphertext()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { int tag = input.readTag(); switch (tag) { case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; + break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; } break; } @@ -418,387 +124,266 @@ public final class WhisperProtos { } } } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); } - - private int bitField0_; - - // optional bytes ephemeralKey = 1; - private com.google.protobuf.ByteString ephemeralKey_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasEphemeralKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.google.protobuf.ByteString getEphemeralKey() { - return ephemeralKey_; - } - public Builder setEphemeralKey(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - ephemeralKey_ = value; - onChanged(); - return this; - } - public Builder clearEphemeralKey() { - bitField0_ = (bitField0_ & ~0x00000001); - ephemeralKey_ = getDefaultInstance().getEphemeralKey(); - onChanged(); - return this; - } - - // optional uint32 counter = 2; - private int counter_ ; - public boolean hasCounter() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public int getCounter() { - return counter_; - } - public Builder setCounter(int value) { - bitField0_ |= 0x00000002; - counter_ = value; - onChanged(); - return this; - } - public Builder clearCounter() { - bitField0_ = (bitField0_ & ~0x00000002); - counter_ = 0; - onChanged(); - return this; - } - - // optional uint32 previousCounter = 3; - private int previousCounter_ ; - public boolean hasPreviousCounter() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public int getPreviousCounter() { - return previousCounter_; - } - public Builder setPreviousCounter(int value) { - bitField0_ |= 0x00000004; - previousCounter_ = value; - onChanged(); - return this; - } - public Builder clearPreviousCounter() { - bitField0_ = (bitField0_ & ~0x00000004); - previousCounter_ = 0; - onChanged(); - return this; - } - - // optional bytes ciphertext = 4; - private com.google.protobuf.ByteString ciphertext_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasCiphertext() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public com.google.protobuf.ByteString getCiphertext() { - return ciphertext_; - } - public Builder setCiphertext(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - ciphertext_ = value; - onChanged(); - return this; - } - public Builder clearCiphertext() { - bitField0_ = (bitField0_ & ~0x00000008); - ciphertext_ = getDefaultInstance().getCiphertext(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:textsecure.WhisperMessage) } - - static { - defaultInstance = new WhisperMessage(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:textsecure.WhisperMessage) - } - - public interface PreKeyWhisperMessageOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional uint32 registrationId = 5; - boolean hasRegistrationId(); - int getRegistrationId(); - - // optional uint32 preKeyId = 1; - boolean hasPreKeyId(); - int getPreKeyId(); - - // optional bytes baseKey = 2; - boolean hasBaseKey(); - com.google.protobuf.ByteString getBaseKey(); - - // optional bytes identityKey = 3; - boolean hasIdentityKey(); - com.google.protobuf.ByteString getIdentityKey(); - - // optional bytes message = 4; - boolean hasMessage(); - com.google.protobuf.ByteString getMessage(); - } - public static final class PreKeyWhisperMessage extends - com.google.protobuf.GeneratedMessage - implements PreKeyWhisperMessageOrBuilder { - // Use PreKeyWhisperMessage.newBuilder() to construct. - private PreKeyWhisperMessage(Builder builder) { - super(builder); - } - private PreKeyWhisperMessage(boolean noInit) {} - - private static final PreKeyWhisperMessage defaultInstance; - public static PreKeyWhisperMessage getDefaultInstance() { - return defaultInstance; - } - - public PreKeyWhisperMessage getDefaultInstanceForType() { - return defaultInstance; - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_descriptor; + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_fieldAccessorTable; + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.Builder.class); } - + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public WhisperMessage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new WhisperMessage(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + private int bitField0_; - // optional uint32 registrationId = 5; - public static final int REGISTRATIONID_FIELD_NUMBER = 5; - private int registrationId_; - public boolean hasRegistrationId() { + // optional bytes ephemeralKey = 1; + public static final int EPHEMERALKEY_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString ephemeralKey_; + /** + * optional bytes ephemeralKey = 1; + */ + public boolean hasEphemeralKey() { return ((bitField0_ & 0x00000001) == 0x00000001); } - public int getRegistrationId() { - return registrationId_; + /** + * optional bytes ephemeralKey = 1; + */ + public com.google.protobuf.ByteString getEphemeralKey() { + return ephemeralKey_; } - - // optional uint32 preKeyId = 1; - public static final int PREKEYID_FIELD_NUMBER = 1; - private int preKeyId_; - public boolean hasPreKeyId() { + + // optional uint32 counter = 2; + public static final int COUNTER_FIELD_NUMBER = 2; + private int counter_; + /** + * optional uint32 counter = 2; + */ + public boolean hasCounter() { return ((bitField0_ & 0x00000002) == 0x00000002); } - public int getPreKeyId() { - return preKeyId_; + /** + * optional uint32 counter = 2; + */ + public int getCounter() { + return counter_; } - - // optional bytes baseKey = 2; - public static final int BASEKEY_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString baseKey_; - public boolean hasBaseKey() { + + // optional uint32 previousCounter = 3; + public static final int PREVIOUSCOUNTER_FIELD_NUMBER = 3; + private int previousCounter_; + /** + * optional uint32 previousCounter = 3; + */ + public boolean hasPreviousCounter() { return ((bitField0_ & 0x00000004) == 0x00000004); } - public com.google.protobuf.ByteString getBaseKey() { - return baseKey_; + /** + * optional uint32 previousCounter = 3; + */ + public int getPreviousCounter() { + return previousCounter_; } - - // optional bytes identityKey = 3; - public static final int IDENTITYKEY_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString identityKey_; - public boolean hasIdentityKey() { + + // optional bytes ciphertext = 4; + public static final int CIPHERTEXT_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString ciphertext_; + /** + * optional bytes ciphertext = 4; + */ + public boolean hasCiphertext() { return ((bitField0_ & 0x00000008) == 0x00000008); } - public com.google.protobuf.ByteString getIdentityKey() { - return identityKey_; + /** + * optional bytes ciphertext = 4; + */ + public com.google.protobuf.ByteString getCiphertext() { + return ciphertext_; } - - // optional bytes message = 4; - public static final int MESSAGE_FIELD_NUMBER = 4; - private com.google.protobuf.ByteString message_; - public boolean hasMessage() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - public com.google.protobuf.ByteString getMessage() { - return message_; - } - + private void initFields() { - registrationId_ = 0; - preKeyId_ = 0; - baseKey_ = com.google.protobuf.ByteString.EMPTY; - identityKey_ = com.google.protobuf.ByteString.EMPTY; - message_ = com.google.protobuf.ByteString.EMPTY; + ephemeralKey_ = com.google.protobuf.ByteString.EMPTY; + counter_ = 0; + previousCounter_ = 0; + ciphertext_ = com.google.protobuf.ByteString.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, ephemeralKey_); + } if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeUInt32(1, preKeyId_); + output.writeUInt32(2, counter_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(2, baseKey_); + output.writeUInt32(3, previousCounter_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(3, identityKey_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeBytes(4, message_); - } - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeUInt32(5, registrationId_); + output.writeBytes(4, ciphertext_); } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, ephemeralKey_); + } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(1, preKeyId_); + .computeUInt32Size(2, counter_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, baseKey_); + .computeUInt32Size(3, previousCounter_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, identityKey_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(4, message_); - } - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(5, registrationId_); + .computeBytesSize(4, ciphertext_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } - + private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } - - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( + + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom(byte[] data) + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseDelimitedFrom(java.io.InputStream input) + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseDelimitedFrom( + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage prototype) { + public static Builder newBuilder(org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** + * Protobuf type {@code textsecure.WhisperMessage} + */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessageOrBuilder { + implements org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessageOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_descriptor; + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_fieldAccessorTable; + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.Builder.class); } - - // Construct using org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.newBuilder() + + // Construct using org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.newBuilder() private Builder() { maybeForceBuilderInitialization(); } - - private Builder(BuilderParent parent) { + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } @@ -809,35 +394,776 @@ public final class WhisperProtos { private static Builder create() { return new Builder(); } - + + public Builder clear() { + super.clear(); + ephemeralKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + counter_ = 0; + bitField0_ = (bitField0_ & ~0x00000002); + previousCounter_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); + ciphertext_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_descriptor; + } + + public org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.getDefaultInstance(); + } + + public org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage build() { + org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage buildPartial() { + org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage result = new org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.ephemeralKey_ = ephemeralKey_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.counter_ = counter_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.previousCounter_ = previousCounter_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.ciphertext_ = ciphertext_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage) { + return mergeFrom((org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage other) { + if (other == org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.getDefaultInstance()) return this; + if (other.hasEphemeralKey()) { + setEphemeralKey(other.getEphemeralKey()); + } + if (other.hasCounter()) { + setCounter(other.getCounter()); + } + if (other.hasPreviousCounter()) { + setPreviousCounter(other.getPreviousCounter()); + } + if (other.hasCiphertext()) { + setCiphertext(other.getCiphertext()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // optional bytes ephemeralKey = 1; + private com.google.protobuf.ByteString ephemeralKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes ephemeralKey = 1; + */ + public boolean hasEphemeralKey() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional bytes ephemeralKey = 1; + */ + public com.google.protobuf.ByteString getEphemeralKey() { + return ephemeralKey_; + } + /** + * optional bytes ephemeralKey = 1; + */ + public Builder setEphemeralKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + ephemeralKey_ = value; + onChanged(); + return this; + } + /** + * optional bytes ephemeralKey = 1; + */ + public Builder clearEphemeralKey() { + bitField0_ = (bitField0_ & ~0x00000001); + ephemeralKey_ = getDefaultInstance().getEphemeralKey(); + onChanged(); + return this; + } + + // optional uint32 counter = 2; + private int counter_ ; + /** + * optional uint32 counter = 2; + */ + public boolean hasCounter() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional uint32 counter = 2; + */ + public int getCounter() { + return counter_; + } + /** + * optional uint32 counter = 2; + */ + public Builder setCounter(int value) { + bitField0_ |= 0x00000002; + counter_ = value; + onChanged(); + return this; + } + /** + * optional uint32 counter = 2; + */ + public Builder clearCounter() { + bitField0_ = (bitField0_ & ~0x00000002); + counter_ = 0; + onChanged(); + return this; + } + + // optional uint32 previousCounter = 3; + private int previousCounter_ ; + /** + * optional uint32 previousCounter = 3; + */ + public boolean hasPreviousCounter() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional uint32 previousCounter = 3; + */ + public int getPreviousCounter() { + return previousCounter_; + } + /** + * optional uint32 previousCounter = 3; + */ + public Builder setPreviousCounter(int value) { + bitField0_ |= 0x00000004; + previousCounter_ = value; + onChanged(); + return this; + } + /** + * optional uint32 previousCounter = 3; + */ + public Builder clearPreviousCounter() { + bitField0_ = (bitField0_ & ~0x00000004); + previousCounter_ = 0; + onChanged(); + return this; + } + + // optional bytes ciphertext = 4; + private com.google.protobuf.ByteString ciphertext_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes ciphertext = 4; + */ + public boolean hasCiphertext() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional bytes ciphertext = 4; + */ + public com.google.protobuf.ByteString getCiphertext() { + return ciphertext_; + } + /** + * optional bytes ciphertext = 4; + */ + public Builder setCiphertext(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + ciphertext_ = value; + onChanged(); + return this; + } + /** + * optional bytes ciphertext = 4; + */ + public Builder clearCiphertext() { + bitField0_ = (bitField0_ & ~0x00000008); + ciphertext_ = getDefaultInstance().getCiphertext(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:textsecure.WhisperMessage) + } + + static { + defaultInstance = new WhisperMessage(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:textsecure.WhisperMessage) + } + + public interface PreKeyWhisperMessageOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional uint32 registrationId = 5; + /** + * optional uint32 registrationId = 5; + */ + boolean hasRegistrationId(); + /** + * optional uint32 registrationId = 5; + */ + int getRegistrationId(); + + // optional uint32 preKeyId = 1; + /** + * optional uint32 preKeyId = 1; + */ + boolean hasPreKeyId(); + /** + * optional uint32 preKeyId = 1; + */ + int getPreKeyId(); + + // optional uint32 deviceKeyId = 6; + /** + * optional uint32 deviceKeyId = 6; + */ + boolean hasDeviceKeyId(); + /** + * optional uint32 deviceKeyId = 6; + */ + int getDeviceKeyId(); + + // optional bytes baseKey = 2; + /** + * optional bytes baseKey = 2; + */ + boolean hasBaseKey(); + /** + * optional bytes baseKey = 2; + */ + com.google.protobuf.ByteString getBaseKey(); + + // optional bytes identityKey = 3; + /** + * optional bytes identityKey = 3; + */ + boolean hasIdentityKey(); + /** + * optional bytes identityKey = 3; + */ + com.google.protobuf.ByteString getIdentityKey(); + + // optional bytes message = 4; + /** + * optional bytes message = 4; + * + *
+     * WhisperMessage
+     * 
+ */ + boolean hasMessage(); + /** + * optional bytes message = 4; + * + *
+     * WhisperMessage
+     * 
+ */ + com.google.protobuf.ByteString getMessage(); + } + /** + * Protobuf type {@code textsecure.PreKeyWhisperMessage} + */ + public static final class PreKeyWhisperMessage extends + com.google.protobuf.GeneratedMessage + implements PreKeyWhisperMessageOrBuilder { + // Use PreKeyWhisperMessage.newBuilder() to construct. + private PreKeyWhisperMessage(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private PreKeyWhisperMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final PreKeyWhisperMessage defaultInstance; + public static PreKeyWhisperMessage getDefaultInstance() { + return defaultInstance; + } + + public PreKeyWhisperMessage getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private PreKeyWhisperMessage( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000002; + preKeyId_ = input.readUInt32(); + break; + } + case 18: { + bitField0_ |= 0x00000008; + baseKey_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000010; + identityKey_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000020; + message_ = input.readBytes(); + break; + } + case 40: { + bitField0_ |= 0x00000001; + registrationId_ = input.readUInt32(); + break; + } + case 48: { + bitField0_ |= 0x00000004; + deviceKeyId_ = input.readUInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public PreKeyWhisperMessage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PreKeyWhisperMessage(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // optional uint32 registrationId = 5; + public static final int REGISTRATIONID_FIELD_NUMBER = 5; + private int registrationId_; + /** + * optional uint32 registrationId = 5; + */ + public boolean hasRegistrationId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional uint32 registrationId = 5; + */ + public int getRegistrationId() { + return registrationId_; + } + + // optional uint32 preKeyId = 1; + public static final int PREKEYID_FIELD_NUMBER = 1; + private int preKeyId_; + /** + * optional uint32 preKeyId = 1; + */ + public boolean hasPreKeyId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional uint32 preKeyId = 1; + */ + public int getPreKeyId() { + return preKeyId_; + } + + // optional uint32 deviceKeyId = 6; + public static final int DEVICEKEYID_FIELD_NUMBER = 6; + private int deviceKeyId_; + /** + * optional uint32 deviceKeyId = 6; + */ + public boolean hasDeviceKeyId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional uint32 deviceKeyId = 6; + */ + public int getDeviceKeyId() { + return deviceKeyId_; + } + + // optional bytes baseKey = 2; + public static final int BASEKEY_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString baseKey_; + /** + * optional bytes baseKey = 2; + */ + public boolean hasBaseKey() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional bytes baseKey = 2; + */ + public com.google.protobuf.ByteString getBaseKey() { + return baseKey_; + } + + // optional bytes identityKey = 3; + public static final int IDENTITYKEY_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString identityKey_; + /** + * optional bytes identityKey = 3; + */ + public boolean hasIdentityKey() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional bytes identityKey = 3; + */ + public com.google.protobuf.ByteString getIdentityKey() { + return identityKey_; + } + + // optional bytes message = 4; + public static final int MESSAGE_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString message_; + /** + * optional bytes message = 4; + * + *
+     * WhisperMessage
+     * 
+ */ + public boolean hasMessage() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * optional bytes message = 4; + * + *
+     * WhisperMessage
+     * 
+ */ + public com.google.protobuf.ByteString getMessage() { + return message_; + } + + private void initFields() { + registrationId_ = 0; + preKeyId_ = 0; + deviceKeyId_ = 0; + baseKey_ = com.google.protobuf.ByteString.EMPTY; + identityKey_ = com.google.protobuf.ByteString.EMPTY; + message_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeUInt32(1, preKeyId_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(2, baseKey_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(3, identityKey_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBytes(4, message_); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeUInt32(5, registrationId_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeUInt32(6, deviceKeyId_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, preKeyId_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, baseKey_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, identityKey_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, message_); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(5, registrationId_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(6, deviceKeyId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code textsecure.PreKeyWhisperMessage} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.Builder.class); + } + + // Construct using org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + public Builder clear() { super.clear(); registrationId_ = 0; bitField0_ = (bitField0_ & ~0x00000001); preKeyId_ = 0; bitField0_ = (bitField0_ & ~0x00000002); - baseKey_ = com.google.protobuf.ByteString.EMPTY; + deviceKeyId_ = 0; bitField0_ = (bitField0_ & ~0x00000004); - identityKey_ = com.google.protobuf.ByteString.EMPTY; + baseKey_ = com.google.protobuf.ByteString.EMPTY; bitField0_ = (bitField0_ & ~0x00000008); - message_ = com.google.protobuf.ByteString.EMPTY; + identityKey_ = com.google.protobuf.ByteString.EMPTY; bitField0_ = (bitField0_ & ~0x00000010); + message_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000020); return this; } - + public Builder clone() { return create().mergeFrom(buildPartial()); } - + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.getDescriptor(); + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_descriptor; } - + public org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage getDefaultInstanceForType() { return org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.getDefaultInstance(); } - + public org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage build() { org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage result = buildPartial(); if (!result.isInitialized()) { @@ -845,17 +1171,7 @@ public final class WhisperProtos { } return result; } - - private org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - + public org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage buildPartial() { org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage result = new org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage(this); int from_bitField0_ = bitField0_; @@ -871,20 +1187,24 @@ public final class WhisperProtos { if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } - result.baseKey_ = baseKey_; + result.deviceKeyId_ = deviceKeyId_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } - result.identityKey_ = identityKey_; + result.baseKey_ = baseKey_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } + result.identityKey_ = identityKey_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } result.message_ = message_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } - + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage) { return mergeFrom((org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage)other); @@ -893,7 +1213,7 @@ public final class WhisperProtos { return this; } } - + public Builder mergeFrom(org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage other) { if (other == org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.getDefaultInstance()) return this; if (other.hasRegistrationId()) { @@ -902,6 +1222,9 @@ public final class WhisperProtos { if (other.hasPreKeyId()) { setPreKeyId(other.getPreKeyId()); } + if (other.hasDeviceKeyId()) { + setDeviceKeyId(other.getDeviceKeyId()); + } if (other.hasBaseKey()) { setBaseKey(other.getBaseKey()); } @@ -914,575 +1237,355 @@ public final class WhisperProtos { this.mergeUnknownFields(other.getUnknownFields()); return this; } - + public final boolean isInitialized() { return true; } - + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000002; - preKeyId_ = input.readUInt32(); - break; - } - case 18: { - bitField0_ |= 0x00000004; - baseKey_ = input.readBytes(); - break; - } - case 26: { - bitField0_ |= 0x00000008; - identityKey_ = input.readBytes(); - break; - } - case 34: { - bitField0_ |= 0x00000010; - message_ = input.readBytes(); - break; - } - case 40: { - bitField0_ |= 0x00000001; - registrationId_ = input.readUInt32(); - break; - } + org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - private int bitField0_; - + // optional uint32 registrationId = 5; private int registrationId_ ; + /** + * optional uint32 registrationId = 5; + */ public boolean hasRegistrationId() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional uint32 registrationId = 5; + */ public int getRegistrationId() { return registrationId_; } + /** + * optional uint32 registrationId = 5; + */ public Builder setRegistrationId(int value) { bitField0_ |= 0x00000001; registrationId_ = value; onChanged(); return this; } + /** + * optional uint32 registrationId = 5; + */ public Builder clearRegistrationId() { bitField0_ = (bitField0_ & ~0x00000001); registrationId_ = 0; onChanged(); return this; } - + // optional uint32 preKeyId = 1; private int preKeyId_ ; + /** + * optional uint32 preKeyId = 1; + */ public boolean hasPreKeyId() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional uint32 preKeyId = 1; + */ public int getPreKeyId() { return preKeyId_; } + /** + * optional uint32 preKeyId = 1; + */ public Builder setPreKeyId(int value) { bitField0_ |= 0x00000002; preKeyId_ = value; onChanged(); return this; } + /** + * optional uint32 preKeyId = 1; + */ public Builder clearPreKeyId() { bitField0_ = (bitField0_ & ~0x00000002); preKeyId_ = 0; onChanged(); return this; } - - // optional bytes baseKey = 2; - private com.google.protobuf.ByteString baseKey_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasBaseKey() { + + // optional uint32 deviceKeyId = 6; + private int deviceKeyId_ ; + /** + * optional uint32 deviceKeyId = 6; + */ + public boolean hasDeviceKeyId() { return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional uint32 deviceKeyId = 6; + */ + public int getDeviceKeyId() { + return deviceKeyId_; + } + /** + * optional uint32 deviceKeyId = 6; + */ + public Builder setDeviceKeyId(int value) { + bitField0_ |= 0x00000004; + deviceKeyId_ = value; + onChanged(); + return this; + } + /** + * optional uint32 deviceKeyId = 6; + */ + public Builder clearDeviceKeyId() { + bitField0_ = (bitField0_ & ~0x00000004); + deviceKeyId_ = 0; + onChanged(); + return this; + } + + // optional bytes baseKey = 2; + private com.google.protobuf.ByteString baseKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes baseKey = 2; + */ + public boolean hasBaseKey() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional bytes baseKey = 2; + */ public com.google.protobuf.ByteString getBaseKey() { return baseKey_; } + /** + * optional bytes baseKey = 2; + */ public Builder setBaseKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000008; baseKey_ = value; onChanged(); return this; } + /** + * optional bytes baseKey = 2; + */ public Builder clearBaseKey() { - bitField0_ = (bitField0_ & ~0x00000004); + bitField0_ = (bitField0_ & ~0x00000008); baseKey_ = getDefaultInstance().getBaseKey(); onChanged(); return this; } - + // optional bytes identityKey = 3; private com.google.protobuf.ByteString identityKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes identityKey = 3; + */ public boolean hasIdentityKey() { - return ((bitField0_ & 0x00000008) == 0x00000008); + return ((bitField0_ & 0x00000010) == 0x00000010); } + /** + * optional bytes identityKey = 3; + */ public com.google.protobuf.ByteString getIdentityKey() { return identityKey_; } + /** + * optional bytes identityKey = 3; + */ public Builder setIdentityKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000010; identityKey_ = value; onChanged(); return this; } + /** + * optional bytes identityKey = 3; + */ public Builder clearIdentityKey() { - bitField0_ = (bitField0_ & ~0x00000008); + bitField0_ = (bitField0_ & ~0x00000010); identityKey_ = getDefaultInstance().getIdentityKey(); onChanged(); return this; } - + // optional bytes message = 4; private com.google.protobuf.ByteString message_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes message = 4; + * + *
+       * WhisperMessage
+       * 
+ */ public boolean hasMessage() { - return ((bitField0_ & 0x00000010) == 0x00000010); + return ((bitField0_ & 0x00000020) == 0x00000020); } + /** + * optional bytes message = 4; + * + *
+       * WhisperMessage
+       * 
+ */ public com.google.protobuf.ByteString getMessage() { return message_; } + /** + * optional bytes message = 4; + * + *
+       * WhisperMessage
+       * 
+ */ public Builder setMessage(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000020; message_ = value; onChanged(); return this; } + /** + * optional bytes message = 4; + * + *
+       * WhisperMessage
+       * 
+ */ public Builder clearMessage() { - bitField0_ = (bitField0_ & ~0x00000010); + bitField0_ = (bitField0_ & ~0x00000020); message_ = getDefaultInstance().getMessage(); onChanged(); return this; } - + // @@protoc_insertion_point(builder_scope:textsecure.PreKeyWhisperMessage) } - + static { defaultInstance = new PreKeyWhisperMessage(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.PreKeyWhisperMessage) } - + public interface KeyExchangeMessageOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional uint32 id = 1; + /** + * optional uint32 id = 1; + */ boolean hasId(); + /** + * optional uint32 id = 1; + */ int getId(); - + // optional bytes baseKey = 2; + /** + * optional bytes baseKey = 2; + */ boolean hasBaseKey(); + /** + * optional bytes baseKey = 2; + */ com.google.protobuf.ByteString getBaseKey(); - + // optional bytes ephemeralKey = 3; + /** + * optional bytes ephemeralKey = 3; + */ boolean hasEphemeralKey(); + /** + * optional bytes ephemeralKey = 3; + */ com.google.protobuf.ByteString getEphemeralKey(); - + // optional bytes identityKey = 4; + /** + * optional bytes identityKey = 4; + */ boolean hasIdentityKey(); + /** + * optional bytes identityKey = 4; + */ com.google.protobuf.ByteString getIdentityKey(); } + /** + * Protobuf type {@code textsecure.KeyExchangeMessage} + */ public static final class KeyExchangeMessage extends com.google.protobuf.GeneratedMessage implements KeyExchangeMessageOrBuilder { // Use KeyExchangeMessage.newBuilder() to construct. - private KeyExchangeMessage(Builder builder) { + private KeyExchangeMessage(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private KeyExchangeMessage(boolean noInit) {} - + private KeyExchangeMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final KeyExchangeMessage defaultInstance; public static KeyExchangeMessage getDefaultInstance() { return defaultInstance; } - + public KeyExchangeMessage getDefaultInstanceForType() { return defaultInstance; } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_fieldAccessorTable; - } - - private int bitField0_; - // optional uint32 id = 1; - public static final int ID_FIELD_NUMBER = 1; - private int id_; - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getId() { - return id_; - } - - // optional bytes baseKey = 2; - public static final int BASEKEY_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString baseKey_; - public boolean hasBaseKey() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.google.protobuf.ByteString getBaseKey() { - return baseKey_; - } - - // optional bytes ephemeralKey = 3; - public static final int EPHEMERALKEY_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString ephemeralKey_; - public boolean hasEphemeralKey() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.google.protobuf.ByteString getEphemeralKey() { - return ephemeralKey_; - } - - // optional bytes identityKey = 4; - public static final int IDENTITYKEY_FIELD_NUMBER = 4; - private com.google.protobuf.ByteString identityKey_; - public boolean hasIdentityKey() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public com.google.protobuf.ByteString getIdentityKey() { - return identityKey_; - } - - private void initFields() { - id_ = 0; - baseKey_ = com.google.protobuf.ByteString.EMPTY; - ephemeralKey_ = com.google.protobuf.ByteString.EMPTY; - identityKey_ = com.google.protobuf.ByteString.EMPTY; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeUInt32(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, baseKey_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, ephemeralKey_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(4, identityKey_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, baseKey_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, ephemeralKey_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(4, identityKey_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; + + private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; } - - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage 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.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( + private KeyExchangeMessage( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_fieldAccessorTable; - } - - // Construct using org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - id_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - baseKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - ephemeralKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - identityKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.getDescriptor(); - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage getDefaultInstanceForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.getDefaultInstance(); - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage build() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage buildPartial() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage result = new org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.baseKey_ = baseKey_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.ephemeralKey_ = ephemeralKey_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.identityKey_ = identityKey_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage) { - return mergeFrom((org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage other) { - if (other == org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.getDefaultInstance()) return this; - if (other.hasId()) { - setId(other.getId()); - } - if (other.hasBaseKey()) { - setBaseKey(other.getBaseKey()); - } - if (other.hasEphemeralKey()) { - setEphemeralKey(other.getEphemeralKey()); - } - if (other.hasIdentityKey()) { - setIdentityKey(other.getIdentityKey()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { int tag = input.readTag(); switch (tag) { case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; + break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; } break; } @@ -1508,39 +1611,436 @@ public final class WhisperProtos { } } } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public KeyExchangeMessage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new KeyExchangeMessage(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // optional uint32 id = 1; + public static final int ID_FIELD_NUMBER = 1; + private int id_; + /** + * optional uint32 id = 1; + */ + public boolean hasId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional uint32 id = 1; + */ + public int getId() { + return id_; + } + + // optional bytes baseKey = 2; + public static final int BASEKEY_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString baseKey_; + /** + * optional bytes baseKey = 2; + */ + public boolean hasBaseKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional bytes baseKey = 2; + */ + public com.google.protobuf.ByteString getBaseKey() { + return baseKey_; + } + + // optional bytes ephemeralKey = 3; + public static final int EPHEMERALKEY_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString ephemeralKey_; + /** + * optional bytes ephemeralKey = 3; + */ + public boolean hasEphemeralKey() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional bytes ephemeralKey = 3; + */ + public com.google.protobuf.ByteString getEphemeralKey() { + return ephemeralKey_; + } + + // optional bytes identityKey = 4; + public static final int IDENTITYKEY_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString identityKey_; + /** + * optional bytes identityKey = 4; + */ + public boolean hasIdentityKey() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional bytes identityKey = 4; + */ + public com.google.protobuf.ByteString getIdentityKey() { + return identityKey_; + } + + private void initFields() { + id_ = 0; + baseKey_ = com.google.protobuf.ByteString.EMPTY; + ephemeralKey_ = com.google.protobuf.ByteString.EMPTY; + identityKey_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeUInt32(1, id_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, baseKey_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, ephemeralKey_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, identityKey_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, id_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, baseKey_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, ephemeralKey_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, identityKey_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code textsecure.KeyExchangeMessage} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.Builder.class); + } + + // Construct using org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + id_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + baseKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + ephemeralKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + identityKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_descriptor; + } + + public org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.getDefaultInstance(); + } + + public org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage build() { + org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage buildPartial() { + org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage result = new org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.id_ = id_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.baseKey_ = baseKey_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.ephemeralKey_ = ephemeralKey_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.identityKey_ = identityKey_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage) { + return mergeFrom((org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage other) { + if (other == org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.getDefaultInstance()) return this; + if (other.hasId()) { + setId(other.getId()); + } + if (other.hasBaseKey()) { + setBaseKey(other.getBaseKey()); + } + if (other.hasEphemeralKey()) { + setEphemeralKey(other.getEphemeralKey()); + } + if (other.hasIdentityKey()) { + setIdentityKey(other.getIdentityKey()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; } - private int bitField0_; - + // optional uint32 id = 1; private int id_ ; + /** + * optional uint32 id = 1; + */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional uint32 id = 1; + */ public int getId() { return id_; } + /** + * optional uint32 id = 1; + */ public Builder setId(int value) { bitField0_ |= 0x00000001; id_ = value; onChanged(); return this; } + /** + * optional uint32 id = 1; + */ public Builder clearId() { bitField0_ = (bitField0_ & ~0x00000001); id_ = 0; onChanged(); return this; } - + // optional bytes baseKey = 2; private com.google.protobuf.ByteString baseKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes baseKey = 2; + */ public boolean hasBaseKey() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional bytes baseKey = 2; + */ public com.google.protobuf.ByteString getBaseKey() { return baseKey_; } + /** + * optional bytes baseKey = 2; + */ public Builder setBaseKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -1550,21 +2050,33 @@ public final class WhisperProtos { onChanged(); return this; } + /** + * optional bytes baseKey = 2; + */ public Builder clearBaseKey() { bitField0_ = (bitField0_ & ~0x00000002); baseKey_ = getDefaultInstance().getBaseKey(); onChanged(); return this; } - + // optional bytes ephemeralKey = 3; private com.google.protobuf.ByteString ephemeralKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes ephemeralKey = 3; + */ public boolean hasEphemeralKey() { return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional bytes ephemeralKey = 3; + */ public com.google.protobuf.ByteString getEphemeralKey() { return ephemeralKey_; } + /** + * optional bytes ephemeralKey = 3; + */ public Builder setEphemeralKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -1574,21 +2086,33 @@ public final class WhisperProtos { onChanged(); return this; } + /** + * optional bytes ephemeralKey = 3; + */ public Builder clearEphemeralKey() { bitField0_ = (bitField0_ & ~0x00000004); ephemeralKey_ = getDefaultInstance().getEphemeralKey(); onChanged(); return this; } - + // optional bytes identityKey = 4; private com.google.protobuf.ByteString identityKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes identityKey = 4; + */ public boolean hasIdentityKey() { return ((bitField0_ & 0x00000008) == 0x00000008); } + /** + * optional bytes identityKey = 4; + */ public com.google.protobuf.ByteString getIdentityKey() { return identityKey_; } + /** + * optional bytes identityKey = 4; + */ public Builder setIdentityKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -1598,24 +2122,27 @@ public final class WhisperProtos { onChanged(); return this; } + /** + * optional bytes identityKey = 4; + */ public Builder clearIdentityKey() { bitField0_ = (bitField0_ & ~0x00000008); identityKey_ = getDefaultInstance().getIdentityKey(); onChanged(); return this; } - + // @@protoc_insertion_point(builder_scope:textsecure.KeyExchangeMessage) } - + static { defaultInstance = new KeyExchangeMessage(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.KeyExchangeMessage) } - + private static com.google.protobuf.Descriptors.Descriptor internal_static_textsecure_WhisperMessage_descriptor; private static @@ -1631,7 +2158,7 @@ public final class WhisperProtos { private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_textsecure_KeyExchangeMessage_fieldAccessorTable; - + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -1643,14 +2170,14 @@ public final class WhisperProtos { "\n\031WhisperTextProtocol.proto\022\ntextsecure\"" + "d\n\016WhisperMessage\022\024\n\014ephemeralKey\030\001 \001(\014\022" + "\017\n\007counter\030\002 \001(\r\022\027\n\017previousCounter\030\003 \001(" + - "\r\022\022\n\nciphertext\030\004 \001(\014\"w\n\024PreKeyWhisperMe" + - "ssage\022\026\n\016registrationId\030\005 \001(\r\022\020\n\010preKeyI" + - "d\030\001 \001(\r\022\017\n\007baseKey\030\002 \001(\014\022\023\n\013identityKey\030" + - "\003 \001(\014\022\017\n\007message\030\004 \001(\014\"\\\n\022KeyExchangeMes" + - "sage\022\n\n\002id\030\001 \001(\r\022\017\n\007baseKey\030\002 \001(\014\022\024\n\014eph" + - "emeralKey\030\003 \001(\014\022\023\n\013identityKey\030\004 \001(\014B7\n&" + - "org.whispersystems.libaxolotl.protocolB\r", - "WhisperProtos" + "\r\022\022\n\nciphertext\030\004 \001(\014\"\214\001\n\024PreKeyWhisperM" + + "essage\022\026\n\016registrationId\030\005 \001(\r\022\020\n\010preKey" + + "Id\030\001 \001(\r\022\023\n\013deviceKeyId\030\006 \001(\r\022\017\n\007baseKey" + + "\030\002 \001(\014\022\023\n\013identityKey\030\003 \001(\014\022\017\n\007message\030\004" + + " \001(\014\"\\\n\022KeyExchangeMessage\022\n\n\002id\030\001 \001(\r\022\017" + + "\n\007baseKey\030\002 \001(\014\022\024\n\014ephemeralKey\030\003 \001(\014\022\023\n" + + "\013identityKey\030\004 \001(\014B7\n&org.whispersystems", + ".libaxolotl.protocolB\rWhisperProtos" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -1662,25 +2189,19 @@ public final class WhisperProtos { internal_static_textsecure_WhisperMessage_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_WhisperMessage_descriptor, - new java.lang.String[] { "EphemeralKey", "Counter", "PreviousCounter", "Ciphertext", }, - org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.class, - org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.Builder.class); + new java.lang.String[] { "EphemeralKey", "Counter", "PreviousCounter", "Ciphertext", }); internal_static_textsecure_PreKeyWhisperMessage_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_textsecure_PreKeyWhisperMessage_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_PreKeyWhisperMessage_descriptor, - new java.lang.String[] { "RegistrationId", "PreKeyId", "BaseKey", "IdentityKey", "Message", }, - org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.class, - org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.Builder.class); + new java.lang.String[] { "RegistrationId", "PreKeyId", "DeviceKeyId", "BaseKey", "IdentityKey", "Message", }); internal_static_textsecure_KeyExchangeMessage_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_textsecure_KeyExchangeMessage_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_KeyExchangeMessage_descriptor, - new java.lang.String[] { "Id", "BaseKey", "EphemeralKey", "IdentityKey", }, - org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.class, - org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.Builder.class); + new java.lang.String[] { "Id", "BaseKey", "EphemeralKey", "IdentityKey", }); return null; } }; @@ -1689,6 +2210,6 @@ public final class WhisperProtos { new com.google.protobuf.Descriptors.FileDescriptor[] { }, assigner); } - + // @@protoc_insertion_point(outer_class_scope) } diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/ratchet/RatchetingSession.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/ratchet/RatchetingSessionV2.java similarity index 98% rename from libaxolotl/src/main/java/org/whispersystems/libaxolotl/ratchet/RatchetingSession.java rename to libaxolotl/src/main/java/org/whispersystems/libaxolotl/ratchet/RatchetingSessionV2.java index 8442ce22b..b42b77649 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/ratchet/RatchetingSession.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/ratchet/RatchetingSessionV2.java @@ -30,7 +30,7 @@ import org.whispersystems.libaxolotl.util.Pair; import java.io.ByteArrayOutputStream; import java.io.IOException; -public class RatchetingSession { +public class RatchetingSessionV2 { public static void initializeSession(SessionState sessionState, ECKeyPair ourBaseKey, @@ -48,6 +48,8 @@ public class RatchetingSession { initializeSessionAsBob(sessionState, ourBaseKey, theirBaseKey, ourEphemeralKey, ourIdentityKey, theirIdentityKey); } + + sessionState.setSessionVersion(2); } private static void initializeSessionAsAlice(SessionState sessionState, diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/ratchet/RatchetingSessionV3.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/ratchet/RatchetingSessionV3.java new file mode 100644 index 000000000..bc25ab8a6 --- /dev/null +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/ratchet/RatchetingSessionV3.java @@ -0,0 +1,155 @@ +/** + * 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.ratchet; + +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.ECPublicKey; +import org.whispersystems.libaxolotl.kdf.DerivedSecrets; +import org.whispersystems.libaxolotl.kdf.HKDF; +import org.whispersystems.libaxolotl.util.Pair; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Arrays; + +public class RatchetingSessionV3 { + + public static void initializeSession(SessionState sessionState, + ECKeyPair ourBaseKey, + ECPublicKey theirBaseKey, + ECKeyPair ourEphemeralKey, + ECPublicKey theirEphemeralKey, + ECKeyPair ourPreKey, + ECPublicKey theirPreKey, + IdentityKeyPair ourIdentityKey, + IdentityKey theirIdentityKey) + throws InvalidKeyException + { + if (isAlice(ourBaseKey.getPublicKey(), theirBaseKey, ourEphemeralKey.getPublicKey(), theirEphemeralKey)) { + initializeSessionAsAlice(sessionState, ourBaseKey, theirBaseKey, theirEphemeralKey, + ourPreKey, theirPreKey, ourIdentityKey, theirIdentityKey); + } else { + initializeSessionAsBob(sessionState, ourBaseKey, theirBaseKey, ourEphemeralKey, + ourPreKey, theirPreKey, ourIdentityKey, theirIdentityKey); + } + + sessionState.setSessionVersion(3); + } + + private static void initializeSessionAsAlice(SessionState sessionState, + ECKeyPair ourBaseKey, ECPublicKey theirBaseKey, + ECPublicKey theirEphemeralKey, + ECKeyPair ourPreKey, ECPublicKey theirPreKey, + IdentityKeyPair ourIdentityKey, + IdentityKey theirIdentityKey) + throws InvalidKeyException + { + sessionState.setRemoteIdentityKey(theirIdentityKey); + sessionState.setLocalIdentityKey(ourIdentityKey.getPublicKey()); + + ECKeyPair sendingKey = Curve.generateKeyPair(true); + Pair receivingChain = calculate4DHE(true, ourBaseKey, theirBaseKey, + ourPreKey, theirPreKey, + ourIdentityKey, theirIdentityKey); + Pair sendingChain = receivingChain.first().createChain(theirEphemeralKey, sendingKey); + + sessionState.addReceiverChain(theirEphemeralKey, receivingChain.second()); + sessionState.setSenderChain(sendingKey, sendingChain.second()); + sessionState.setRootKey(sendingChain.first()); + } + + private static void initializeSessionAsBob(SessionState sessionState, + ECKeyPair ourBaseKey, ECPublicKey theirBaseKey, + ECKeyPair ourEphemeralKey, + ECKeyPair ourPreKey, ECPublicKey theirPreKey, + IdentityKeyPair ourIdentityKey, + IdentityKey theirIdentityKey) + throws InvalidKeyException + { + sessionState.setRemoteIdentityKey(theirIdentityKey); + sessionState.setLocalIdentityKey(ourIdentityKey.getPublicKey()); + + Pair sendingChain = calculate4DHE(false, ourBaseKey, theirBaseKey, + ourPreKey, theirPreKey, + ourIdentityKey, theirIdentityKey); + + sessionState.setSenderChain(ourEphemeralKey, sendingChain.second()); + sessionState.setRootKey(sendingChain.first()); + } + + private static Pair calculate4DHE(boolean isAlice, + ECKeyPair ourEphemeral, ECPublicKey theirEphemeral, + ECKeyPair ourPreKey, ECPublicKey theirPreKey, + IdentityKeyPair ourIdentity, IdentityKey theirIdentity) + throws InvalidKeyException + { + try { + byte[] discontinuity = new byte[32]; + ByteArrayOutputStream secrets = new ByteArrayOutputStream(); + + Arrays.fill(discontinuity, (byte)0xFF); + secrets.write(discontinuity); + + if (isAlice) { + secrets.write(Curve.calculateAgreement(theirEphemeral, ourIdentity.getPrivateKey())); + secrets.write(Curve.calculateAgreement(theirIdentity.getPublicKey(), ourEphemeral.getPrivateKey())); + } else { + secrets.write(Curve.calculateAgreement(theirIdentity.getPublicKey(), ourEphemeral.getPrivateKey())); + secrets.write(Curve.calculateAgreement(theirEphemeral, ourIdentity.getPrivateKey())); + } + + secrets.write(Curve.calculateAgreement(theirEphemeral, ourEphemeral.getPrivateKey())); + + if (ourPreKey != null && theirPreKey != null) { + secrets.write(Curve.calculateAgreement(theirPreKey, ourPreKey.getPrivateKey())); + } + + DerivedSecrets derivedSecrets = new HKDF().deriveSecrets(secrets.toByteArray(), + "WhisperText".getBytes()); + + return new Pair<>(new RootKey(derivedSecrets.getCipherKey().getEncoded()), + new ChainKey(derivedSecrets.getMacKey().getEncoded(), 0)); + } catch (IOException e) { + throw new AssertionError(e); + } + } + + private static boolean isAlice(ECPublicKey ourBaseKey, ECPublicKey theirBaseKey, + ECPublicKey ourEphemeralKey, ECPublicKey theirEphemeralKey) + { + if (ourEphemeralKey.equals(ourBaseKey)) { + return false; + } + + if (theirEphemeralKey.equals(theirBaseKey)) { + return true; + } + + return isLowEnd(ourBaseKey, theirBaseKey); + } + + private static boolean isLowEnd(ECPublicKey ourKey, ECPublicKey theirKey) { + return ourKey.compareTo(theirKey) < 0; + } + + +} diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/DeviceKeyRecord.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/DeviceKeyRecord.java new file mode 100644 index 000000000..a369adb3c --- /dev/null +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/DeviceKeyRecord.java @@ -0,0 +1,61 @@ +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; + +import java.io.IOException; + +import static org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure; + +public class DeviceKeyRecord { + + private DeviceKeyRecordStructure structure; + + public DeviceKeyRecord(int id, long timestamp, ECKeyPair keyPair, byte[] signature) { + this.structure = DeviceKeyRecordStructure.newBuilder() + .setId(id) + .setPublicKey(ByteString.copyFrom(keyPair.getPublicKey() + .serialize())) + .setPrivateKey(ByteString.copyFrom(keyPair.getPrivateKey() + .serialize())) + .setSignature(ByteString.copyFrom(signature)) + .setTimestamp(timestamp) + .build(); + } + + public DeviceKeyRecord(byte[] serialized) throws IOException { + this.structure = DeviceKeyRecordStructure.parseFrom(serialized); + } + + public int getId() { + return this.structure.getId(); + } + + public long getTimestamp() { + return this.structure.getTimestamp(); + } + + 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[] getSignature() { + return this.structure.getSignature().toByteArray(); + } + + public byte[] serialize() { + return this.structure.toByteArray(); + } +} diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/DeviceKeyStore.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/DeviceKeyStore.java new file mode 100644 index 000000000..4747b00bb --- /dev/null +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/DeviceKeyStore.java @@ -0,0 +1,47 @@ +package org.whispersystems.libaxolotl.state; + +import org.whispersystems.libaxolotl.InvalidKeyIdException; + +import java.util.List; + +public interface DeviceKeyStore { + + + /** + * Load a local DeviceKeyRecord. + * + * @param deviceKeyId the ID of the local DeviceKeyRecord. + * @return the corresponding DeviceKeyRecord. + * @throws InvalidKeyIdException when there is no corresponding DeviceKeyRecord. + */ + public DeviceKeyRecord loadDeviceKey(int deviceKeyId) throws InvalidKeyIdException; + + /** + * Load all local DeviceKeyRecords. + * + * @return All stored DeviceKeyRecords. + */ + public List loadDeviceKeys(); + + /** + * Store a local DeviceKeyRecord. + * + * @param deviceKeyId the ID of the DeviceKeyRecord to store. + * @param record the DeviceKeyRecord. + */ + public void storeDeviceKey(int deviceKeyId, DeviceKeyRecord record); + + /** + * @param deviceKeyId A DeviceKeyRecord ID. + * @return true if the store has a record for the deviceKeyId, otherwise false. + */ + public boolean containsDeviceKey(int deviceKeyId); + + /** + * Delete a DeviceKeyRecord from local storage. + * + * @param deviceKeyId The ID of the PreKeyRecord to remove. + */ + public void removeDeviceKey(int deviceKeyId); + +} diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKey.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKey.java deleted file mode 100644 index 31152630a..000000000 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKey.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.whispersystems.libaxolotl.state; - -import org.whispersystems.libaxolotl.IdentityKey; -import org.whispersystems.libaxolotl.ecc.ECPublicKey; - -/** - * An interface that describes a remote PreKey. - * - * @author Moxie Marlinspike - */ -public interface PreKey { - /** - * @return the device ID this PreKey belongs to. - */ - public int getDeviceId(); - - /** - * @return the unique key ID for this PreKey. - */ - public int getKeyId(); - - /** - * @return the public key for this PreKey. - */ - public ECPublicKey getPublicKey(); - - /** - * @return the {@link org.whispersystems.libaxolotl.IdentityKey} of this PreKeys owner. - */ - public IdentityKey getIdentityKey(); - - /** - * @return the registration ID associated with this PreKey. - */ - public int getRegistrationId(); -} diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKeyBundle.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKeyBundle.java new file mode 100644 index 000000000..6ab7f2032 --- /dev/null +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKeyBundle.java @@ -0,0 +1,96 @@ +package org.whispersystems.libaxolotl.state; + +import org.whispersystems.libaxolotl.IdentityKey; +import org.whispersystems.libaxolotl.ecc.ECPublicKey; + +/** + * A class that contains a remote PreKey and collection + * of associated items. + * + * @author Moxie Marlinspike + */ +public class PreKeyBundle { + + private int registrationId; + + private int deviceId; + + private int preKeyId; + private ECPublicKey preKeyPublic; + + private int deviceKeyId; + private ECPublicKey deviceKeyPublic; + private byte[] deviceKeySignature; + + private IdentityKey identityKey; + + public PreKeyBundle(int registrationId, int deviceId, int preKeyId, ECPublicKey preKeyPublic, + int deviceKeyId, ECPublicKey deviceKeyPublic, byte[] deviceKeySignature, + IdentityKey identityKey) + { + this.registrationId = registrationId; + this.deviceId = deviceId; + this.preKeyId = preKeyId; + this.preKeyPublic = preKeyPublic; + this.deviceKeyId = deviceKeyId; + this.deviceKeyPublic = deviceKeyPublic; + this.deviceKeySignature = deviceKeySignature; + this.identityKey = identityKey; + } + + /** + * @return the device ID this PreKey belongs to. + */ + public int getDeviceId() { + return deviceId; + } + + /** + * @return the unique key ID for this PreKey. + */ + public int getPreKeyId() { + return preKeyId; + } + + /** + * @return the public key for this PreKey. + */ + public ECPublicKey getPreKey() { + return preKeyPublic; + } + + /** + * @return the unique key ID for this DeviceKey. + */ + public int getDeviceKeyId() { + return deviceKeyId; + } + + /** + * @return the device key for this PreKey. + */ + public ECPublicKey getDeviceKey() { + return deviceKeyPublic; + } + + /** + * @return the signature over the device key. + */ + public byte[] getDeviceKeySignature() { + return deviceKeySignature; + } + + /** + * @return the {@link org.whispersystems.libaxolotl.IdentityKey} of this PreKeys owner. + */ + public IdentityKey getIdentityKey() { + return identityKey; + } + + /** + * @return the registration ID associated with this PreKey. + */ + public int getRegistrationId() { + return registrationId; + } +} diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKeyStore.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKeyStore.java index 934c386e2..7dc5e626e 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKeyStore.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/PreKeyStore.java @@ -16,7 +16,7 @@ public interface PreKeyStore { * @return the corresponding PreKeyRecord. * @throws InvalidKeyIdException when there is no corresponding PreKeyRecord. */ - public PreKeyRecord load(int preKeyId) throws InvalidKeyIdException; + public PreKeyRecord loadPreKey(int preKeyId) throws InvalidKeyIdException; /** * Store a local PreKeyRecord. @@ -24,19 +24,19 @@ public interface PreKeyStore { * @param preKeyId the ID of the PreKeyRecord to store. * @param record the PreKeyRecord. */ - public void store(int preKeyId, PreKeyRecord record); + public void storePreKey(int preKeyId, PreKeyRecord record); /** * @param preKeyId A PreKeyRecord ID. * @return true if the store has a record for the preKeyId, otherwise false. */ - public boolean contains(int preKeyId); + public boolean containsPreKey(int preKeyId); /** * Delete a PreKeyRecord from local storage. * * @param preKeyId The ID of the PreKeyRecord to remove. */ - public void remove(int preKeyId); + public void removePreKey(int preKeyId); } 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 8cfbbe9c4..0ddd2a74b 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionRecord.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionRecord.java @@ -1,6 +1,7 @@ package org.whispersystems.libaxolotl.state; import java.io.IOException; +import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -32,6 +33,24 @@ public class SessionRecord { } } + public boolean hasSessionState(int version, byte[] aliceBaseKey) { + if (sessionState.getSessionVersion() == version && + Arrays.equals(aliceBaseKey, sessionState.getAliceBaseKey())) + { + return true; + } + + for (SessionState state : previousStates) { + if (state.getSessionVersion() == version && + Arrays.equals(aliceBaseKey, state.getAliceBaseKey())) + { + return true; + } + } + + return false; + } + public SessionState getSessionState() { return sessionState; } 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 855572182..8484a715d 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionState.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionState.java @@ -60,6 +60,16 @@ public class SessionState { return sessionStructure; } + public byte[] getAliceBaseKey() { + return this.sessionStructure.getAliceBaseKey().toByteArray(); + } + + public void setAliceBaseKey(byte[] aliceBaseKey) { + this.sessionStructure = this.sessionStructure.toBuilder() + .setAliceBaseKey(ByteString.copyFrom(aliceBaseKey)) + .build(); + } + public void setNeedsRefresh(boolean needsRefresh) { this.sessionStructure = this.sessionStructure.toBuilder() .setNeedsRefresh(needsRefresh) @@ -77,7 +87,10 @@ public class SessionState { } public int getSessionVersion() { - return this.sessionStructure.getSessionVersion(); + int sessionVersion = this.sessionStructure.getSessionVersion(); + + if (sessionVersion == 0) return 2; + else return sessionVersion; } public void setRemoteIdentityKey(IdentityKey identityKey) { @@ -395,9 +408,10 @@ public class SessionState { return sessionStructure.hasPendingKeyExchange(); } - public void setPendingPreKey(int preKeyId, ECPublicKey baseKey) { + public void setPendingPreKey(int preKeyId, int deviceKeyId, ECPublicKey baseKey) { PendingPreKey pending = PendingPreKey.newBuilder() .setPreKeyId(preKeyId) + .setDeviceKeyId(deviceKeyId) .setBaseKey(ByteString.copyFrom(baseKey.serialize())) .build(); @@ -410,12 +424,17 @@ public class SessionState { return this.sessionStructure.hasPendingPreKey(); } - public Pair getPendingPreKey() { + public int getPendingPreKeyId() { + return sessionStructure.getPendingPreKey().getPreKeyId(); + } + + public int getPendingDeviceKeyId() { + return sessionStructure.getPendingPreKey().getDeviceKeyId(); + } + + public ECPublicKey getPendingBaseKey() { try { - return new Pair(sessionStructure.getPendingPreKey().getPreKeyId(), - Curve.decodePoint(sessionStructure.getPendingPreKey() - .getBaseKey() - .toByteArray(), 0)); + return Curve.decodePoint(sessionStructure.getPendingPreKey().getBaseKey().toByteArray(), 0); } catch (InvalidKeyException e) { throw new AssertionError(e); } diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionStore.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionStore.java index 7ed7e33b4..c5ad00b0b 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionStore.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/SessionStore.java @@ -24,7 +24,7 @@ public interface SessionStore { * @return a copy of the SessionRecord corresponding to the recipientId + deviceId tuple, or * a new SessionRecord if one does not currently exist. */ - public SessionRecord load(long recipientId, int deviceId); + public SessionRecord loadSession(long recipientId, int deviceId); /** * Returns all known devices with active sessions for a recipient @@ -40,7 +40,7 @@ public interface SessionStore { * @param deviceId the device ID of the remote client. * @param record the current SessionRecord for the remote client. */ - public void store(long recipientId, int deviceId, SessionRecord record); + public void storeSession(long recipientId, int deviceId, SessionRecord record); /** * Determine whether there is a committed {@link SessionRecord} for a recipientId + deviceId tuple. @@ -48,7 +48,7 @@ public interface SessionStore { * @param deviceId the device ID of the remote client. * @return true if a {@link SessionRecord} exists, false otherwise. */ - public boolean contains(long recipientId, int deviceId); + public boolean containsSession(long recipientId, int deviceId); /** * Remove a {@link SessionRecord} for a recipientId + deviceId tuple. @@ -56,13 +56,13 @@ public interface SessionStore { * @param recipientId the recipient ID of the remote client. * @param deviceId the device ID of the remote client. */ - public void delete(long recipientId, int deviceId); + public void deleteSession(long recipientId, int deviceId); /** * Remove the {@link SessionRecord}s corresponding to all devices of a recipientId. * * @param recipientId the recipient ID of the remote client. */ - public void deleteAll(long recipientId); + public void deleteAllSessions(long recipientId); } diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/StorageProtos.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/StorageProtos.java index 4db4a72c0..17fc45703 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/StorageProtos.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/state/StorageProtos.java @@ -10,206 +10,691 @@ public final class StorageProtos { } public interface SessionStructureOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional uint32 sessionVersion = 1; + /** + * optional uint32 sessionVersion = 1; + */ boolean hasSessionVersion(); + /** + * optional uint32 sessionVersion = 1; + */ int getSessionVersion(); - + // optional bytes localIdentityPublic = 2; + /** + * optional bytes localIdentityPublic = 2; + */ boolean hasLocalIdentityPublic(); + /** + * optional bytes localIdentityPublic = 2; + */ com.google.protobuf.ByteString getLocalIdentityPublic(); - + // optional bytes remoteIdentityPublic = 3; + /** + * optional bytes remoteIdentityPublic = 3; + */ boolean hasRemoteIdentityPublic(); + /** + * optional bytes remoteIdentityPublic = 3; + */ com.google.protobuf.ByteString getRemoteIdentityPublic(); - + // optional bytes rootKey = 4; + /** + * optional bytes rootKey = 4; + */ boolean hasRootKey(); + /** + * optional bytes rootKey = 4; + */ com.google.protobuf.ByteString getRootKey(); - + // optional uint32 previousCounter = 5; + /** + * optional uint32 previousCounter = 5; + */ boolean hasPreviousCounter(); + /** + * optional uint32 previousCounter = 5; + */ int getPreviousCounter(); - + // optional .textsecure.SessionStructure.Chain senderChain = 6; + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ boolean hasSenderChain(); + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getSenderChain(); + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder getSenderChainOrBuilder(); - + // repeated .textsecure.SessionStructure.Chain receiverChains = 7; + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ java.util.List getReceiverChainsList(); + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getReceiverChains(int index); + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ int getReceiverChainsCount(); + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ java.util.List getReceiverChainsOrBuilderList(); + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder getReceiverChainsOrBuilder( int index); - + // optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ boolean hasPendingKeyExchange(); + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange getPendingKeyExchange(); + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder getPendingKeyExchangeOrBuilder(); - + // optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ boolean hasPendingPreKey(); + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey getPendingPreKey(); + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder getPendingPreKeyOrBuilder(); - + // optional uint32 remoteRegistrationId = 10; + /** + * optional uint32 remoteRegistrationId = 10; + */ boolean hasRemoteRegistrationId(); + /** + * optional uint32 remoteRegistrationId = 10; + */ int getRemoteRegistrationId(); - + // optional uint32 localRegistrationId = 11; + /** + * optional uint32 localRegistrationId = 11; + */ boolean hasLocalRegistrationId(); + /** + * optional uint32 localRegistrationId = 11; + */ int getLocalRegistrationId(); - + // optional bool needsRefresh = 12; + /** + * optional bool needsRefresh = 12; + */ boolean hasNeedsRefresh(); + /** + * optional bool needsRefresh = 12; + */ boolean getNeedsRefresh(); + + // optional bytes aliceBaseKey = 13; + /** + * optional bytes aliceBaseKey = 13; + */ + boolean hasAliceBaseKey(); + /** + * optional bytes aliceBaseKey = 13; + */ + com.google.protobuf.ByteString getAliceBaseKey(); } + /** + * Protobuf type {@code textsecure.SessionStructure} + */ public static final class SessionStructure extends com.google.protobuf.GeneratedMessage implements SessionStructureOrBuilder { // Use SessionStructure.newBuilder() to construct. - private SessionStructure(Builder builder) { + private SessionStructure(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private SessionStructure(boolean noInit) {} - + private SessionStructure(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final SessionStructure defaultInstance; public static SessionStructure getDefaultInstance() { return defaultInstance; } - + public SessionStructure getDefaultInstanceForType() { return defaultInstance; } - + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private SessionStructure( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + sessionVersion_ = input.readUInt32(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + localIdentityPublic_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + remoteIdentityPublic_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + rootKey_ = input.readBytes(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + previousCounter_ = input.readUInt32(); + break; + } + case 50: { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder subBuilder = null; + if (((bitField0_ & 0x00000020) == 0x00000020)) { + subBuilder = senderChain_.toBuilder(); + } + senderChain_ = input.readMessage(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(senderChain_); + senderChain_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000020; + break; + } + case 58: { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + receiverChains_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000040; + } + receiverChains_.add(input.readMessage(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.PARSER, extensionRegistry)); + break; + } + case 66: { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder subBuilder = null; + if (((bitField0_ & 0x00000040) == 0x00000040)) { + subBuilder = pendingKeyExchange_.toBuilder(); + } + pendingKeyExchange_ = input.readMessage(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(pendingKeyExchange_); + pendingKeyExchange_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000040; + break; + } + case 74: { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder subBuilder = null; + if (((bitField0_ & 0x00000080) == 0x00000080)) { + subBuilder = pendingPreKey_.toBuilder(); + } + pendingPreKey_ = input.readMessage(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(pendingPreKey_); + pendingPreKey_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000080; + break; + } + case 80: { + bitField0_ |= 0x00000100; + remoteRegistrationId_ = input.readUInt32(); + break; + } + case 88: { + bitField0_ |= 0x00000200; + localRegistrationId_ = input.readUInt32(); + break; + } + case 96: { + bitField0_ |= 0x00000400; + needsRefresh_ = input.readBool(); + break; + } + case 106: { + bitField0_ |= 0x00000800; + aliceBaseKey_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + receiverChains_ = java.util.Collections.unmodifiableList(receiverChains_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.class, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder.class); } - + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public SessionStructure parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SessionStructure(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + public interface ChainOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional bytes senderEphemeral = 1; + /** + * optional bytes senderEphemeral = 1; + */ boolean hasSenderEphemeral(); + /** + * optional bytes senderEphemeral = 1; + */ com.google.protobuf.ByteString getSenderEphemeral(); - + // optional bytes senderEphemeralPrivate = 2; + /** + * optional bytes senderEphemeralPrivate = 2; + */ boolean hasSenderEphemeralPrivate(); + /** + * optional bytes senderEphemeralPrivate = 2; + */ com.google.protobuf.ByteString getSenderEphemeralPrivate(); - + // optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ boolean hasChainKey(); + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey getChainKey(); + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder getChainKeyOrBuilder(); - + // repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ java.util.List getMessageKeysList(); + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey getMessageKeys(int index); + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ int getMessageKeysCount(); + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ java.util.List getMessageKeysOrBuilderList(); + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder getMessageKeysOrBuilder( int index); } + /** + * Protobuf type {@code textsecure.SessionStructure.Chain} + */ public static final class Chain extends com.google.protobuf.GeneratedMessage implements ChainOrBuilder { // Use Chain.newBuilder() to construct. - private Chain(Builder builder) { + private Chain(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private Chain(boolean noInit) {} - + private Chain(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final Chain defaultInstance; public static Chain getDefaultInstance() { return defaultInstance; } - + public Chain getDefaultInstanceForType() { return defaultInstance; } - + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Chain( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + senderEphemeral_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + senderEphemeralPrivate_ = input.readBytes(); + break; + } + case 26: { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder subBuilder = null; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + subBuilder = chainKey_.toBuilder(); + } + chainKey_ = input.readMessage(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(chainKey_); + chainKey_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000004; + break; + } + case 34: { + if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + messageKeys_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000008; + } + messageKeys_.add(input.readMessage(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.PARSER, extensionRegistry)); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + messageKeys_ = java.util.Collections.unmodifiableList(messageKeys_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.class, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder.class); } - + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public Chain parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Chain(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + public interface ChainKeyOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional uint32 index = 1; + /** + * optional uint32 index = 1; + */ boolean hasIndex(); + /** + * optional uint32 index = 1; + */ int getIndex(); - + // optional bytes key = 2; + /** + * optional bytes key = 2; + */ boolean hasKey(); + /** + * optional bytes key = 2; + */ com.google.protobuf.ByteString getKey(); } + /** + * Protobuf type {@code textsecure.SessionStructure.Chain.ChainKey} + */ public static final class ChainKey extends com.google.protobuf.GeneratedMessage implements ChainKeyOrBuilder { // Use ChainKey.newBuilder() to construct. - private ChainKey(Builder builder) { + private ChainKey(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private ChainKey(boolean noInit) {} - + private ChainKey(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final ChainKey defaultInstance; public static ChainKey getDefaultInstance() { return defaultInstance; } - + public ChainKey getDefaultInstanceForType() { return defaultInstance; } - + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ChainKey( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + index_ = input.readUInt32(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + key_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.class, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder.class); } - + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public ChainKey parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ChainKey(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + private int bitField0_; // optional uint32 index = 1; public static final int INDEX_FIELD_NUMBER = 1; private int index_; + /** + * optional uint32 index = 1; + */ public boolean hasIndex() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional uint32 index = 1; + */ public int getIndex() { return index_; } - + // optional bytes key = 2; public static final int KEY_FIELD_NUMBER = 2; private com.google.protobuf.ByteString key_; + /** + * optional bytes key = 2; + */ public boolean hasKey() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional bytes key = 2; + */ public com.google.protobuf.ByteString getKey() { return key_; } - + private void initFields() { index_ = 0; key_ = com.google.protobuf.ByteString.EMPTY; @@ -218,11 +703,11 @@ public final class StorageProtos { public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); @@ -234,12 +719,12 @@ public final class StorageProtos { } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream @@ -253,94 +738,83 @@ public final class StorageProtos { memoizedSerializedSize = size; return size; } - + private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } - + 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(); + return PARSER.parseFrom(data); } 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(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } 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(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } 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(); + return PARSER.parseFrom(input, extensionRegistry); } 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)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } 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(); + return PARSER.parseFrom(input); } 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 { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** + * Protobuf type {@code textsecure.SessionStructure.Chain.ChainKey} + */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder { @@ -348,18 +822,21 @@ public final class StorageProtos { getDescriptor() { return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.class, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder.class); } - + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.newBuilder() private Builder() { maybeForceBuilderInitialization(); } - - private Builder(BuilderParent parent) { + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } @@ -370,7 +847,7 @@ public final class StorageProtos { private static Builder create() { return new Builder(); } - + public Builder clear() { super.clear(); index_ = 0; @@ -379,20 +856,20 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000002); return this; } - + public Builder clone() { return create().mergeFrom(buildPartial()); } - + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_ChainKey_descriptor; } - + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey getDefaultInstanceForType() { return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance(); } - + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey build() { org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey result = buildPartial(); if (!result.isInitialized()) { @@ -400,17 +877,7 @@ public final class StorageProtos { } return result; } - - private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - + 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_; @@ -427,7 +894,7 @@ public final class StorageProtos { onBuilt(); return result; } - + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey) { return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey)other); @@ -436,7 +903,7 @@ public final class StorageProtos { 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()) { @@ -448,79 +915,80 @@ public final class StorageProtos { this.mergeUnknownFields(other.getUnknownFields()); return this; } - + public final boolean isInitialized() { return true; } - + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - index_ = input.readUInt32(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - key_ = input.readBytes(); - break; - } + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - private int bitField0_; - + // optional uint32 index = 1; private int index_ ; + /** + * optional uint32 index = 1; + */ public boolean hasIndex() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional uint32 index = 1; + */ public int getIndex() { return index_; } + /** + * optional uint32 index = 1; + */ public Builder setIndex(int value) { bitField0_ |= 0x00000001; index_ = value; onChanged(); return this; } + /** + * optional uint32 index = 1; + */ public Builder clearIndex() { bitField0_ = (bitField0_ & ~0x00000001); index_ = 0; onChanged(); return this; } - + // optional bytes key = 2; private com.google.protobuf.ByteString key_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes key = 2; + */ public boolean hasKey() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional bytes key = 2; + */ public com.google.protobuf.ByteString getKey() { return key_; } + /** + * optional bytes key = 2; + */ public Builder setKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -530,378 +998,108 @@ public final class StorageProtos { onChanged(); return this; } + /** + * optional bytes key = 2; + */ public Builder clearKey() { bitField0_ = (bitField0_ & ~0x00000002); key_ = getDefaultInstance().getKey(); onChanged(); return this; } - + // @@protoc_insertion_point(builder_scope:textsecure.SessionStructure.Chain.ChainKey) } - + static { defaultInstance = new ChainKey(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.SessionStructure.Chain.ChainKey) } - + public interface MessageKeyOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional uint32 index = 1; + /** + * optional uint32 index = 1; + */ boolean hasIndex(); + /** + * optional uint32 index = 1; + */ int getIndex(); - + // optional bytes cipherKey = 2; + /** + * optional bytes cipherKey = 2; + */ boolean hasCipherKey(); + /** + * optional bytes cipherKey = 2; + */ com.google.protobuf.ByteString getCipherKey(); - + // optional bytes macKey = 3; + /** + * optional bytes macKey = 3; + */ boolean hasMacKey(); + /** + * optional bytes macKey = 3; + */ com.google.protobuf.ByteString getMacKey(); } + /** + * Protobuf type {@code textsecure.SessionStructure.Chain.MessageKey} + */ public static final class MessageKey extends com.google.protobuf.GeneratedMessage implements MessageKeyOrBuilder { // Use MessageKey.newBuilder() to construct. - private MessageKey(Builder builder) { + private MessageKey(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private MessageKey(boolean noInit) {} - + private MessageKey(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final MessageKey defaultInstance; public static MessageKey getDefaultInstance() { return defaultInstance; } - + public MessageKey getDefaultInstanceForType() { return defaultInstance; } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_fieldAccessorTable; - } - - private int bitField0_; - // optional uint32 index = 1; - public static final int INDEX_FIELD_NUMBER = 1; - private int index_; - public boolean hasIndex() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getIndex() { - return index_; - } - - // optional bytes cipherKey = 2; - public static final int CIPHERKEY_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString cipherKey_; - public boolean hasCipherKey() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.google.protobuf.ByteString getCipherKey() { - return cipherKey_; - } - - // optional bytes macKey = 3; - public static final int MACKEY_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString macKey_; - public boolean hasMacKey() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.google.protobuf.ByteString getMacKey() { - return macKey_; - } - - private void initFields() { - index_ = 0; - cipherKey_ = com.google.protobuf.ByteString.EMPTY; - macKey_ = com.google.protobuf.ByteString.EMPTY; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeUInt32(1, index_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, cipherKey_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, macKey_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(1, index_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, cipherKey_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, macKey_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; + + private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; } - - 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.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.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - 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.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - 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.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - 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.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( + private MessageKey( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_fieldAccessorTable; - } - - // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - index_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - cipherKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - macKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.getDescriptor(); - } - - public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey getDefaultInstanceForType() { - return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.getDefaultInstance(); - } - - 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.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - 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)) { - to_bitField0_ |= 0x00000001; - } - result.index_ = index_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.cipherKey_ = cipherKey_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.macKey_ = macKey_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message 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.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()); - } - if (other.hasCipherKey()) { - setCipherKey(other.getCipherKey()); - } - if (other.hasMacKey()) { - setMacKey(other.getMacKey()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { int tag = input.readTag(); switch (tag) { case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; + break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; } break; } @@ -922,39 +1120,403 @@ public final class StorageProtos { } } } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.class, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public MessageKey parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new MessageKey(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // optional uint32 index = 1; + public static final int INDEX_FIELD_NUMBER = 1; + private int index_; + /** + * optional uint32 index = 1; + */ + public boolean hasIndex() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional uint32 index = 1; + */ + public int getIndex() { + return index_; + } + + // optional bytes cipherKey = 2; + public static final int CIPHERKEY_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString cipherKey_; + /** + * optional bytes cipherKey = 2; + */ + public boolean hasCipherKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional bytes cipherKey = 2; + */ + public com.google.protobuf.ByteString getCipherKey() { + return cipherKey_; + } + + // optional bytes macKey = 3; + public static final int MACKEY_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString macKey_; + /** + * optional bytes macKey = 3; + */ + public boolean hasMacKey() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional bytes macKey = 3; + */ + public com.google.protobuf.ByteString getMacKey() { + return macKey_; + } + + private void initFields() { + index_ = 0; + cipherKey_ = com.google.protobuf.ByteString.EMPTY; + macKey_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeUInt32(1, index_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, cipherKey_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, macKey_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, index_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, cipherKey_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, macKey_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + 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 PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + 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 PARSER.parseFrom(input, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + 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 { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code textsecure.SessionStructure.Chain.MessageKey} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.class, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder.class); + } + + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + index_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + cipherKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + macKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_MessageKey_descriptor; + } + + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.getDefaultInstance(); + } + + 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; + } + + 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)) { + to_bitField0_ |= 0x00000001; + } + result.index_ = index_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.cipherKey_ = cipherKey_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.macKey_ = macKey_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message 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.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()); + } + if (other.hasCipherKey()) { + setCipherKey(other.getCipherKey()); + } + if (other.hasMacKey()) { + setMacKey(other.getMacKey()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; } - private int bitField0_; - + // optional uint32 index = 1; private int index_ ; + /** + * optional uint32 index = 1; + */ public boolean hasIndex() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional uint32 index = 1; + */ public int getIndex() { return index_; } + /** + * optional uint32 index = 1; + */ public Builder setIndex(int value) { bitField0_ |= 0x00000001; index_ = value; onChanged(); return this; } + /** + * optional uint32 index = 1; + */ public Builder clearIndex() { bitField0_ = (bitField0_ & ~0x00000001); index_ = 0; onChanged(); return this; } - + // optional bytes cipherKey = 2; private com.google.protobuf.ByteString cipherKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes cipherKey = 2; + */ public boolean hasCipherKey() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional bytes cipherKey = 2; + */ public com.google.protobuf.ByteString getCipherKey() { return cipherKey_; } + /** + * optional bytes cipherKey = 2; + */ public Builder setCipherKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -964,21 +1526,33 @@ public final class StorageProtos { onChanged(); return this; } + /** + * optional bytes cipherKey = 2; + */ public Builder clearCipherKey() { bitField0_ = (bitField0_ & ~0x00000002); cipherKey_ = getDefaultInstance().getCipherKey(); onChanged(); return this; } - + // optional bytes macKey = 3; private com.google.protobuf.ByteString macKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes macKey = 3; + */ public boolean hasMacKey() { return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional bytes macKey = 3; + */ public com.google.protobuf.ByteString getMacKey() { return macKey_; } + /** + * optional bytes macKey = 3; + */ public Builder setMacKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -988,79 +1562,118 @@ public final class StorageProtos { onChanged(); return this; } + /** + * optional bytes macKey = 3; + */ public Builder clearMacKey() { bitField0_ = (bitField0_ & ~0x00000004); macKey_ = getDefaultInstance().getMacKey(); onChanged(); return this; } - + // @@protoc_insertion_point(builder_scope:textsecure.SessionStructure.Chain.MessageKey) } - + static { defaultInstance = new MessageKey(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.SessionStructure.Chain.MessageKey) } - + private int bitField0_; // optional bytes senderEphemeral = 1; public static final int SENDEREPHEMERAL_FIELD_NUMBER = 1; private com.google.protobuf.ByteString senderEphemeral_; + /** + * optional bytes senderEphemeral = 1; + */ public boolean hasSenderEphemeral() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional bytes senderEphemeral = 1; + */ public com.google.protobuf.ByteString getSenderEphemeral() { return senderEphemeral_; } - + // optional bytes senderEphemeralPrivate = 2; public static final int SENDEREPHEMERALPRIVATE_FIELD_NUMBER = 2; private com.google.protobuf.ByteString senderEphemeralPrivate_; + /** + * optional bytes senderEphemeralPrivate = 2; + */ public boolean hasSenderEphemeralPrivate() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional bytes senderEphemeralPrivate = 2; + */ public com.google.protobuf.ByteString getSenderEphemeralPrivate() { return senderEphemeralPrivate_; } - + // optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; public static final int CHAINKEY_FIELD_NUMBER = 3; private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey chainKey_; + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ public boolean hasChainKey() { return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey getChainKey() { return chainKey_; } + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ 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_; + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public java.util.List getMessageKeysList() { return messageKeys_; } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public java.util.List getMessageKeysOrBuilderList() { return messageKeys_; } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public int getMessageKeysCount() { return messageKeys_.size(); } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey getMessageKeys(int index) { return messageKeys_.get(index); } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder getMessageKeysOrBuilder( int index) { return messageKeys_.get(index); } - + private void initFields() { senderEphemeral_ = com.google.protobuf.ByteString.EMPTY; senderEphemeralPrivate_ = com.google.protobuf.ByteString.EMPTY; @@ -1071,11 +1684,11 @@ public final class StorageProtos { public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); @@ -1093,12 +1706,12 @@ public final class StorageProtos { } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream @@ -1120,94 +1733,83 @@ public final class StorageProtos { memoizedSerializedSize = size; return size; } - + private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } - + 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(); + return PARSER.parseFrom(data); } 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(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } 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(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } 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(); + return PARSER.parseFrom(input, extensionRegistry); } 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)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** + * Protobuf type {@code textsecure.SessionStructure.Chain} + */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder { @@ -1215,18 +1817,21 @@ public final class StorageProtos { getDescriptor() { return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.class, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder.class); } - + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.newBuilder() private Builder() { maybeForceBuilderInitialization(); } - - private Builder(BuilderParent parent) { + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } @@ -1239,7 +1844,7 @@ public final class StorageProtos { private static Builder create() { return new Builder(); } - + public Builder clear() { super.clear(); senderEphemeral_ = com.google.protobuf.ByteString.EMPTY; @@ -1260,20 +1865,20 @@ public final class StorageProtos { } return this; } - + public Builder clone() { return create().mergeFrom(buildPartial()); } - + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_Chain_descriptor; } - + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getDefaultInstanceForType() { return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance(); } - + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain build() { org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain result = buildPartial(); if (!result.isInitialized()) { @@ -1281,17 +1886,7 @@ public final class StorageProtos { } return result; } - - private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - + 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_; @@ -1325,7 +1920,7 @@ public final class StorageProtos { onBuilt(); return result; } - + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain) { return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain)other); @@ -1334,7 +1929,7 @@ public final class StorageProtos { 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()) { @@ -1375,73 +1970,47 @@ public final class StorageProtos { this.mergeUnknownFields(other.getUnknownFields()); return this; } - + public final boolean isInitialized() { return true; } - + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - senderEphemeral_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - senderEphemeralPrivate_ = input.readBytes(); - break; - } - case 26: { - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.newBuilder(); - if (hasChainKey()) { - subBuilder.mergeFrom(getChainKey()); - } - input.readMessage(subBuilder, extensionRegistry); - setChainKey(subBuilder.buildPartial()); - break; - } - case 34: { - 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; - } + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - private int bitField0_; - + // optional bytes senderEphemeral = 1; private com.google.protobuf.ByteString senderEphemeral_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes senderEphemeral = 1; + */ public boolean hasSenderEphemeral() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional bytes senderEphemeral = 1; + */ public com.google.protobuf.ByteString getSenderEphemeral() { return senderEphemeral_; } + /** + * optional bytes senderEphemeral = 1; + */ public Builder setSenderEphemeral(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -1451,21 +2020,33 @@ public final class StorageProtos { onChanged(); return this; } + /** + * optional bytes senderEphemeral = 1; + */ public Builder clearSenderEphemeral() { bitField0_ = (bitField0_ & ~0x00000001); senderEphemeral_ = getDefaultInstance().getSenderEphemeral(); onChanged(); return this; } - + // optional bytes senderEphemeralPrivate = 2; private com.google.protobuf.ByteString senderEphemeralPrivate_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes senderEphemeralPrivate = 2; + */ public boolean hasSenderEphemeralPrivate() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional bytes senderEphemeralPrivate = 2; + */ public com.google.protobuf.ByteString getSenderEphemeralPrivate() { return senderEphemeralPrivate_; } + /** + * optional bytes senderEphemeralPrivate = 2; + */ public Builder setSenderEphemeralPrivate(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -1475,20 +2056,29 @@ public final class StorageProtos { onChanged(); return this; } + /** + * optional bytes senderEphemeralPrivate = 2; + */ public Builder clearSenderEphemeralPrivate() { bitField0_ = (bitField0_ & ~0x00000002); senderEphemeralPrivate_ = getDefaultInstance().getSenderEphemeralPrivate(); onChanged(); return this; } - + // optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; 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.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder> chainKeyBuilder_; + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ public boolean hasChainKey() { return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey getChainKey() { if (chainKeyBuilder_ == null) { return chainKey_; @@ -1496,6 +2086,9 @@ public final class StorageProtos { return chainKeyBuilder_.getMessage(); } } + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ public Builder setChainKey(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey value) { if (chainKeyBuilder_ == null) { if (value == null) { @@ -1509,6 +2102,9 @@ public final class StorageProtos { bitField0_ |= 0x00000004; return this; } + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ public Builder setChainKey( org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder builderForValue) { if (chainKeyBuilder_ == null) { @@ -1520,6 +2116,9 @@ public final class StorageProtos { bitField0_ |= 0x00000004; return this; } + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ public Builder mergeChainKey(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey value) { if (chainKeyBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004) && @@ -1536,6 +2135,9 @@ public final class StorageProtos { bitField0_ |= 0x00000004; return this; } + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ public Builder clearChainKey() { if (chainKeyBuilder_ == null) { chainKey_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.getDefaultInstance(); @@ -1546,11 +2148,17 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000004); return this; } + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder getChainKeyBuilder() { bitField0_ |= 0x00000004; onChanged(); return getChainKeyFieldBuilder().getBuilder(); } + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKeyOrBuilder getChainKeyOrBuilder() { if (chainKeyBuilder_ != null) { return chainKeyBuilder_.getMessageOrBuilder(); @@ -1558,6 +2166,9 @@ public final class StorageProtos { return chainKey_; } } + /** + * optional .textsecure.SessionStructure.Chain.ChainKey chainKey = 3; + */ private com.google.protobuf.SingleFieldBuilder< 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() { @@ -1571,7 +2182,7 @@ public final class StorageProtos { } return chainKeyBuilder_; } - + // repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; private java.util.List messageKeys_ = java.util.Collections.emptyList(); @@ -1581,10 +2192,13 @@ public final class StorageProtos { bitField0_ |= 0x00000008; } } - + private com.google.protobuf.RepeatedFieldBuilder< 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_; - + + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public java.util.List getMessageKeysList() { if (messageKeysBuilder_ == null) { return java.util.Collections.unmodifiableList(messageKeys_); @@ -1592,6 +2206,9 @@ public final class StorageProtos { return messageKeysBuilder_.getMessageList(); } } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public int getMessageKeysCount() { if (messageKeysBuilder_ == null) { return messageKeys_.size(); @@ -1599,6 +2216,9 @@ public final class StorageProtos { return messageKeysBuilder_.getCount(); } } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey getMessageKeys(int index) { if (messageKeysBuilder_ == null) { return messageKeys_.get(index); @@ -1606,6 +2226,9 @@ public final class StorageProtos { return messageKeysBuilder_.getMessage(index); } } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public Builder setMessageKeys( int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey value) { if (messageKeysBuilder_ == null) { @@ -1620,6 +2243,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public Builder setMessageKeys( int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder builderForValue) { if (messageKeysBuilder_ == null) { @@ -1631,6 +2257,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public Builder addMessageKeys(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey value) { if (messageKeysBuilder_ == null) { if (value == null) { @@ -1644,6 +2273,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public Builder addMessageKeys( int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey value) { if (messageKeysBuilder_ == null) { @@ -1658,6 +2290,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public Builder addMessageKeys( org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder builderForValue) { if (messageKeysBuilder_ == null) { @@ -1669,6 +2304,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public Builder addMessageKeys( int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder builderForValue) { if (messageKeysBuilder_ == null) { @@ -1680,6 +2318,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public Builder addAllMessageKeys( java.lang.Iterable values) { if (messageKeysBuilder_ == null) { @@ -1691,6 +2332,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public Builder clearMessageKeys() { if (messageKeysBuilder_ == null) { messageKeys_ = java.util.Collections.emptyList(); @@ -1701,6 +2345,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public Builder removeMessageKeys(int index) { if (messageKeysBuilder_ == null) { ensureMessageKeysIsMutable(); @@ -1711,10 +2358,16 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder getMessageKeysBuilder( int index) { return getMessageKeysFieldBuilder().getBuilder(index); } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKeyOrBuilder getMessageKeysOrBuilder( int index) { if (messageKeysBuilder_ == null) { @@ -1722,6 +2375,9 @@ public final class StorageProtos { return messageKeysBuilder_.getMessageOrBuilder(index); } } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public java.util.List getMessageKeysOrBuilderList() { if (messageKeysBuilder_ != null) { @@ -1730,15 +2386,24 @@ public final class StorageProtos { return java.util.Collections.unmodifiableList(messageKeys_); } } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder addMessageKeysBuilder() { return getMessageKeysFieldBuilder().addBuilder( org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.getDefaultInstance()); } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder addMessageKeysBuilder( int index) { return getMessageKeysFieldBuilder().addBuilder( index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.getDefaultInstance()); } + /** + * repeated .textsecure.SessionStructure.Chain.MessageKey messageKeys = 4; + */ public java.util.List getMessageKeysBuilderList() { return getMessageKeysFieldBuilder().getBuilderList(); @@ -1757,496 +2422,139 @@ public final class StorageProtos { } return messageKeysBuilder_; } - + // @@protoc_insertion_point(builder_scope:textsecure.SessionStructure.Chain) } - + static { defaultInstance = new Chain(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.SessionStructure.Chain) } - + public interface PendingKeyExchangeOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional uint32 sequence = 1; + /** + * optional uint32 sequence = 1; + */ boolean hasSequence(); + /** + * optional uint32 sequence = 1; + */ int getSequence(); - + // optional bytes localBaseKey = 2; + /** + * optional bytes localBaseKey = 2; + */ boolean hasLocalBaseKey(); + /** + * optional bytes localBaseKey = 2; + */ com.google.protobuf.ByteString getLocalBaseKey(); - + // optional bytes localBaseKeyPrivate = 3; + /** + * optional bytes localBaseKeyPrivate = 3; + */ boolean hasLocalBaseKeyPrivate(); + /** + * optional bytes localBaseKeyPrivate = 3; + */ com.google.protobuf.ByteString getLocalBaseKeyPrivate(); - + // optional bytes localEphemeralKey = 4; + /** + * optional bytes localEphemeralKey = 4; + */ boolean hasLocalEphemeralKey(); + /** + * optional bytes localEphemeralKey = 4; + */ com.google.protobuf.ByteString getLocalEphemeralKey(); - + // optional bytes localEphemeralKeyPrivate = 5; + /** + * optional bytes localEphemeralKeyPrivate = 5; + */ boolean hasLocalEphemeralKeyPrivate(); + /** + * optional bytes localEphemeralKeyPrivate = 5; + */ com.google.protobuf.ByteString getLocalEphemeralKeyPrivate(); - + // optional bytes localIdentityKey = 7; + /** + * optional bytes localIdentityKey = 7; + */ boolean hasLocalIdentityKey(); + /** + * optional bytes localIdentityKey = 7; + */ com.google.protobuf.ByteString getLocalIdentityKey(); - + // optional bytes localIdentityKeyPrivate = 8; + /** + * optional bytes localIdentityKeyPrivate = 8; + */ boolean hasLocalIdentityKeyPrivate(); + /** + * optional bytes localIdentityKeyPrivate = 8; + */ com.google.protobuf.ByteString getLocalIdentityKeyPrivate(); } + /** + * Protobuf type {@code textsecure.SessionStructure.PendingKeyExchange} + */ public static final class PendingKeyExchange extends com.google.protobuf.GeneratedMessage implements PendingKeyExchangeOrBuilder { // Use PendingKeyExchange.newBuilder() to construct. - private PendingKeyExchange(Builder builder) { + private PendingKeyExchange(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private PendingKeyExchange(boolean noInit) {} - + private PendingKeyExchange(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final PendingKeyExchange defaultInstance; public static PendingKeyExchange getDefaultInstance() { return defaultInstance; } - + public PendingKeyExchange getDefaultInstanceForType() { return defaultInstance; } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_fieldAccessorTable; - } - - private int bitField0_; - // optional uint32 sequence = 1; - public static final int SEQUENCE_FIELD_NUMBER = 1; - private int sequence_; - public boolean hasSequence() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getSequence() { - return sequence_; - } - - // optional bytes localBaseKey = 2; - public static final int LOCALBASEKEY_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString localBaseKey_; - public boolean hasLocalBaseKey() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.google.protobuf.ByteString getLocalBaseKey() { - return localBaseKey_; - } - - // optional bytes localBaseKeyPrivate = 3; - public static final int LOCALBASEKEYPRIVATE_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString localBaseKeyPrivate_; - public boolean hasLocalBaseKeyPrivate() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.google.protobuf.ByteString getLocalBaseKeyPrivate() { - return localBaseKeyPrivate_; - } - - // optional bytes localEphemeralKey = 4; - public static final int LOCALEPHEMERALKEY_FIELD_NUMBER = 4; - private com.google.protobuf.ByteString localEphemeralKey_; - public boolean hasLocalEphemeralKey() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public com.google.protobuf.ByteString getLocalEphemeralKey() { - return localEphemeralKey_; - } - - // optional bytes localEphemeralKeyPrivate = 5; - public static final int LOCALEPHEMERALKEYPRIVATE_FIELD_NUMBER = 5; - private com.google.protobuf.ByteString localEphemeralKeyPrivate_; - public boolean hasLocalEphemeralKeyPrivate() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - public com.google.protobuf.ByteString getLocalEphemeralKeyPrivate() { - return localEphemeralKeyPrivate_; - } - - // optional bytes localIdentityKey = 7; - public static final int LOCALIDENTITYKEY_FIELD_NUMBER = 7; - private com.google.protobuf.ByteString localIdentityKey_; - public boolean hasLocalIdentityKey() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - public com.google.protobuf.ByteString getLocalIdentityKey() { - return localIdentityKey_; - } - - // optional bytes localIdentityKeyPrivate = 8; - public static final int LOCALIDENTITYKEYPRIVATE_FIELD_NUMBER = 8; - private com.google.protobuf.ByteString localIdentityKeyPrivate_; - public boolean hasLocalIdentityKeyPrivate() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - public com.google.protobuf.ByteString getLocalIdentityKeyPrivate() { - return localIdentityKeyPrivate_; - } - - private void initFields() { - sequence_ = 0; - localBaseKey_ = com.google.protobuf.ByteString.EMPTY; - localBaseKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; - localEphemeralKey_ = com.google.protobuf.ByteString.EMPTY; - localEphemeralKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; - localIdentityKey_ = com.google.protobuf.ByteString.EMPTY; - localIdentityKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeUInt32(1, sequence_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, localBaseKey_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, localBaseKeyPrivate_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(4, localEphemeralKey_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeBytes(5, localEphemeralKeyPrivate_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeBytes(7, localIdentityKey_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - output.writeBytes(8, localIdentityKeyPrivate_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(1, sequence_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, localBaseKey_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, localBaseKeyPrivate_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(4, localEphemeralKey_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(5, localEphemeralKeyPrivate_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(7, localIdentityKey_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(8, localIdentityKeyPrivate_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; + + private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; } - - 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.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.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - 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.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - 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.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - 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.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseFrom( + private PendingKeyExchange( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_fieldAccessorTable; - } - - // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - sequence_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - localBaseKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - localBaseKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - localEphemeralKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - localEphemeralKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000010); - localIdentityKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000020); - localIdentityKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000040); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDescriptor(); - } - - public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange getDefaultInstanceForType() { - return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); - } - - 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.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - 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)) { - to_bitField0_ |= 0x00000001; - } - result.sequence_ = sequence_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.localBaseKey_ = localBaseKey_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.localBaseKeyPrivate_ = localBaseKeyPrivate_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.localEphemeralKey_ = localEphemeralKey_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.localEphemeralKeyPrivate_ = localEphemeralKeyPrivate_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000020; - } - result.localIdentityKey_ = localIdentityKey_; - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000040; - } - result.localIdentityKeyPrivate_ = localIdentityKeyPrivate_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message 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.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange other) { - if (other == org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance()) return this; - if (other.hasSequence()) { - setSequence(other.getSequence()); - } - if (other.hasLocalBaseKey()) { - setLocalBaseKey(other.getLocalBaseKey()); - } - if (other.hasLocalBaseKeyPrivate()) { - setLocalBaseKeyPrivate(other.getLocalBaseKeyPrivate()); - } - if (other.hasLocalEphemeralKey()) { - setLocalEphemeralKey(other.getLocalEphemeralKey()); - } - if (other.hasLocalEphemeralKeyPrivate()) { - setLocalEphemeralKeyPrivate(other.getLocalEphemeralKeyPrivate()); - } - if (other.hasLocalIdentityKey()) { - setLocalIdentityKey(other.getLocalIdentityKey()); - } - if (other.hasLocalIdentityKeyPrivate()) { - setLocalIdentityKeyPrivate(other.getLocalIdentityKeyPrivate()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { int tag = input.readTag(); switch (tag) { case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; + break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; } break; } @@ -2287,396 +2595,338 @@ public final class StorageProtos { } } } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); } - - private int bitField0_; - - // optional uint32 sequence = 1; - private int sequence_ ; - public boolean hasSequence() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getSequence() { - return sequence_; - } - public Builder setSequence(int value) { - bitField0_ |= 0x00000001; - sequence_ = value; - onChanged(); - return this; - } - public Builder clearSequence() { - bitField0_ = (bitField0_ & ~0x00000001); - sequence_ = 0; - onChanged(); - return this; - } - - // optional bytes localBaseKey = 2; - private com.google.protobuf.ByteString localBaseKey_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasLocalBaseKey() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.google.protobuf.ByteString getLocalBaseKey() { - return localBaseKey_; - } - public Builder setLocalBaseKey(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - localBaseKey_ = value; - onChanged(); - return this; - } - public Builder clearLocalBaseKey() { - bitField0_ = (bitField0_ & ~0x00000002); - localBaseKey_ = getDefaultInstance().getLocalBaseKey(); - onChanged(); - return this; - } - - // optional bytes localBaseKeyPrivate = 3; - private com.google.protobuf.ByteString localBaseKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasLocalBaseKeyPrivate() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.google.protobuf.ByteString getLocalBaseKeyPrivate() { - return localBaseKeyPrivate_; - } - public Builder setLocalBaseKeyPrivate(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - localBaseKeyPrivate_ = value; - onChanged(); - return this; - } - public Builder clearLocalBaseKeyPrivate() { - bitField0_ = (bitField0_ & ~0x00000004); - localBaseKeyPrivate_ = getDefaultInstance().getLocalBaseKeyPrivate(); - onChanged(); - return this; - } - - // optional bytes localEphemeralKey = 4; - private com.google.protobuf.ByteString localEphemeralKey_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasLocalEphemeralKey() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public com.google.protobuf.ByteString getLocalEphemeralKey() { - return localEphemeralKey_; - } - public Builder setLocalEphemeralKey(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - localEphemeralKey_ = value; - onChanged(); - return this; - } - public Builder clearLocalEphemeralKey() { - bitField0_ = (bitField0_ & ~0x00000008); - localEphemeralKey_ = getDefaultInstance().getLocalEphemeralKey(); - onChanged(); - return this; - } - - // optional bytes localEphemeralKeyPrivate = 5; - private com.google.protobuf.ByteString localEphemeralKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasLocalEphemeralKeyPrivate() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - public com.google.protobuf.ByteString getLocalEphemeralKeyPrivate() { - return localEphemeralKeyPrivate_; - } - public Builder setLocalEphemeralKeyPrivate(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - localEphemeralKeyPrivate_ = value; - onChanged(); - return this; - } - public Builder clearLocalEphemeralKeyPrivate() { - bitField0_ = (bitField0_ & ~0x00000010); - localEphemeralKeyPrivate_ = getDefaultInstance().getLocalEphemeralKeyPrivate(); - onChanged(); - return this; - } - - // optional bytes localIdentityKey = 7; - private com.google.protobuf.ByteString localIdentityKey_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasLocalIdentityKey() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - public com.google.protobuf.ByteString getLocalIdentityKey() { - return localIdentityKey_; - } - public Builder setLocalIdentityKey(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000020; - localIdentityKey_ = value; - onChanged(); - return this; - } - public Builder clearLocalIdentityKey() { - bitField0_ = (bitField0_ & ~0x00000020); - localIdentityKey_ = getDefaultInstance().getLocalIdentityKey(); - onChanged(); - return this; - } - - // optional bytes localIdentityKeyPrivate = 8; - private com.google.protobuf.ByteString localIdentityKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasLocalIdentityKeyPrivate() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - public com.google.protobuf.ByteString getLocalIdentityKeyPrivate() { - return localIdentityKeyPrivate_; - } - public Builder setLocalIdentityKeyPrivate(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000040; - localIdentityKeyPrivate_ = value; - onChanged(); - return this; - } - public Builder clearLocalIdentityKeyPrivate() { - bitField0_ = (bitField0_ & ~0x00000040); - localIdentityKeyPrivate_ = getDefaultInstance().getLocalIdentityKeyPrivate(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:textsecure.SessionStructure.PendingKeyExchange) } - - static { - defaultInstance = new PendingKeyExchange(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:textsecure.SessionStructure.PendingKeyExchange) - } - - public interface PendingPreKeyOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional uint32 preKeyId = 1; - boolean hasPreKeyId(); - int getPreKeyId(); - - // optional bytes baseKey = 2; - boolean hasBaseKey(); - com.google.protobuf.ByteString getBaseKey(); - } - public static final class PendingPreKey extends - com.google.protobuf.GeneratedMessage - implements PendingPreKeyOrBuilder { - // Use PendingPreKey.newBuilder() to construct. - private PendingPreKey(Builder builder) { - super(builder); - } - private PendingPreKey(boolean noInit) {} - - private static final PendingPreKey defaultInstance; - public static PendingPreKey getDefaultInstance() { - return defaultInstance; - } - - public PendingPreKey getDefaultInstanceForType() { - return defaultInstance; - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.class, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder.class); } - + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public PendingKeyExchange parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PendingKeyExchange(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + private int bitField0_; - // optional uint32 preKeyId = 1; - public static final int PREKEYID_FIELD_NUMBER = 1; - private int preKeyId_; - public boolean hasPreKeyId() { + // optional uint32 sequence = 1; + public static final int SEQUENCE_FIELD_NUMBER = 1; + private int sequence_; + /** + * optional uint32 sequence = 1; + */ + public boolean hasSequence() { return ((bitField0_ & 0x00000001) == 0x00000001); } - public int getPreKeyId() { - return preKeyId_; + /** + * optional uint32 sequence = 1; + */ + public int getSequence() { + return sequence_; } - - // optional bytes baseKey = 2; - public static final int BASEKEY_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString baseKey_; - public boolean hasBaseKey() { + + // optional bytes localBaseKey = 2; + public static final int LOCALBASEKEY_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString localBaseKey_; + /** + * optional bytes localBaseKey = 2; + */ + public boolean hasLocalBaseKey() { return ((bitField0_ & 0x00000002) == 0x00000002); } - public com.google.protobuf.ByteString getBaseKey() { - return baseKey_; + /** + * optional bytes localBaseKey = 2; + */ + public com.google.protobuf.ByteString getLocalBaseKey() { + return localBaseKey_; } - + + // optional bytes localBaseKeyPrivate = 3; + public static final int LOCALBASEKEYPRIVATE_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString localBaseKeyPrivate_; + /** + * optional bytes localBaseKeyPrivate = 3; + */ + public boolean hasLocalBaseKeyPrivate() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional bytes localBaseKeyPrivate = 3; + */ + public com.google.protobuf.ByteString getLocalBaseKeyPrivate() { + return localBaseKeyPrivate_; + } + + // optional bytes localEphemeralKey = 4; + public static final int LOCALEPHEMERALKEY_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString localEphemeralKey_; + /** + * optional bytes localEphemeralKey = 4; + */ + public boolean hasLocalEphemeralKey() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional bytes localEphemeralKey = 4; + */ + public com.google.protobuf.ByteString getLocalEphemeralKey() { + return localEphemeralKey_; + } + + // optional bytes localEphemeralKeyPrivate = 5; + public static final int LOCALEPHEMERALKEYPRIVATE_FIELD_NUMBER = 5; + private com.google.protobuf.ByteString localEphemeralKeyPrivate_; + /** + * optional bytes localEphemeralKeyPrivate = 5; + */ + public boolean hasLocalEphemeralKeyPrivate() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional bytes localEphemeralKeyPrivate = 5; + */ + public com.google.protobuf.ByteString getLocalEphemeralKeyPrivate() { + return localEphemeralKeyPrivate_; + } + + // optional bytes localIdentityKey = 7; + public static final int LOCALIDENTITYKEY_FIELD_NUMBER = 7; + private com.google.protobuf.ByteString localIdentityKey_; + /** + * optional bytes localIdentityKey = 7; + */ + public boolean hasLocalIdentityKey() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * optional bytes localIdentityKey = 7; + */ + public com.google.protobuf.ByteString getLocalIdentityKey() { + return localIdentityKey_; + } + + // optional bytes localIdentityKeyPrivate = 8; + public static final int LOCALIDENTITYKEYPRIVATE_FIELD_NUMBER = 8; + private com.google.protobuf.ByteString localIdentityKeyPrivate_; + /** + * optional bytes localIdentityKeyPrivate = 8; + */ + public boolean hasLocalIdentityKeyPrivate() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + /** + * optional bytes localIdentityKeyPrivate = 8; + */ + public com.google.protobuf.ByteString getLocalIdentityKeyPrivate() { + return localIdentityKeyPrivate_; + } + private void initFields() { - preKeyId_ = 0; - baseKey_ = com.google.protobuf.ByteString.EMPTY; + sequence_ = 0; + localBaseKey_ = com.google.protobuf.ByteString.EMPTY; + localBaseKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; + localEphemeralKey_ = com.google.protobuf.ByteString.EMPTY; + localEphemeralKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; + localIdentityKey_ = com.google.protobuf.ByteString.EMPTY; + localIdentityKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeUInt32(1, preKeyId_); + output.writeUInt32(1, sequence_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, baseKey_); + output.writeBytes(2, localBaseKey_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, localBaseKeyPrivate_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, localEphemeralKey_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(5, localEphemeralKeyPrivate_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBytes(7, localIdentityKey_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeBytes(8, localIdentityKeyPrivate_); } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(1, preKeyId_); + .computeUInt32Size(1, sequence_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, baseKey_); + .computeBytesSize(2, localBaseKey_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, localBaseKeyPrivate_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, localEphemeralKey_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, localEphemeralKeyPrivate_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(7, localIdentityKey_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(8, localIdentityKeyPrivate_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } - + private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } - - public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey 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(); + return PARSER.parseFrom(data); } - public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey 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(); + return PARSER.parseFrom(data, extensionRegistry); } - public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey 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(); + return PARSER.parseFrom(data); } - public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey 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(); + return PARSER.parseFrom(data, extensionRegistry); } - public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey 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(); + return PARSER.parseFrom(input); } - public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey 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(); + return PARSER.parseFrom(input, extensionRegistry); } - public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey 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)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } - public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseDelimitedFrom( + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } - public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey 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(); + return PARSER.parseFrom(input); } - public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey 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 { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey prototype) { + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** + * Protobuf type {@code textsecure.SessionStructure.PendingKeyExchange} + */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder { + implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_descriptor; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.class, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder.class); } - - // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.newBuilder() + + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.newBuilder() private Builder() { maybeForceBuilderInitialization(); } - - private Builder(BuilderParent parent) { + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } @@ -2687,29 +2937,775 @@ public final class StorageProtos { private static Builder create() { return new Builder(); } - + + public Builder clear() { + super.clear(); + sequence_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + localBaseKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + localBaseKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + localEphemeralKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + localEphemeralKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + localIdentityKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000020); + localIdentityKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000040); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingKeyExchange_descriptor; + } + + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); + } + + 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; + } + + 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)) { + to_bitField0_ |= 0x00000001; + } + result.sequence_ = sequence_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.localBaseKey_ = localBaseKey_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.localBaseKeyPrivate_ = localBaseKeyPrivate_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.localEphemeralKey_ = localEphemeralKey_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.localEphemeralKeyPrivate_ = localEphemeralKeyPrivate_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.localIdentityKey_ = localIdentityKey_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000040; + } + result.localIdentityKeyPrivate_ = localIdentityKeyPrivate_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message 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.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange other) { + if (other == org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance()) return this; + if (other.hasSequence()) { + setSequence(other.getSequence()); + } + if (other.hasLocalBaseKey()) { + setLocalBaseKey(other.getLocalBaseKey()); + } + if (other.hasLocalBaseKeyPrivate()) { + setLocalBaseKeyPrivate(other.getLocalBaseKeyPrivate()); + } + if (other.hasLocalEphemeralKey()) { + setLocalEphemeralKey(other.getLocalEphemeralKey()); + } + if (other.hasLocalEphemeralKeyPrivate()) { + setLocalEphemeralKeyPrivate(other.getLocalEphemeralKeyPrivate()); + } + if (other.hasLocalIdentityKey()) { + setLocalIdentityKey(other.getLocalIdentityKey()); + } + if (other.hasLocalIdentityKeyPrivate()) { + setLocalIdentityKeyPrivate(other.getLocalIdentityKeyPrivate()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // optional uint32 sequence = 1; + private int sequence_ ; + /** + * optional uint32 sequence = 1; + */ + public boolean hasSequence() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional uint32 sequence = 1; + */ + public int getSequence() { + return sequence_; + } + /** + * optional uint32 sequence = 1; + */ + public Builder setSequence(int value) { + bitField0_ |= 0x00000001; + sequence_ = value; + onChanged(); + return this; + } + /** + * optional uint32 sequence = 1; + */ + public Builder clearSequence() { + bitField0_ = (bitField0_ & ~0x00000001); + sequence_ = 0; + onChanged(); + return this; + } + + // optional bytes localBaseKey = 2; + private com.google.protobuf.ByteString localBaseKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes localBaseKey = 2; + */ + public boolean hasLocalBaseKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional bytes localBaseKey = 2; + */ + public com.google.protobuf.ByteString getLocalBaseKey() { + return localBaseKey_; + } + /** + * optional bytes localBaseKey = 2; + */ + public Builder setLocalBaseKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + localBaseKey_ = value; + onChanged(); + return this; + } + /** + * optional bytes localBaseKey = 2; + */ + public Builder clearLocalBaseKey() { + bitField0_ = (bitField0_ & ~0x00000002); + localBaseKey_ = getDefaultInstance().getLocalBaseKey(); + onChanged(); + return this; + } + + // optional bytes localBaseKeyPrivate = 3; + private com.google.protobuf.ByteString localBaseKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes localBaseKeyPrivate = 3; + */ + public boolean hasLocalBaseKeyPrivate() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional bytes localBaseKeyPrivate = 3; + */ + public com.google.protobuf.ByteString getLocalBaseKeyPrivate() { + return localBaseKeyPrivate_; + } + /** + * optional bytes localBaseKeyPrivate = 3; + */ + public Builder setLocalBaseKeyPrivate(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + localBaseKeyPrivate_ = value; + onChanged(); + return this; + } + /** + * optional bytes localBaseKeyPrivate = 3; + */ + public Builder clearLocalBaseKeyPrivate() { + bitField0_ = (bitField0_ & ~0x00000004); + localBaseKeyPrivate_ = getDefaultInstance().getLocalBaseKeyPrivate(); + onChanged(); + return this; + } + + // optional bytes localEphemeralKey = 4; + private com.google.protobuf.ByteString localEphemeralKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes localEphemeralKey = 4; + */ + public boolean hasLocalEphemeralKey() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional bytes localEphemeralKey = 4; + */ + public com.google.protobuf.ByteString getLocalEphemeralKey() { + return localEphemeralKey_; + } + /** + * optional bytes localEphemeralKey = 4; + */ + public Builder setLocalEphemeralKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + localEphemeralKey_ = value; + onChanged(); + return this; + } + /** + * optional bytes localEphemeralKey = 4; + */ + public Builder clearLocalEphemeralKey() { + bitField0_ = (bitField0_ & ~0x00000008); + localEphemeralKey_ = getDefaultInstance().getLocalEphemeralKey(); + onChanged(); + return this; + } + + // optional bytes localEphemeralKeyPrivate = 5; + private com.google.protobuf.ByteString localEphemeralKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes localEphemeralKeyPrivate = 5; + */ + public boolean hasLocalEphemeralKeyPrivate() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional bytes localEphemeralKeyPrivate = 5; + */ + public com.google.protobuf.ByteString getLocalEphemeralKeyPrivate() { + return localEphemeralKeyPrivate_; + } + /** + * optional bytes localEphemeralKeyPrivate = 5; + */ + public Builder setLocalEphemeralKeyPrivate(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + localEphemeralKeyPrivate_ = value; + onChanged(); + return this; + } + /** + * optional bytes localEphemeralKeyPrivate = 5; + */ + public Builder clearLocalEphemeralKeyPrivate() { + bitField0_ = (bitField0_ & ~0x00000010); + localEphemeralKeyPrivate_ = getDefaultInstance().getLocalEphemeralKeyPrivate(); + onChanged(); + return this; + } + + // optional bytes localIdentityKey = 7; + private com.google.protobuf.ByteString localIdentityKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes localIdentityKey = 7; + */ + public boolean hasLocalIdentityKey() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * optional bytes localIdentityKey = 7; + */ + public com.google.protobuf.ByteString getLocalIdentityKey() { + return localIdentityKey_; + } + /** + * optional bytes localIdentityKey = 7; + */ + public Builder setLocalIdentityKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000020; + localIdentityKey_ = value; + onChanged(); + return this; + } + /** + * optional bytes localIdentityKey = 7; + */ + public Builder clearLocalIdentityKey() { + bitField0_ = (bitField0_ & ~0x00000020); + localIdentityKey_ = getDefaultInstance().getLocalIdentityKey(); + onChanged(); + return this; + } + + // optional bytes localIdentityKeyPrivate = 8; + private com.google.protobuf.ByteString localIdentityKeyPrivate_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes localIdentityKeyPrivate = 8; + */ + public boolean hasLocalIdentityKeyPrivate() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + /** + * optional bytes localIdentityKeyPrivate = 8; + */ + public com.google.protobuf.ByteString getLocalIdentityKeyPrivate() { + return localIdentityKeyPrivate_; + } + /** + * optional bytes localIdentityKeyPrivate = 8; + */ + public Builder setLocalIdentityKeyPrivate(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000040; + localIdentityKeyPrivate_ = value; + onChanged(); + return this; + } + /** + * optional bytes localIdentityKeyPrivate = 8; + */ + public Builder clearLocalIdentityKeyPrivate() { + bitField0_ = (bitField0_ & ~0x00000040); + localIdentityKeyPrivate_ = getDefaultInstance().getLocalIdentityKeyPrivate(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:textsecure.SessionStructure.PendingKeyExchange) + } + + static { + defaultInstance = new PendingKeyExchange(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:textsecure.SessionStructure.PendingKeyExchange) + } + + public interface PendingPreKeyOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional uint32 preKeyId = 1; + /** + * optional uint32 preKeyId = 1; + */ + boolean hasPreKeyId(); + /** + * optional uint32 preKeyId = 1; + */ + int getPreKeyId(); + + // optional uint32 deviceKeyId = 3; + /** + * optional uint32 deviceKeyId = 3; + */ + boolean hasDeviceKeyId(); + /** + * optional uint32 deviceKeyId = 3; + */ + int getDeviceKeyId(); + + // optional bytes baseKey = 2; + /** + * optional bytes baseKey = 2; + */ + boolean hasBaseKey(); + /** + * optional bytes baseKey = 2; + */ + com.google.protobuf.ByteString getBaseKey(); + } + /** + * Protobuf type {@code textsecure.SessionStructure.PendingPreKey} + */ + public static final class PendingPreKey extends + com.google.protobuf.GeneratedMessage + implements PendingPreKeyOrBuilder { + // Use PendingPreKey.newBuilder() to construct. + private PendingPreKey(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private PendingPreKey(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final PendingPreKey defaultInstance; + public static PendingPreKey getDefaultInstance() { + return defaultInstance; + } + + public PendingPreKey getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private PendingPreKey( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + preKeyId_ = input.readUInt32(); + break; + } + case 18: { + bitField0_ |= 0x00000004; + baseKey_ = input.readBytes(); + break; + } + case 24: { + bitField0_ |= 0x00000002; + deviceKeyId_ = input.readUInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.class, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public PendingPreKey parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PendingPreKey(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // optional uint32 preKeyId = 1; + public static final int PREKEYID_FIELD_NUMBER = 1; + private int preKeyId_; + /** + * optional uint32 preKeyId = 1; + */ + public boolean hasPreKeyId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional uint32 preKeyId = 1; + */ + public int getPreKeyId() { + return preKeyId_; + } + + // optional uint32 deviceKeyId = 3; + public static final int DEVICEKEYID_FIELD_NUMBER = 3; + private int deviceKeyId_; + /** + * optional uint32 deviceKeyId = 3; + */ + public boolean hasDeviceKeyId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional uint32 deviceKeyId = 3; + */ + public int getDeviceKeyId() { + return deviceKeyId_; + } + + // optional bytes baseKey = 2; + public static final int BASEKEY_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString baseKey_; + /** + * optional bytes baseKey = 2; + */ + public boolean hasBaseKey() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional bytes baseKey = 2; + */ + public com.google.protobuf.ByteString getBaseKey() { + return baseKey_; + } + + private void initFields() { + preKeyId_ = 0; + deviceKeyId_ = 0; + baseKey_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeUInt32(1, preKeyId_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(2, baseKey_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeUInt32(3, deviceKeyId_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, preKeyId_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, baseKey_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(3, deviceKeyId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + 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 PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code textsecure.SessionStructure.PendingPreKey} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.class, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder.class); + } + + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + public Builder clear() { super.clear(); preKeyId_ = 0; bitField0_ = (bitField0_ & ~0x00000001); - baseKey_ = com.google.protobuf.ByteString.EMPTY; + deviceKeyId_ = 0; bitField0_ = (bitField0_ & ~0x00000002); + baseKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); return this; } - + public Builder clone() { return create().mergeFrom(buildPartial()); } - + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_PendingPreKey_descriptor; } - + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey getDefaultInstanceForType() { return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); } - + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey build() { org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey result = buildPartial(); if (!result.isInitialized()) { @@ -2717,17 +3713,7 @@ public final class StorageProtos { } return result; } - - private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - + 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_; @@ -2739,12 +3725,16 @@ public final class StorageProtos { if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } + result.deviceKeyId_ = deviceKeyId_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } result.baseKey_ = baseKey_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } - + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey) { return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey)other); @@ -2753,259 +3743,405 @@ public final class StorageProtos { 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()); } + if (other.hasDeviceKeyId()) { + setDeviceKeyId(other.getDeviceKeyId()); + } if (other.hasBaseKey()) { setBaseKey(other.getBaseKey()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } - + public final boolean isInitialized() { return true; } - + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - preKeyId_ = input.readUInt32(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - baseKey_ = input.readBytes(); - break; - } + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - private int bitField0_; - + // optional uint32 preKeyId = 1; private int preKeyId_ ; + /** + * optional uint32 preKeyId = 1; + */ public boolean hasPreKeyId() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional uint32 preKeyId = 1; + */ public int getPreKeyId() { return preKeyId_; } + /** + * optional uint32 preKeyId = 1; + */ public Builder setPreKeyId(int value) { bitField0_ |= 0x00000001; preKeyId_ = value; onChanged(); return this; } + /** + * optional uint32 preKeyId = 1; + */ public Builder clearPreKeyId() { bitField0_ = (bitField0_ & ~0x00000001); preKeyId_ = 0; onChanged(); return this; } - - // optional bytes baseKey = 2; - private com.google.protobuf.ByteString baseKey_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasBaseKey() { + + // optional uint32 deviceKeyId = 3; + private int deviceKeyId_ ; + /** + * optional uint32 deviceKeyId = 3; + */ + public boolean hasDeviceKeyId() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional uint32 deviceKeyId = 3; + */ + public int getDeviceKeyId() { + return deviceKeyId_; + } + /** + * optional uint32 deviceKeyId = 3; + */ + public Builder setDeviceKeyId(int value) { + bitField0_ |= 0x00000002; + deviceKeyId_ = value; + onChanged(); + return this; + } + /** + * optional uint32 deviceKeyId = 3; + */ + public Builder clearDeviceKeyId() { + bitField0_ = (bitField0_ & ~0x00000002); + deviceKeyId_ = 0; + onChanged(); + return this; + } + + // optional bytes baseKey = 2; + private com.google.protobuf.ByteString baseKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes baseKey = 2; + */ + public boolean hasBaseKey() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional bytes baseKey = 2; + */ public com.google.protobuf.ByteString getBaseKey() { return baseKey_; } + /** + * optional bytes baseKey = 2; + */ public Builder setBaseKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - bitField0_ |= 0x00000002; + bitField0_ |= 0x00000004; baseKey_ = value; onChanged(); return this; } + /** + * optional bytes baseKey = 2; + */ public Builder clearBaseKey() { - bitField0_ = (bitField0_ & ~0x00000002); + bitField0_ = (bitField0_ & ~0x00000004); baseKey_ = getDefaultInstance().getBaseKey(); onChanged(); return this; } - + // @@protoc_insertion_point(builder_scope:textsecure.SessionStructure.PendingPreKey) } - + static { defaultInstance = new PendingPreKey(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.SessionStructure.PendingPreKey) } - + private int bitField0_; // optional uint32 sessionVersion = 1; public static final int SESSIONVERSION_FIELD_NUMBER = 1; private int sessionVersion_; + /** + * optional uint32 sessionVersion = 1; + */ public boolean hasSessionVersion() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional uint32 sessionVersion = 1; + */ public int getSessionVersion() { return sessionVersion_; } - + // optional bytes localIdentityPublic = 2; public static final int LOCALIDENTITYPUBLIC_FIELD_NUMBER = 2; private com.google.protobuf.ByteString localIdentityPublic_; + /** + * optional bytes localIdentityPublic = 2; + */ public boolean hasLocalIdentityPublic() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional bytes localIdentityPublic = 2; + */ public com.google.protobuf.ByteString getLocalIdentityPublic() { return localIdentityPublic_; } - + // optional bytes remoteIdentityPublic = 3; public static final int REMOTEIDENTITYPUBLIC_FIELD_NUMBER = 3; private com.google.protobuf.ByteString remoteIdentityPublic_; + /** + * optional bytes remoteIdentityPublic = 3; + */ public boolean hasRemoteIdentityPublic() { return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional bytes remoteIdentityPublic = 3; + */ public com.google.protobuf.ByteString getRemoteIdentityPublic() { return remoteIdentityPublic_; } - + // optional bytes rootKey = 4; public static final int ROOTKEY_FIELD_NUMBER = 4; private com.google.protobuf.ByteString rootKey_; + /** + * optional bytes rootKey = 4; + */ public boolean hasRootKey() { return ((bitField0_ & 0x00000008) == 0x00000008); } + /** + * optional bytes rootKey = 4; + */ public com.google.protobuf.ByteString getRootKey() { return rootKey_; } - + // optional uint32 previousCounter = 5; public static final int PREVIOUSCOUNTER_FIELD_NUMBER = 5; private int previousCounter_; + /** + * optional uint32 previousCounter = 5; + */ public boolean hasPreviousCounter() { return ((bitField0_ & 0x00000010) == 0x00000010); } + /** + * optional uint32 previousCounter = 5; + */ public int getPreviousCounter() { return previousCounter_; } - + // optional .textsecure.SessionStructure.Chain senderChain = 6; public static final int SENDERCHAIN_FIELD_NUMBER = 6; private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain senderChain_; + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ public boolean hasSenderChain() { return ((bitField0_ & 0x00000020) == 0x00000020); } + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getSenderChain() { return senderChain_; } + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ 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_; + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public java.util.List getReceiverChainsList() { return receiverChains_; } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public java.util.List getReceiverChainsOrBuilderList() { return receiverChains_; } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public int getReceiverChainsCount() { return receiverChains_.size(); } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getReceiverChains(int index) { return receiverChains_.get(index); } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ 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.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange pendingKeyExchange_; + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ public boolean hasPendingKeyExchange() { return ((bitField0_ & 0x00000040) == 0x00000040); } + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange getPendingKeyExchange() { return pendingKeyExchange_; } + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ 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.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey pendingPreKey_; + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ public boolean hasPendingPreKey() { return ((bitField0_ & 0x00000080) == 0x00000080); } + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey getPendingPreKey() { return pendingPreKey_; } + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder getPendingPreKeyOrBuilder() { return pendingPreKey_; } - + // optional uint32 remoteRegistrationId = 10; public static final int REMOTEREGISTRATIONID_FIELD_NUMBER = 10; private int remoteRegistrationId_; + /** + * optional uint32 remoteRegistrationId = 10; + */ public boolean hasRemoteRegistrationId() { return ((bitField0_ & 0x00000100) == 0x00000100); } + /** + * optional uint32 remoteRegistrationId = 10; + */ public int getRemoteRegistrationId() { return remoteRegistrationId_; } - + // optional uint32 localRegistrationId = 11; public static final int LOCALREGISTRATIONID_FIELD_NUMBER = 11; private int localRegistrationId_; + /** + * optional uint32 localRegistrationId = 11; + */ public boolean hasLocalRegistrationId() { return ((bitField0_ & 0x00000200) == 0x00000200); } + /** + * optional uint32 localRegistrationId = 11; + */ public int getLocalRegistrationId() { return localRegistrationId_; } - + // optional bool needsRefresh = 12; public static final int NEEDSREFRESH_FIELD_NUMBER = 12; private boolean needsRefresh_; + /** + * optional bool needsRefresh = 12; + */ public boolean hasNeedsRefresh() { return ((bitField0_ & 0x00000400) == 0x00000400); } + /** + * optional bool needsRefresh = 12; + */ public boolean getNeedsRefresh() { return needsRefresh_; } - + + // optional bytes aliceBaseKey = 13; + public static final int ALICEBASEKEY_FIELD_NUMBER = 13; + private com.google.protobuf.ByteString aliceBaseKey_; + /** + * optional bytes aliceBaseKey = 13; + */ + public boolean hasAliceBaseKey() { + return ((bitField0_ & 0x00000800) == 0x00000800); + } + /** + * optional bytes aliceBaseKey = 13; + */ + public com.google.protobuf.ByteString getAliceBaseKey() { + return aliceBaseKey_; + } + private void initFields() { sessionVersion_ = 0; localIdentityPublic_ = com.google.protobuf.ByteString.EMPTY; @@ -3019,16 +4155,17 @@ public final class StorageProtos { remoteRegistrationId_ = 0; localRegistrationId_ = 0; needsRefresh_ = false; + aliceBaseKey_ = com.google.protobuf.ByteString.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); @@ -3068,14 +4205,17 @@ public final class StorageProtos { if (((bitField0_ & 0x00000400) == 0x00000400)) { output.writeBool(12, needsRefresh_); } + if (((bitField0_ & 0x00000800) == 0x00000800)) { + output.writeBytes(13, aliceBaseKey_); + } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream @@ -3125,98 +4265,91 @@ public final class StorageProtos { size += com.google.protobuf.CodedOutputStream .computeBoolSize(12, needsRefresh_); } + if (((bitField0_ & 0x00000800) == 0x00000800)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(13, aliceBaseKey_); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } - + private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } - + public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } 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(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } 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(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } 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(); + return PARSER.parseFrom(input, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** + * Protobuf type {@code textsecure.SessionStructure} + */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder { @@ -3224,18 +4357,21 @@ public final class StorageProtos { getDescriptor() { return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.class, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder.class); } - + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.newBuilder() private Builder() { maybeForceBuilderInitialization(); } - - private Builder(BuilderParent parent) { + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } @@ -3250,7 +4386,7 @@ public final class StorageProtos { private static Builder create() { return new Builder(); } - + public Builder clear() { super.clear(); sessionVersion_ = 0; @@ -3293,22 +4429,24 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000400); needsRefresh_ = false; bitField0_ = (bitField0_ & ~0x00000800); + aliceBaseKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00001000); return this; } - + public Builder clone() { return create().mergeFrom(buildPartial()); } - + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_SessionStructure_descriptor; } - + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getDefaultInstanceForType() { return org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance(); } - + public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure build() { org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure result = buildPartial(); if (!result.isInitialized()) { @@ -3316,17 +4454,7 @@ public final class StorageProtos { } return result; } - - private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - + 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_; @@ -3396,11 +4524,15 @@ public final class StorageProtos { to_bitField0_ |= 0x00000400; } result.needsRefresh_ = needsRefresh_; + if (((from_bitField0_ & 0x00001000) == 0x00001000)) { + to_bitField0_ |= 0x00000800; + } + result.aliceBaseKey_ = aliceBaseKey_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } - + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure) { return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure)other); @@ -3409,7 +4541,7 @@ public final class StorageProtos { 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()) { @@ -3471,145 +4603,86 @@ public final class StorageProtos { if (other.hasNeedsRefresh()) { setNeedsRefresh(other.getNeedsRefresh()); } + if (other.hasAliceBaseKey()) { + setAliceBaseKey(other.getAliceBaseKey()); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } - + public final boolean isInitialized() { return true; } - + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - sessionVersion_ = input.readUInt32(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - localIdentityPublic_ = input.readBytes(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - remoteIdentityPublic_ = input.readBytes(); - break; - } - case 34: { - bitField0_ |= 0x00000008; - rootKey_ = input.readBytes(); - break; - } - case 40: { - bitField0_ |= 0x00000010; - previousCounter_ = input.readUInt32(); - break; - } - case 50: { - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.newBuilder(); - if (hasSenderChain()) { - subBuilder.mergeFrom(getSenderChain()); - } - input.readMessage(subBuilder, extensionRegistry); - setSenderChain(subBuilder.buildPartial()); - break; - } - case 58: { - 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.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.newBuilder(); - if (hasPendingKeyExchange()) { - subBuilder.mergeFrom(getPendingKeyExchange()); - } - input.readMessage(subBuilder, extensionRegistry); - setPendingKeyExchange(subBuilder.buildPartial()); - break; - } - case 74: { - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.newBuilder(); - if (hasPendingPreKey()) { - subBuilder.mergeFrom(getPendingPreKey()); - } - input.readMessage(subBuilder, extensionRegistry); - setPendingPreKey(subBuilder.buildPartial()); - break; - } - case 80: { - bitField0_ |= 0x00000200; - remoteRegistrationId_ = input.readUInt32(); - break; - } - case 88: { - bitField0_ |= 0x00000400; - localRegistrationId_ = input.readUInt32(); - break; - } - case 96: { - bitField0_ |= 0x00000800; - needsRefresh_ = input.readBool(); - break; - } + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - private int bitField0_; - + // optional uint32 sessionVersion = 1; private int sessionVersion_ ; + /** + * optional uint32 sessionVersion = 1; + */ public boolean hasSessionVersion() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional uint32 sessionVersion = 1; + */ public int getSessionVersion() { return sessionVersion_; } + /** + * optional uint32 sessionVersion = 1; + */ public Builder setSessionVersion(int value) { bitField0_ |= 0x00000001; sessionVersion_ = value; onChanged(); return this; } + /** + * optional uint32 sessionVersion = 1; + */ public Builder clearSessionVersion() { bitField0_ = (bitField0_ & ~0x00000001); sessionVersion_ = 0; onChanged(); return this; } - + // optional bytes localIdentityPublic = 2; private com.google.protobuf.ByteString localIdentityPublic_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes localIdentityPublic = 2; + */ public boolean hasLocalIdentityPublic() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional bytes localIdentityPublic = 2; + */ public com.google.protobuf.ByteString getLocalIdentityPublic() { return localIdentityPublic_; } + /** + * optional bytes localIdentityPublic = 2; + */ public Builder setLocalIdentityPublic(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -3619,21 +4692,33 @@ public final class StorageProtos { onChanged(); return this; } + /** + * optional bytes localIdentityPublic = 2; + */ public Builder clearLocalIdentityPublic() { bitField0_ = (bitField0_ & ~0x00000002); localIdentityPublic_ = getDefaultInstance().getLocalIdentityPublic(); onChanged(); return this; } - + // optional bytes remoteIdentityPublic = 3; private com.google.protobuf.ByteString remoteIdentityPublic_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes remoteIdentityPublic = 3; + */ public boolean hasRemoteIdentityPublic() { return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional bytes remoteIdentityPublic = 3; + */ public com.google.protobuf.ByteString getRemoteIdentityPublic() { return remoteIdentityPublic_; } + /** + * optional bytes remoteIdentityPublic = 3; + */ public Builder setRemoteIdentityPublic(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -3643,21 +4728,33 @@ public final class StorageProtos { onChanged(); return this; } + /** + * optional bytes remoteIdentityPublic = 3; + */ public Builder clearRemoteIdentityPublic() { bitField0_ = (bitField0_ & ~0x00000004); remoteIdentityPublic_ = getDefaultInstance().getRemoteIdentityPublic(); onChanged(); return this; } - + // optional bytes rootKey = 4; private com.google.protobuf.ByteString rootKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes rootKey = 4; + */ public boolean hasRootKey() { return ((bitField0_ & 0x00000008) == 0x00000008); } + /** + * optional bytes rootKey = 4; + */ public com.google.protobuf.ByteString getRootKey() { return rootKey_; } + /** + * optional bytes rootKey = 4; + */ public Builder setRootKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -3667,41 +4764,62 @@ public final class StorageProtos { onChanged(); return this; } + /** + * optional bytes rootKey = 4; + */ public Builder clearRootKey() { bitField0_ = (bitField0_ & ~0x00000008); rootKey_ = getDefaultInstance().getRootKey(); onChanged(); return this; } - + // optional uint32 previousCounter = 5; private int previousCounter_ ; + /** + * optional uint32 previousCounter = 5; + */ public boolean hasPreviousCounter() { return ((bitField0_ & 0x00000010) == 0x00000010); } + /** + * optional uint32 previousCounter = 5; + */ public int getPreviousCounter() { return previousCounter_; } + /** + * optional uint32 previousCounter = 5; + */ public Builder setPreviousCounter(int value) { bitField0_ |= 0x00000010; previousCounter_ = value; onChanged(); return this; } + /** + * optional uint32 previousCounter = 5; + */ public Builder clearPreviousCounter() { bitField0_ = (bitField0_ & ~0x00000010); previousCounter_ = 0; onChanged(); return this; } - + // optional .textsecure.SessionStructure.Chain senderChain = 6; private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain senderChain_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder> senderChainBuilder_; + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ public boolean hasSenderChain() { return ((bitField0_ & 0x00000020) == 0x00000020); } + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getSenderChain() { if (senderChainBuilder_ == null) { return senderChain_; @@ -3709,6 +4827,9 @@ public final class StorageProtos { return senderChainBuilder_.getMessage(); } } + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ public Builder setSenderChain(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain value) { if (senderChainBuilder_ == null) { if (value == null) { @@ -3722,6 +4843,9 @@ public final class StorageProtos { bitField0_ |= 0x00000020; return this; } + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ public Builder setSenderChain( org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder builderForValue) { if (senderChainBuilder_ == null) { @@ -3733,6 +4857,9 @@ public final class StorageProtos { bitField0_ |= 0x00000020; return this; } + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ public Builder mergeSenderChain(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain value) { if (senderChainBuilder_ == null) { if (((bitField0_ & 0x00000020) == 0x00000020) && @@ -3749,6 +4876,9 @@ public final class StorageProtos { bitField0_ |= 0x00000020; return this; } + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ public Builder clearSenderChain() { if (senderChainBuilder_ == null) { senderChain_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance(); @@ -3759,11 +4889,17 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000020); return this; } + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder getSenderChainBuilder() { bitField0_ |= 0x00000020; onChanged(); return getSenderChainFieldBuilder().getBuilder(); } + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder getSenderChainOrBuilder() { if (senderChainBuilder_ != null) { return senderChainBuilder_.getMessageOrBuilder(); @@ -3771,6 +4907,9 @@ public final class StorageProtos { return senderChain_; } } + /** + * optional .textsecure.SessionStructure.Chain senderChain = 6; + */ private com.google.protobuf.SingleFieldBuilder< org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder> getSenderChainFieldBuilder() { @@ -3784,7 +4923,7 @@ public final class StorageProtos { } return senderChainBuilder_; } - + // repeated .textsecure.SessionStructure.Chain receiverChains = 7; private java.util.List receiverChains_ = java.util.Collections.emptyList(); @@ -3794,10 +4933,13 @@ public final class StorageProtos { bitField0_ |= 0x00000040; } } - + private com.google.protobuf.RepeatedFieldBuilder< org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder> receiverChainsBuilder_; - + + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public java.util.List getReceiverChainsList() { if (receiverChainsBuilder_ == null) { return java.util.Collections.unmodifiableList(receiverChains_); @@ -3805,6 +4947,9 @@ public final class StorageProtos { return receiverChainsBuilder_.getMessageList(); } } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public int getReceiverChainsCount() { if (receiverChainsBuilder_ == null) { return receiverChains_.size(); @@ -3812,6 +4957,9 @@ public final class StorageProtos { return receiverChainsBuilder_.getCount(); } } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain getReceiverChains(int index) { if (receiverChainsBuilder_ == null) { return receiverChains_.get(index); @@ -3819,6 +4967,9 @@ public final class StorageProtos { return receiverChainsBuilder_.getMessage(index); } } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public Builder setReceiverChains( int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain value) { if (receiverChainsBuilder_ == null) { @@ -3833,6 +4984,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public Builder setReceiverChains( int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder builderForValue) { if (receiverChainsBuilder_ == null) { @@ -3844,6 +4998,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public Builder addReceiverChains(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain value) { if (receiverChainsBuilder_ == null) { if (value == null) { @@ -3857,6 +5014,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public Builder addReceiverChains( int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain value) { if (receiverChainsBuilder_ == null) { @@ -3871,6 +5031,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public Builder addReceiverChains( org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder builderForValue) { if (receiverChainsBuilder_ == null) { @@ -3882,6 +5045,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public Builder addReceiverChains( int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder builderForValue) { if (receiverChainsBuilder_ == null) { @@ -3893,6 +5059,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public Builder addAllReceiverChains( java.lang.Iterable values) { if (receiverChainsBuilder_ == null) { @@ -3904,6 +5073,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public Builder clearReceiverChains() { if (receiverChainsBuilder_ == null) { receiverChains_ = java.util.Collections.emptyList(); @@ -3914,6 +5086,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public Builder removeReceiverChains(int index) { if (receiverChainsBuilder_ == null) { ensureReceiverChainsIsMutable(); @@ -3924,10 +5099,16 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder getReceiverChainsBuilder( int index) { return getReceiverChainsFieldBuilder().getBuilder(index); } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.ChainOrBuilder getReceiverChainsOrBuilder( int index) { if (receiverChainsBuilder_ == null) { @@ -3935,6 +5116,9 @@ public final class StorageProtos { return receiverChainsBuilder_.getMessageOrBuilder(index); } } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public java.util.List getReceiverChainsOrBuilderList() { if (receiverChainsBuilder_ != null) { @@ -3943,15 +5127,24 @@ public final class StorageProtos { return java.util.Collections.unmodifiableList(receiverChains_); } } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder addReceiverChainsBuilder() { return getReceiverChainsFieldBuilder().addBuilder( org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance()); } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder addReceiverChainsBuilder( int index) { return getReceiverChainsFieldBuilder().addBuilder( index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.getDefaultInstance()); } + /** + * repeated .textsecure.SessionStructure.Chain receiverChains = 7; + */ public java.util.List getReceiverChainsBuilderList() { return getReceiverChainsFieldBuilder().getBuilderList(); @@ -3970,14 +5163,20 @@ public final class StorageProtos { } return receiverChainsBuilder_; } - + // optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange pendingKeyExchange_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder> pendingKeyExchangeBuilder_; + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ public boolean hasPendingKeyExchange() { return ((bitField0_ & 0x00000080) == 0x00000080); } + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange getPendingKeyExchange() { if (pendingKeyExchangeBuilder_ == null) { return pendingKeyExchange_; @@ -3985,6 +5184,9 @@ public final class StorageProtos { return pendingKeyExchangeBuilder_.getMessage(); } } + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ public Builder setPendingKeyExchange(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange value) { if (pendingKeyExchangeBuilder_ == null) { if (value == null) { @@ -3998,6 +5200,9 @@ public final class StorageProtos { bitField0_ |= 0x00000080; return this; } + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ public Builder setPendingKeyExchange( org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder builderForValue) { if (pendingKeyExchangeBuilder_ == null) { @@ -4009,6 +5214,9 @@ public final class StorageProtos { bitField0_ |= 0x00000080; return this; } + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ public Builder mergePendingKeyExchange(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange value) { if (pendingKeyExchangeBuilder_ == null) { if (((bitField0_ & 0x00000080) == 0x00000080) && @@ -4025,6 +5233,9 @@ public final class StorageProtos { bitField0_ |= 0x00000080; return this; } + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ public Builder clearPendingKeyExchange() { if (pendingKeyExchangeBuilder_ == null) { pendingKeyExchange_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.getDefaultInstance(); @@ -4035,11 +5246,17 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000080); return this; } + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder getPendingKeyExchangeBuilder() { bitField0_ |= 0x00000080; onChanged(); return getPendingKeyExchangeFieldBuilder().getBuilder(); } + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder getPendingKeyExchangeOrBuilder() { if (pendingKeyExchangeBuilder_ != null) { return pendingKeyExchangeBuilder_.getMessageOrBuilder(); @@ -4047,6 +5264,9 @@ public final class StorageProtos { return pendingKeyExchange_; } } + /** + * optional .textsecure.SessionStructure.PendingKeyExchange pendingKeyExchange = 8; + */ private com.google.protobuf.SingleFieldBuilder< org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchangeOrBuilder> getPendingKeyExchangeFieldBuilder() { @@ -4060,14 +5280,20 @@ public final class StorageProtos { } return pendingKeyExchangeBuilder_; } - + // optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey pendingPreKey_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder> pendingPreKeyBuilder_; + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ public boolean hasPendingPreKey() { return ((bitField0_ & 0x00000100) == 0x00000100); } + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey getPendingPreKey() { if (pendingPreKeyBuilder_ == null) { return pendingPreKey_; @@ -4075,6 +5301,9 @@ public final class StorageProtos { return pendingPreKeyBuilder_.getMessage(); } } + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ public Builder setPendingPreKey(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey value) { if (pendingPreKeyBuilder_ == null) { if (value == null) { @@ -4088,6 +5317,9 @@ public final class StorageProtos { bitField0_ |= 0x00000100; return this; } + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ public Builder setPendingPreKey( org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder builderForValue) { if (pendingPreKeyBuilder_ == null) { @@ -4099,6 +5331,9 @@ public final class StorageProtos { bitField0_ |= 0x00000100; return this; } + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ public Builder mergePendingPreKey(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey value) { if (pendingPreKeyBuilder_ == null) { if (((bitField0_ & 0x00000100) == 0x00000100) && @@ -4115,6 +5350,9 @@ public final class StorageProtos { bitField0_ |= 0x00000100; return this; } + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ public Builder clearPendingPreKey() { if (pendingPreKeyBuilder_ == null) { pendingPreKey_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.getDefaultInstance(); @@ -4125,11 +5363,17 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000100); return this; } + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder getPendingPreKeyBuilder() { bitField0_ |= 0x00000100; onChanged(); return getPendingPreKeyFieldBuilder().getBuilder(); } + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder getPendingPreKeyOrBuilder() { if (pendingPreKeyBuilder_ != null) { return pendingPreKeyBuilder_.getMessageOrBuilder(); @@ -4137,6 +5381,9 @@ public final class StorageProtos { return pendingPreKey_; } } + /** + * optional .textsecure.SessionStructure.PendingPreKey pendingPreKey = 9; + */ private com.google.protobuf.SingleFieldBuilder< org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKeyOrBuilder> getPendingPreKeyFieldBuilder() { @@ -4150,162 +5397,368 @@ public final class StorageProtos { } return pendingPreKeyBuilder_; } - + // optional uint32 remoteRegistrationId = 10; private int remoteRegistrationId_ ; + /** + * optional uint32 remoteRegistrationId = 10; + */ public boolean hasRemoteRegistrationId() { return ((bitField0_ & 0x00000200) == 0x00000200); } + /** + * optional uint32 remoteRegistrationId = 10; + */ public int getRemoteRegistrationId() { return remoteRegistrationId_; } + /** + * optional uint32 remoteRegistrationId = 10; + */ public Builder setRemoteRegistrationId(int value) { bitField0_ |= 0x00000200; remoteRegistrationId_ = value; onChanged(); return this; } + /** + * optional uint32 remoteRegistrationId = 10; + */ public Builder clearRemoteRegistrationId() { bitField0_ = (bitField0_ & ~0x00000200); remoteRegistrationId_ = 0; onChanged(); return this; } - + // optional uint32 localRegistrationId = 11; private int localRegistrationId_ ; + /** + * optional uint32 localRegistrationId = 11; + */ public boolean hasLocalRegistrationId() { return ((bitField0_ & 0x00000400) == 0x00000400); } + /** + * optional uint32 localRegistrationId = 11; + */ public int getLocalRegistrationId() { return localRegistrationId_; } + /** + * optional uint32 localRegistrationId = 11; + */ public Builder setLocalRegistrationId(int value) { bitField0_ |= 0x00000400; localRegistrationId_ = value; onChanged(); return this; } + /** + * optional uint32 localRegistrationId = 11; + */ public Builder clearLocalRegistrationId() { bitField0_ = (bitField0_ & ~0x00000400); localRegistrationId_ = 0; onChanged(); return this; } - + // optional bool needsRefresh = 12; private boolean needsRefresh_ ; + /** + * optional bool needsRefresh = 12; + */ public boolean hasNeedsRefresh() { return ((bitField0_ & 0x00000800) == 0x00000800); } + /** + * optional bool needsRefresh = 12; + */ public boolean getNeedsRefresh() { return needsRefresh_; } + /** + * optional bool needsRefresh = 12; + */ public Builder setNeedsRefresh(boolean value) { bitField0_ |= 0x00000800; needsRefresh_ = value; onChanged(); return this; } + /** + * optional bool needsRefresh = 12; + */ public Builder clearNeedsRefresh() { bitField0_ = (bitField0_ & ~0x00000800); needsRefresh_ = false; onChanged(); return this; } - + + // optional bytes aliceBaseKey = 13; + private com.google.protobuf.ByteString aliceBaseKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes aliceBaseKey = 13; + */ + public boolean hasAliceBaseKey() { + return ((bitField0_ & 0x00001000) == 0x00001000); + } + /** + * optional bytes aliceBaseKey = 13; + */ + public com.google.protobuf.ByteString getAliceBaseKey() { + return aliceBaseKey_; + } + /** + * optional bytes aliceBaseKey = 13; + */ + public Builder setAliceBaseKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00001000; + aliceBaseKey_ = value; + onChanged(); + return this; + } + /** + * optional bytes aliceBaseKey = 13; + */ + public Builder clearAliceBaseKey() { + bitField0_ = (bitField0_ & ~0x00001000); + aliceBaseKey_ = getDefaultInstance().getAliceBaseKey(); + onChanged(); + return this; + } + // @@protoc_insertion_point(builder_scope:textsecure.SessionStructure) } - + static { defaultInstance = new SessionStructure(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.SessionStructure) } - + public interface RecordStructureOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional .textsecure.SessionStructure currentSession = 1; + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ boolean hasCurrentSession(); + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getCurrentSession(); + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder getCurrentSessionOrBuilder(); - + // repeated .textsecure.SessionStructure previousSessions = 2; + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ java.util.List getPreviousSessionsList(); + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getPreviousSessions(int index); + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ int getPreviousSessionsCount(); + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ java.util.List getPreviousSessionsOrBuilderList(); + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder getPreviousSessionsOrBuilder( int index); } + /** + * Protobuf type {@code textsecure.RecordStructure} + */ public static final class RecordStructure extends com.google.protobuf.GeneratedMessage implements RecordStructureOrBuilder { // Use RecordStructure.newBuilder() to construct. - private RecordStructure(Builder builder) { + private RecordStructure(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private RecordStructure(boolean noInit) {} - + private RecordStructure(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final RecordStructure defaultInstance; public static RecordStructure getDefaultInstance() { return defaultInstance; } - + public RecordStructure getDefaultInstanceForType() { return defaultInstance; } - + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private RecordStructure( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + subBuilder = currentSession_.toBuilder(); + } + currentSession_ = input.readMessage(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(currentSession_); + currentSession_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000001; + break; + } + case 18: { + if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + previousSessions_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + previousSessions_.add(input.readMessage(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PARSER, extensionRegistry)); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + previousSessions_ = java.util.Collections.unmodifiableList(previousSessions_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_RecordStructure_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_RecordStructure_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_RecordStructure_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.class, org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.Builder.class); } - + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public RecordStructure parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RecordStructure(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + private int bitField0_; // optional .textsecure.SessionStructure currentSession = 1; public static final int CURRENTSESSION_FIELD_NUMBER = 1; private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure currentSession_; + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ public boolean hasCurrentSession() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getCurrentSession() { return currentSession_; } + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ 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_; + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public java.util.List getPreviousSessionsList() { return previousSessions_; } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public java.util.List getPreviousSessionsOrBuilderList() { return previousSessions_; } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public int getPreviousSessionsCount() { return previousSessions_.size(); } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getPreviousSessions(int index) { return previousSessions_.get(index); } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder getPreviousSessionsOrBuilder( int index) { return previousSessions_.get(index); } - + private void initFields() { currentSession_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance(); previousSessions_ = java.util.Collections.emptyList(); @@ -4314,11 +5767,11 @@ public final class StorageProtos { public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); @@ -4330,12 +5783,12 @@ public final class StorageProtos { } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream @@ -4349,94 +5802,83 @@ public final class StorageProtos { memoizedSerializedSize = size; return size; } - + private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } - + public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } 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(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } 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(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } 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(); + return PARSER.parseFrom(input, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** + * Protobuf type {@code textsecure.RecordStructure} + */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements org.whispersystems.libaxolotl.state.StorageProtos.RecordStructureOrBuilder { @@ -4444,18 +5886,21 @@ public final class StorageProtos { getDescriptor() { return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_RecordStructure_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_RecordStructure_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_RecordStructure_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.class, org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.Builder.class); } - + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.newBuilder() private Builder() { maybeForceBuilderInitialization(); } - - private Builder(BuilderParent parent) { + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } @@ -4468,7 +5913,7 @@ public final class StorageProtos { private static Builder create() { return new Builder(); } - + public Builder clear() { super.clear(); if (currentSessionBuilder_ == null) { @@ -4485,20 +5930,20 @@ public final class StorageProtos { } return this; } - + public Builder clone() { return create().mergeFrom(buildPartial()); } - + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_RecordStructure_descriptor; } - + public org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure getDefaultInstanceForType() { return org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.getDefaultInstance(); } - + public org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure build() { org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure result = buildPartial(); if (!result.isInitialized()) { @@ -4506,17 +5951,7 @@ public final class StorageProtos { } return result; } - - private org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - + 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_; @@ -4542,7 +5977,7 @@ public final class StorageProtos { onBuilt(); return result; } - + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure) { return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure)other); @@ -4551,7 +5986,7 @@ public final class StorageProtos { 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()) { @@ -4586,62 +6021,43 @@ public final class StorageProtos { this.mergeUnknownFields(other.getUnknownFields()); return this; } - + public final boolean isInitialized() { return true; } - + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.newBuilder(); - if (hasCurrentSession()) { - subBuilder.mergeFrom(getCurrentSession()); - } - input.readMessage(subBuilder, extensionRegistry); - setCurrentSession(subBuilder.buildPartial()); - break; - } - case 18: { - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder subBuilder = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPreviousSessions(subBuilder.buildPartial()); - break; - } + org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - private int bitField0_; - + // optional .textsecure.SessionStructure currentSession = 1; private org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure currentSession_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder> currentSessionBuilder_; + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ public boolean hasCurrentSession() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getCurrentSession() { if (currentSessionBuilder_ == null) { return currentSession_; @@ -4649,6 +6065,9 @@ public final class StorageProtos { return currentSessionBuilder_.getMessage(); } } + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ public Builder setCurrentSession(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure value) { if (currentSessionBuilder_ == null) { if (value == null) { @@ -4662,6 +6081,9 @@ public final class StorageProtos { bitField0_ |= 0x00000001; return this; } + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ public Builder setCurrentSession( org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder builderForValue) { if (currentSessionBuilder_ == null) { @@ -4673,6 +6095,9 @@ public final class StorageProtos { bitField0_ |= 0x00000001; return this; } + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ public Builder mergeCurrentSession(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure value) { if (currentSessionBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && @@ -4689,6 +6114,9 @@ public final class StorageProtos { bitField0_ |= 0x00000001; return this; } + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ public Builder clearCurrentSession() { if (currentSessionBuilder_ == null) { currentSession_ = org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance(); @@ -4699,11 +6127,17 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000001); return this; } + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder getCurrentSessionBuilder() { bitField0_ |= 0x00000001; onChanged(); return getCurrentSessionFieldBuilder().getBuilder(); } + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder getCurrentSessionOrBuilder() { if (currentSessionBuilder_ != null) { return currentSessionBuilder_.getMessageOrBuilder(); @@ -4711,6 +6145,9 @@ public final class StorageProtos { return currentSession_; } } + /** + * optional .textsecure.SessionStructure currentSession = 1; + */ private com.google.protobuf.SingleFieldBuilder< org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder> getCurrentSessionFieldBuilder() { @@ -4724,7 +6161,7 @@ public final class StorageProtos { } return currentSessionBuilder_; } - + // repeated .textsecure.SessionStructure previousSessions = 2; private java.util.List previousSessions_ = java.util.Collections.emptyList(); @@ -4734,10 +6171,13 @@ public final class StorageProtos { bitField0_ |= 0x00000002; } } - + private com.google.protobuf.RepeatedFieldBuilder< org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder> previousSessionsBuilder_; - + + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public java.util.List getPreviousSessionsList() { if (previousSessionsBuilder_ == null) { return java.util.Collections.unmodifiableList(previousSessions_); @@ -4745,6 +6185,9 @@ public final class StorageProtos { return previousSessionsBuilder_.getMessageList(); } } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public int getPreviousSessionsCount() { if (previousSessionsBuilder_ == null) { return previousSessions_.size(); @@ -4752,6 +6195,9 @@ public final class StorageProtos { return previousSessionsBuilder_.getCount(); } } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure getPreviousSessions(int index) { if (previousSessionsBuilder_ == null) { return previousSessions_.get(index); @@ -4759,6 +6205,9 @@ public final class StorageProtos { return previousSessionsBuilder_.getMessage(index); } } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public Builder setPreviousSessions( int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure value) { if (previousSessionsBuilder_ == null) { @@ -4773,6 +6222,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public Builder setPreviousSessions( int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder builderForValue) { if (previousSessionsBuilder_ == null) { @@ -4784,6 +6236,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public Builder addPreviousSessions(org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure value) { if (previousSessionsBuilder_ == null) { if (value == null) { @@ -4797,6 +6252,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public Builder addPreviousSessions( int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure value) { if (previousSessionsBuilder_ == null) { @@ -4811,6 +6269,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public Builder addPreviousSessions( org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder builderForValue) { if (previousSessionsBuilder_ == null) { @@ -4822,6 +6283,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public Builder addPreviousSessions( int index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder builderForValue) { if (previousSessionsBuilder_ == null) { @@ -4833,6 +6297,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public Builder addAllPreviousSessions( java.lang.Iterable values) { if (previousSessionsBuilder_ == null) { @@ -4844,6 +6311,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public Builder clearPreviousSessions() { if (previousSessionsBuilder_ == null) { previousSessions_ = java.util.Collections.emptyList(); @@ -4854,6 +6324,9 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public Builder removePreviousSessions(int index) { if (previousSessionsBuilder_ == null) { ensurePreviousSessionsIsMutable(); @@ -4864,10 +6337,16 @@ public final class StorageProtos { } return this; } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder getPreviousSessionsBuilder( int index) { return getPreviousSessionsFieldBuilder().getBuilder(index); } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructureOrBuilder getPreviousSessionsOrBuilder( int index) { if (previousSessionsBuilder_ == null) { @@ -4875,6 +6354,9 @@ public final class StorageProtos { return previousSessionsBuilder_.getMessageOrBuilder(index); } } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public java.util.List getPreviousSessionsOrBuilderList() { if (previousSessionsBuilder_ != null) { @@ -4883,15 +6365,24 @@ public final class StorageProtos { return java.util.Collections.unmodifiableList(previousSessions_); } } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder addPreviousSessionsBuilder() { return getPreviousSessionsFieldBuilder().addBuilder( org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance()); } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder addPreviousSessionsBuilder( int index) { return getPreviousSessionsFieldBuilder().addBuilder( index, org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.getDefaultInstance()); } + /** + * repeated .textsecure.SessionStructure previousSessions = 2; + */ public java.util.List getPreviousSessionsBuilderList() { return getPreviousSessionsFieldBuilder().getBuilderList(); @@ -4910,372 +6401,99 @@ public final class StorageProtos { } return previousSessionsBuilder_; } - + // @@protoc_insertion_point(builder_scope:textsecure.RecordStructure) } - + static { defaultInstance = new RecordStructure(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.RecordStructure) } - + public interface PreKeyRecordStructureOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional uint32 id = 1; + /** + * optional uint32 id = 1; + */ boolean hasId(); + /** + * optional uint32 id = 1; + */ int getId(); - + // optional bytes publicKey = 2; + /** + * optional bytes publicKey = 2; + */ boolean hasPublicKey(); + /** + * optional bytes publicKey = 2; + */ com.google.protobuf.ByteString getPublicKey(); - + // optional bytes privateKey = 3; + /** + * optional bytes privateKey = 3; + */ boolean hasPrivateKey(); + /** + * optional bytes privateKey = 3; + */ com.google.protobuf.ByteString getPrivateKey(); } + /** + * Protobuf type {@code textsecure.PreKeyRecordStructure} + */ public static final class PreKeyRecordStructure extends com.google.protobuf.GeneratedMessage implements PreKeyRecordStructureOrBuilder { // Use PreKeyRecordStructure.newBuilder() to construct. - private PreKeyRecordStructure(Builder builder) { + private PreKeyRecordStructure(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private PreKeyRecordStructure(boolean noInit) {} - + private PreKeyRecordStructure(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final PreKeyRecordStructure defaultInstance; public static PreKeyRecordStructure getDefaultInstance() { return defaultInstance; } - + public PreKeyRecordStructure getDefaultInstanceForType() { return defaultInstance; } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_fieldAccessorTable; - } - - private int bitField0_; - // optional uint32 id = 1; - public static final int ID_FIELD_NUMBER = 1; - private int id_; - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getId() { - return id_; - } - - // optional bytes publicKey = 2; - public static final int PUBLICKEY_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString publicKey_; - public boolean hasPublicKey() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.google.protobuf.ByteString getPublicKey() { - return publicKey_; - } - - // optional bytes privateKey = 3; - public static final int PRIVATEKEY_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString privateKey_; - public boolean hasPrivateKey() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.google.protobuf.ByteString getPrivateKey() { - return privateKey_; - } - - private void initFields() { - id_ = 0; - publicKey_ = com.google.protobuf.ByteString.EMPTY; - privateKey_ = com.google.protobuf.ByteString.EMPTY; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeUInt32(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, publicKey_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, privateKey_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, publicKey_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, privateKey_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; + + private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; } - - 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.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.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - 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.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - 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.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - 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.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom( + private PreKeyRecordStructure( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructureOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_fieldAccessorTable; - } - - // Construct using org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - id_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - publicKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - privateKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.getDescriptor(); - } - - public org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure getDefaultInstanceForType() { - return org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.getDefaultInstance(); - } - - 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.libaxolotl.state.StorageProtos.PreKeyRecordStructure buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - 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)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.publicKey_ = publicKey_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.privateKey_ = privateKey_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message 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.libaxolotl.state.StorageProtos.PreKeyRecordStructure other) { - if (other == org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.getDefaultInstance()) return this; - if (other.hasId()) { - setId(other.getId()); - } - if (other.hasPublicKey()) { - setPublicKey(other.getPublicKey()); - } - if (other.hasPrivateKey()) { - setPrivateKey(other.getPrivateKey()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { int tag = input.readTag(); switch (tag) { case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; + break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; } break; } @@ -5296,39 +6514,403 @@ public final class StorageProtos { } } } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.class, org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public PreKeyRecordStructure parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PreKeyRecordStructure(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // optional uint32 id = 1; + public static final int ID_FIELD_NUMBER = 1; + private int id_; + /** + * optional uint32 id = 1; + */ + public boolean hasId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional uint32 id = 1; + */ + public int getId() { + return id_; + } + + // optional bytes publicKey = 2; + public static final int PUBLICKEY_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString publicKey_; + /** + * optional bytes publicKey = 2; + */ + public boolean hasPublicKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional bytes publicKey = 2; + */ + public com.google.protobuf.ByteString getPublicKey() { + return publicKey_; + } + + // optional bytes privateKey = 3; + public static final int PRIVATEKEY_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString privateKey_; + /** + * optional bytes privateKey = 3; + */ + public boolean hasPrivateKey() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional bytes privateKey = 3; + */ + public com.google.protobuf.ByteString getPrivateKey() { + return privateKey_; + } + + private void initFields() { + id_ = 0; + publicKey_ = com.google.protobuf.ByteString.EMPTY; + privateKey_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeUInt32(1, id_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, publicKey_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, privateKey_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, id_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, publicKey_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, privateKey_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + 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 PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code textsecure.PreKeyRecordStructure} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructureOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.class, org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.Builder.class); + } + + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + id_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + publicKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + privateKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_PreKeyRecordStructure_descriptor; + } + + public org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.getDefaultInstance(); + } + + public org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure build() { + org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + 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)) { + to_bitField0_ |= 0x00000001; + } + result.id_ = id_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.publicKey_ = publicKey_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.privateKey_ = privateKey_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message 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.libaxolotl.state.StorageProtos.PreKeyRecordStructure other) { + if (other == org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.getDefaultInstance()) return this; + if (other.hasId()) { + setId(other.getId()); + } + if (other.hasPublicKey()) { + setPublicKey(other.getPublicKey()); + } + if (other.hasPrivateKey()) { + setPrivateKey(other.getPrivateKey()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; } - private int bitField0_; - + // optional uint32 id = 1; private int id_ ; + /** + * optional uint32 id = 1; + */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional uint32 id = 1; + */ public int getId() { return id_; } + /** + * optional uint32 id = 1; + */ public Builder setId(int value) { bitField0_ |= 0x00000001; id_ = value; onChanged(); return this; } + /** + * optional uint32 id = 1; + */ public Builder clearId() { bitField0_ = (bitField0_ & ~0x00000001); id_ = 0; onChanged(); return this; } - + // optional bytes publicKey = 2; private com.google.protobuf.ByteString publicKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes publicKey = 2; + */ public boolean hasPublicKey() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional bytes publicKey = 2; + */ public com.google.protobuf.ByteString getPublicKey() { return publicKey_; } + /** + * optional bytes publicKey = 2; + */ public Builder setPublicKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -5338,21 +6920,33 @@ public final class StorageProtos { onChanged(); return this; } + /** + * optional bytes publicKey = 2; + */ public Builder clearPublicKey() { bitField0_ = (bitField0_ & ~0x00000002); publicKey_ = getDefaultInstance().getPublicKey(); onChanged(); return this; } - + // optional bytes privateKey = 3; private com.google.protobuf.ByteString privateKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes privateKey = 3; + */ public boolean hasPrivateKey() { return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional bytes privateKey = 3; + */ public com.google.protobuf.ByteString getPrivateKey() { return privateKey_; } + /** + * optional bytes privateKey = 3; + */ public Builder setPrivateKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -5362,84 +6956,912 @@ public final class StorageProtos { onChanged(); return this; } + /** + * optional bytes privateKey = 3; + */ public Builder clearPrivateKey() { bitField0_ = (bitField0_ & ~0x00000004); privateKey_ = getDefaultInstance().getPrivateKey(); onChanged(); return this; } - + // @@protoc_insertion_point(builder_scope:textsecure.PreKeyRecordStructure) } - + static { defaultInstance = new PreKeyRecordStructure(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.PreKeyRecordStructure) } - + + public interface DeviceKeyRecordStructureOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional uint32 id = 1; + /** + * optional uint32 id = 1; + */ + boolean hasId(); + /** + * optional uint32 id = 1; + */ + int getId(); + + // optional bytes publicKey = 2; + /** + * optional bytes publicKey = 2; + */ + boolean hasPublicKey(); + /** + * optional bytes publicKey = 2; + */ + com.google.protobuf.ByteString getPublicKey(); + + // optional bytes privateKey = 3; + /** + * optional bytes privateKey = 3; + */ + boolean hasPrivateKey(); + /** + * optional bytes privateKey = 3; + */ + com.google.protobuf.ByteString getPrivateKey(); + + // optional bytes signature = 4; + /** + * optional bytes signature = 4; + */ + boolean hasSignature(); + /** + * optional bytes signature = 4; + */ + com.google.protobuf.ByteString getSignature(); + + // optional fixed64 timestamp = 5; + /** + * optional fixed64 timestamp = 5; + */ + boolean hasTimestamp(); + /** + * optional fixed64 timestamp = 5; + */ + long getTimestamp(); + } + /** + * Protobuf type {@code textsecure.DeviceKeyRecordStructure} + */ + public static final class DeviceKeyRecordStructure extends + com.google.protobuf.GeneratedMessage + implements DeviceKeyRecordStructureOrBuilder { + // Use DeviceKeyRecordStructure.newBuilder() to construct. + private DeviceKeyRecordStructure(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private DeviceKeyRecordStructure(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final DeviceKeyRecordStructure defaultInstance; + public static DeviceKeyRecordStructure getDefaultInstance() { + return defaultInstance; + } + + public DeviceKeyRecordStructure getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private DeviceKeyRecordStructure( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + id_ = input.readUInt32(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + publicKey_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + privateKey_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + signature_ = input.readBytes(); + break; + } + case 41: { + bitField0_ |= 0x00000010; + timestamp_ = input.readFixed64(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_DeviceKeyRecordStructure_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_DeviceKeyRecordStructure_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure.class, org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public DeviceKeyRecordStructure parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeviceKeyRecordStructure(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // optional uint32 id = 1; + public static final int ID_FIELD_NUMBER = 1; + private int id_; + /** + * optional uint32 id = 1; + */ + public boolean hasId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional uint32 id = 1; + */ + public int getId() { + return id_; + } + + // optional bytes publicKey = 2; + public static final int PUBLICKEY_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString publicKey_; + /** + * optional bytes publicKey = 2; + */ + public boolean hasPublicKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional bytes publicKey = 2; + */ + public com.google.protobuf.ByteString getPublicKey() { + return publicKey_; + } + + // optional bytes privateKey = 3; + public static final int PRIVATEKEY_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString privateKey_; + /** + * optional bytes privateKey = 3; + */ + public boolean hasPrivateKey() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional bytes privateKey = 3; + */ + public com.google.protobuf.ByteString getPrivateKey() { + return privateKey_; + } + + // optional bytes signature = 4; + public static final int SIGNATURE_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString signature_; + /** + * optional bytes signature = 4; + */ + public boolean hasSignature() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional bytes signature = 4; + */ + public com.google.protobuf.ByteString getSignature() { + return signature_; + } + + // optional fixed64 timestamp = 5; + public static final int TIMESTAMP_FIELD_NUMBER = 5; + private long timestamp_; + /** + * optional fixed64 timestamp = 5; + */ + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional fixed64 timestamp = 5; + */ + public long getTimestamp() { + return timestamp_; + } + + private void initFields() { + id_ = 0; + publicKey_ = com.google.protobuf.ByteString.EMPTY; + privateKey_ = com.google.protobuf.ByteString.EMPTY; + signature_ = com.google.protobuf.ByteString.EMPTY; + timestamp_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeUInt32(1, id_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, publicKey_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, privateKey_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, signature_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeFixed64(5, timestamp_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, id_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, publicKey_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, privateKey_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, signature_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeFixed64Size(5, timestamp_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code textsecure.DeviceKeyRecordStructure} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructureOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_DeviceKeyRecordStructure_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_DeviceKeyRecordStructure_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure.class, org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure.Builder.class); + } + + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + id_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + publicKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + privateKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + signature_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + timestamp_ = 0L; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_DeviceKeyRecordStructure_descriptor; + } + + public org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure getDefaultInstanceForType() { + return org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure.getDefaultInstance(); + } + + public org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure build() { + org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure buildPartial() { + org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure result = new org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.id_ = id_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.publicKey_ = publicKey_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.privateKey_ = privateKey_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.signature_ = signature_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.timestamp_ = timestamp_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure) { + return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure other) { + if (other == org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure.getDefaultInstance()) return this; + if (other.hasId()) { + setId(other.getId()); + } + if (other.hasPublicKey()) { + setPublicKey(other.getPublicKey()); + } + if (other.hasPrivateKey()) { + setPrivateKey(other.getPrivateKey()); + } + if (other.hasSignature()) { + setSignature(other.getSignature()); + } + if (other.hasTimestamp()) { + setTimestamp(other.getTimestamp()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.state.StorageProtos.DeviceKeyRecordStructure) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // optional uint32 id = 1; + private int id_ ; + /** + * optional uint32 id = 1; + */ + public boolean hasId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional uint32 id = 1; + */ + public int getId() { + return id_; + } + /** + * optional uint32 id = 1; + */ + public Builder setId(int value) { + bitField0_ |= 0x00000001; + id_ = value; + onChanged(); + return this; + } + /** + * optional uint32 id = 1; + */ + public Builder clearId() { + bitField0_ = (bitField0_ & ~0x00000001); + id_ = 0; + onChanged(); + return this; + } + + // optional bytes publicKey = 2; + private com.google.protobuf.ByteString publicKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes publicKey = 2; + */ + public boolean hasPublicKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional bytes publicKey = 2; + */ + public com.google.protobuf.ByteString getPublicKey() { + return publicKey_; + } + /** + * optional bytes publicKey = 2; + */ + public Builder setPublicKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + publicKey_ = value; + onChanged(); + return this; + } + /** + * optional bytes publicKey = 2; + */ + public Builder clearPublicKey() { + bitField0_ = (bitField0_ & ~0x00000002); + publicKey_ = getDefaultInstance().getPublicKey(); + onChanged(); + return this; + } + + // optional bytes privateKey = 3; + private com.google.protobuf.ByteString privateKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes privateKey = 3; + */ + public boolean hasPrivateKey() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional bytes privateKey = 3; + */ + public com.google.protobuf.ByteString getPrivateKey() { + return privateKey_; + } + /** + * optional bytes privateKey = 3; + */ + public Builder setPrivateKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + privateKey_ = value; + onChanged(); + return this; + } + /** + * optional bytes privateKey = 3; + */ + public Builder clearPrivateKey() { + bitField0_ = (bitField0_ & ~0x00000004); + privateKey_ = getDefaultInstance().getPrivateKey(); + onChanged(); + return this; + } + + // optional bytes signature = 4; + private com.google.protobuf.ByteString signature_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes signature = 4; + */ + public boolean hasSignature() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional bytes signature = 4; + */ + public com.google.protobuf.ByteString getSignature() { + return signature_; + } + /** + * optional bytes signature = 4; + */ + public Builder setSignature(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + signature_ = value; + onChanged(); + return this; + } + /** + * optional bytes signature = 4; + */ + public Builder clearSignature() { + bitField0_ = (bitField0_ & ~0x00000008); + signature_ = getDefaultInstance().getSignature(); + onChanged(); + return this; + } + + // optional fixed64 timestamp = 5; + private long timestamp_ ; + /** + * optional fixed64 timestamp = 5; + */ + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional fixed64 timestamp = 5; + */ + public long getTimestamp() { + return timestamp_; + } + /** + * optional fixed64 timestamp = 5; + */ + public Builder setTimestamp(long value) { + bitField0_ |= 0x00000010; + timestamp_ = value; + onChanged(); + return this; + } + /** + * optional fixed64 timestamp = 5; + */ + public Builder clearTimestamp() { + bitField0_ = (bitField0_ & ~0x00000010); + timestamp_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:textsecure.DeviceKeyRecordStructure) + } + + static { + defaultInstance = new DeviceKeyRecordStructure(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:textsecure.DeviceKeyRecordStructure) + } + public interface IdentityKeyPairStructureOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional bytes publicKey = 1; + /** + * optional bytes publicKey = 1; + */ boolean hasPublicKey(); + /** + * optional bytes publicKey = 1; + */ com.google.protobuf.ByteString getPublicKey(); - + // optional bytes privateKey = 2; + /** + * optional bytes privateKey = 2; + */ boolean hasPrivateKey(); + /** + * optional bytes privateKey = 2; + */ com.google.protobuf.ByteString getPrivateKey(); } + /** + * Protobuf type {@code textsecure.IdentityKeyPairStructure} + */ public static final class IdentityKeyPairStructure extends com.google.protobuf.GeneratedMessage implements IdentityKeyPairStructureOrBuilder { // Use IdentityKeyPairStructure.newBuilder() to construct. - private IdentityKeyPairStructure(Builder builder) { + private IdentityKeyPairStructure(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private IdentityKeyPairStructure(boolean noInit) {} - + private IdentityKeyPairStructure(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final IdentityKeyPairStructure defaultInstance; public static IdentityKeyPairStructure getDefaultInstance() { return defaultInstance; } - + public IdentityKeyPairStructure getDefaultInstanceForType() { return defaultInstance; } - + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private IdentityKeyPairStructure( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + publicKey_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + privateKey_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_IdentityKeyPairStructure_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_IdentityKeyPairStructure_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_IdentityKeyPairStructure_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure.class, org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure.Builder.class); } - + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public IdentityKeyPairStructure parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new IdentityKeyPairStructure(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + private int bitField0_; // optional bytes publicKey = 1; public static final int PUBLICKEY_FIELD_NUMBER = 1; private com.google.protobuf.ByteString publicKey_; + /** + * optional bytes publicKey = 1; + */ public boolean hasPublicKey() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional bytes publicKey = 1; + */ public com.google.protobuf.ByteString getPublicKey() { return publicKey_; } - + // optional bytes privateKey = 2; public static final int PRIVATEKEY_FIELD_NUMBER = 2; private com.google.protobuf.ByteString privateKey_; + /** + * optional bytes privateKey = 2; + */ public boolean hasPrivateKey() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional bytes privateKey = 2; + */ public com.google.protobuf.ByteString getPrivateKey() { return privateKey_; } - + private void initFields() { publicKey_ = com.google.protobuf.ByteString.EMPTY; privateKey_ = com.google.protobuf.ByteString.EMPTY; @@ -5448,11 +7870,11 @@ public final class StorageProtos { public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); @@ -5464,12 +7886,12 @@ public final class StorageProtos { } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream @@ -5483,94 +7905,83 @@ public final class StorageProtos { memoizedSerializedSize = size; return size; } - + private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } - + public static org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** + * Protobuf type {@code textsecure.IdentityKeyPairStructure} + */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructureOrBuilder { @@ -5578,18 +7989,21 @@ public final class StorageProtos { getDescriptor() { return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_IdentityKeyPairStructure_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_IdentityKeyPairStructure_fieldAccessorTable; + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_IdentityKeyPairStructure_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure.class, org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure.Builder.class); } - + // Construct using org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure.newBuilder() private Builder() { maybeForceBuilderInitialization(); } - - private Builder(BuilderParent parent) { + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } @@ -5600,7 +8014,7 @@ public final class StorageProtos { private static Builder create() { return new Builder(); } - + public Builder clear() { super.clear(); publicKey_ = com.google.protobuf.ByteString.EMPTY; @@ -5609,20 +8023,20 @@ public final class StorageProtos { bitField0_ = (bitField0_ & ~0x00000002); return this; } - + public Builder clone() { return create().mergeFrom(buildPartial()); } - + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure.getDescriptor(); + return org.whispersystems.libaxolotl.state.StorageProtos.internal_static_textsecure_IdentityKeyPairStructure_descriptor; } - + public org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure getDefaultInstanceForType() { return org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure.getDefaultInstance(); } - + public org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure build() { org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure result = buildPartial(); if (!result.isInitialized()) { @@ -5630,17 +8044,7 @@ public final class StorageProtos { } return result; } - - private org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - + public org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure buildPartial() { org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure result = new org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure(this); int from_bitField0_ = bitField0_; @@ -5657,7 +8061,7 @@ public final class StorageProtos { onBuilt(); return result; } - + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure) { return mergeFrom((org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure)other); @@ -5666,7 +8070,7 @@ public final class StorageProtos { return this; } } - + public Builder mergeFrom(org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure other) { if (other == org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure.getDefaultInstance()) return this; if (other.hasPublicKey()) { @@ -5678,58 +8082,47 @@ public final class StorageProtos { this.mergeUnknownFields(other.getUnknownFields()); return this; } - + public final boolean isInitialized() { return true; } - + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - publicKey_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - privateKey_ = input.readBytes(); - break; - } + org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - private int bitField0_; - + // optional bytes publicKey = 1; private com.google.protobuf.ByteString publicKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes publicKey = 1; + */ public boolean hasPublicKey() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional bytes publicKey = 1; + */ public com.google.protobuf.ByteString getPublicKey() { return publicKey_; } + /** + * optional bytes publicKey = 1; + */ public Builder setPublicKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -5739,21 +8132,33 @@ public final class StorageProtos { onChanged(); return this; } + /** + * optional bytes publicKey = 1; + */ public Builder clearPublicKey() { bitField0_ = (bitField0_ & ~0x00000001); publicKey_ = getDefaultInstance().getPublicKey(); onChanged(); return this; } - + // optional bytes privateKey = 2; private com.google.protobuf.ByteString privateKey_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes privateKey = 2; + */ public boolean hasPrivateKey() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional bytes privateKey = 2; + */ public com.google.protobuf.ByteString getPrivateKey() { return privateKey_; } + /** + * optional bytes privateKey = 2; + */ public Builder setPrivateKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -5763,24 +8168,27 @@ public final class StorageProtos { onChanged(); return this; } + /** + * optional bytes privateKey = 2; + */ public Builder clearPrivateKey() { bitField0_ = (bitField0_ & ~0x00000002); privateKey_ = getDefaultInstance().getPrivateKey(); onChanged(); return this; } - + // @@protoc_insertion_point(builder_scope:textsecure.IdentityKeyPairStructure) } - + static { defaultInstance = new IdentityKeyPairStructure(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.IdentityKeyPairStructure) } - + private static com.google.protobuf.Descriptors.Descriptor internal_static_textsecure_SessionStructure_descriptor; private static @@ -5821,12 +8229,17 @@ public final class StorageProtos { private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_textsecure_PreKeyRecordStructure_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_textsecure_DeviceKeyRecordStructure_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_textsecure_DeviceKeyRecordStructure_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_textsecure_IdentityKeyPairStructure_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_textsecure_IdentityKeyPairStructure_fieldAccessorTable; - + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -5836,7 +8249,7 @@ public final class StorageProtos { static { java.lang.String[] descriptorData = { "\n\032LocalStorageProtocol.proto\022\ntextsecure" + - "\"\233\010\n\020SessionStructure\022\026\n\016sessionVersion\030" + + "\"\306\010\n\020SessionStructure\022\026\n\016sessionVersion\030" + "\001 \001(\r\022\033\n\023localIdentityPublic\030\002 \001(\014\022\034\n\024re" + "moteIdentityPublic\030\003 \001(\014\022\017\n\007rootKey\030\004 \001(" + "\014\022\027\n\017previousCounter\030\005 \001(\r\0227\n\013senderChai" + @@ -5848,26 +8261,30 @@ public final class StorageProtos { "\001(\0132*.textsecure.SessionStructure.Pendin" + "gPreKey\022\034\n\024remoteRegistrationId\030\n \001(\r\022\033\n" + "\023localRegistrationId\030\013 \001(\r\022\024\n\014needsRefre" + - "sh\030\014 \001(\010\032\253\002\n\005Chain\022\027\n\017senderEphemeral\030\001 " + - "\001(\014\022\036\n\026senderEphemeralPrivate\030\002 \001(\014\022=\n\010c" + - "hainKey\030\003 \001(\0132+.textsecure.SessionStruct" + - "ure.Chain.ChainKey\022B\n\013messageKeys\030\004 \003(\0132" + - "-.textsecure.SessionStructure.Chain.Mess" + - "ageKey\032&\n\010ChainKey\022\r\n\005index\030\001 \001(\r\022\013\n\003key" + - "\030\002 \001(\014\032>\n\nMessageKey\022\r\n\005index\030\001 \001(\r\022\021\n\tc", - "ipherKey\030\002 \001(\014\022\016\n\006macKey\030\003 \001(\014\032\321\001\n\022Pendi" + - "ngKeyExchange\022\020\n\010sequence\030\001 \001(\r\022\024\n\014local" + - "BaseKey\030\002 \001(\014\022\033\n\023localBaseKeyPrivate\030\003 \001" + - "(\014\022\031\n\021localEphemeralKey\030\004 \001(\014\022 \n\030localEp" + - "hemeralKeyPrivate\030\005 \001(\014\022\030\n\020localIdentity" + - "Key\030\007 \001(\014\022\037\n\027localIdentityKeyPrivate\030\010 \001" + - "(\014\0322\n\rPendingPreKey\022\020\n\010preKeyId\030\001 \001(\r\022\017\n" + - "\007baseKey\030\002 \001(\014\"\177\n\017RecordStructure\0224\n\016cur" + - "rentSession\030\001 \001(\0132\034.textsecure.SessionSt" + - "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(\014\"A\n\030IdentityKeyPairSt" + + "sh\030\014 \001(\010\022\024\n\014aliceBaseKey\030\r \001(\014\032\253\002\n\005Chain" + + "\022\027\n\017senderEphemeral\030\001 \001(\014\022\036\n\026senderEphem" + + "eralPrivate\030\002 \001(\014\022=\n\010chainKey\030\003 \001(\0132+.te" + + "xtsecure.SessionStructure.Chain.ChainKey" + + "\022B\n\013messageKeys\030\004 \003(\0132-.textsecure.Sessi" + + "onStructure.Chain.MessageKey\032&\n\010ChainKey" + + "\022\r\n\005index\030\001 \001(\r\022\013\n\003key\030\002 \001(\014\032>\n\nMessageK", + "ey\022\r\n\005index\030\001 \001(\r\022\021\n\tcipherKey\030\002 \001(\014\022\016\n\006" + + "macKey\030\003 \001(\014\032\321\001\n\022PendingKeyExchange\022\020\n\010s" + + "equence\030\001 \001(\r\022\024\n\014localBaseKey\030\002 \001(\014\022\033\n\023l" + + "ocalBaseKeyPrivate\030\003 \001(\014\022\031\n\021localEphemer" + + "alKey\030\004 \001(\014\022 \n\030localEphemeralKeyPrivate\030" + + "\005 \001(\014\022\030\n\020localIdentityKey\030\007 \001(\014\022\037\n\027local" + + "IdentityKeyPrivate\030\010 \001(\014\032G\n\rPendingPreKe" + + "y\022\020\n\010preKeyId\030\001 \001(\r\022\023\n\013deviceKeyId\030\003 \001(\r" + + "\022\017\n\007baseKey\030\002 \001(\014\"\177\n\017RecordStructure\0224\n\016" + + "currentSession\030\001 \001(\0132\034.textsecure.Sessio", + "nStructure\0226\n\020previousSessions\030\002 \003(\0132\034.t" + + "extsecure.SessionStructure\"J\n\025PreKeyReco" + + "rdStructure\022\n\n\002id\030\001 \001(\r\022\021\n\tpublicKey\030\002 \001" + + "(\014\022\022\n\nprivateKey\030\003 \001(\014\"s\n\030DeviceKeyRecor" + + "dStructure\022\n\n\002id\030\001 \001(\r\022\021\n\tpublicKey\030\002 \001(" + + "\014\022\022\n\nprivateKey\030\003 \001(\014\022\021\n\tsignature\030\004 \001(\014" + + "\022\021\n\ttimestamp\030\005 \001(\006\"A\n\030IdentityKeyPairSt" + "ructure\022\021\n\tpublicKey\030\001 \001(\014\022\022\n\nprivateKey" + "\030\002 \001(\014B4\n#org.whispersystems.libaxolotl." + "stateB\rStorageProtos" @@ -5882,73 +8299,61 @@ public final class StorageProtos { internal_static_textsecure_SessionStructure_fieldAccessorTable = new 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.libaxolotl.state.StorageProtos.SessionStructure.class, - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Builder.class); + new java.lang.String[] { "SessionVersion", "LocalIdentityPublic", "RemoteIdentityPublic", "RootKey", "PreviousCounter", "SenderChain", "ReceiverChains", "PendingKeyExchange", "PendingPreKey", "RemoteRegistrationId", "LocalRegistrationId", "NeedsRefresh", "AliceBaseKey", }); 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.libaxolotl.state.StorageProtos.SessionStructure.Chain.class, - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.Builder.class); + new java.lang.String[] { "SenderEphemeral", "SenderEphemeralPrivate", "ChainKey", "MessageKeys", }); 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.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.class, - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.ChainKey.Builder.class); + new java.lang.String[] { "Index", "Key", }); 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.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.class, - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.Chain.MessageKey.Builder.class); + new java.lang.String[] { "Index", "CipherKey", "MacKey", }); 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.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.class, - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingKeyExchange.Builder.class); + new java.lang.String[] { "Sequence", "LocalBaseKey", "LocalBaseKeyPrivate", "LocalEphemeralKey", "LocalEphemeralKeyPrivate", "LocalIdentityKey", "LocalIdentityKeyPrivate", }); 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.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.class, - org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure.PendingPreKey.Builder.class); + new java.lang.String[] { "PreKeyId", "DeviceKeyId", "BaseKey", }); 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.libaxolotl.state.StorageProtos.RecordStructure.class, - org.whispersystems.libaxolotl.state.StorageProtos.RecordStructure.Builder.class); + new java.lang.String[] { "CurrentSession", "PreviousSessions", }); 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.libaxolotl.state.StorageProtos.PreKeyRecordStructure.class, - org.whispersystems.libaxolotl.state.StorageProtos.PreKeyRecordStructure.Builder.class); - internal_static_textsecure_IdentityKeyPairStructure_descriptor = + new java.lang.String[] { "Id", "PublicKey", "PrivateKey", }); + internal_static_textsecure_DeviceKeyRecordStructure_descriptor = getDescriptor().getMessageTypes().get(3); + internal_static_textsecure_DeviceKeyRecordStructure_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_textsecure_DeviceKeyRecordStructure_descriptor, + new java.lang.String[] { "Id", "PublicKey", "PrivateKey", "Signature", "Timestamp", }); + internal_static_textsecure_IdentityKeyPairStructure_descriptor = + getDescriptor().getMessageTypes().get(4); internal_static_textsecure_IdentityKeyPairStructure_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_IdentityKeyPairStructure_descriptor, - new java.lang.String[] { "PublicKey", "PrivateKey", }, - org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure.class, - org.whispersystems.libaxolotl.state.StorageProtos.IdentityKeyPairStructure.Builder.class); + new java.lang.String[] { "PublicKey", "PrivateKey", }); return null; } }; @@ -5957,6 +8362,6 @@ public final class StorageProtos { new com.google.protobuf.Descriptors.FileDescriptor[] { }, assigner); } - + // @@protoc_insertion_point(outer_class_scope) } diff --git a/library/src/org/whispersystems/textsecure/crypto/PreKeyUtil.java b/library/src/org/whispersystems/textsecure/crypto/PreKeyUtil.java index 81137bc88..5510d6f27 100644 --- a/library/src/org/whispersystems/textsecure/crypto/PreKeyUtil.java +++ b/library/src/org/whispersystems/textsecure/crypto/PreKeyUtil.java @@ -22,9 +22,14 @@ import android.util.Log; import com.google.thoughtcrimegson.Gson; +import org.whispersystems.libaxolotl.IdentityKeyPair; +import org.whispersystems.libaxolotl.InvalidKeyException; +import org.whispersystems.libaxolotl.InvalidKeyIdException; +import org.whispersystems.libaxolotl.ecc.Curve; import org.whispersystems.libaxolotl.ecc.Curve25519; import org.whispersystems.libaxolotl.ecc.ECKeyPair; -import org.whispersystems.libaxolotl.InvalidKeyIdException; +import org.whispersystems.libaxolotl.state.DeviceKeyRecord; +import org.whispersystems.libaxolotl.state.DeviceKeyStore; import org.whispersystems.libaxolotl.state.PreKeyRecord; import org.whispersystems.libaxolotl.state.PreKeyStore; import org.whispersystems.libaxolotl.util.Medium; @@ -36,7 +41,6 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; -import java.util.Comparator; import java.util.LinkedList; import java.util.List; @@ -54,7 +58,7 @@ public class PreKeyUtil { ECKeyPair keyPair = Curve25519.generateKeyPair(true); PreKeyRecord record = new PreKeyRecord(preKeyId, keyPair); - preKeyStore.store(preKeyId, record); + preKeyStore.storePreKey(preKeyId, record); records.add(record); } @@ -62,59 +66,45 @@ public class PreKeyUtil { return records; } + public static DeviceKeyRecord generateDeviceKey(Context context, MasterSecret masterSecret, + IdentityKeyPair identityKeyPair) + { + try { + DeviceKeyStore deviceKeyStore = new TextSecurePreKeyStore(context, masterSecret); + int deviceKeyId = getNextDeviceKeyId(context); + ECKeyPair keyPair = Curve25519.generateKeyPair(true); + byte[] signature = Curve.calculateSignature(identityKeyPair.getPrivateKey(), keyPair.getPublicKey().serialize()); + DeviceKeyRecord record = new DeviceKeyRecord(deviceKeyId, System.currentTimeMillis(), keyPair, signature); + + deviceKeyStore.storeDeviceKey(deviceKeyId, record); + setNextDeviceKeyId(context, (deviceKeyId + 1) % Medium.MAX_VALUE); + + return record; + } catch (InvalidKeyException e) { + throw new AssertionError(e); + } + } + public static PreKeyRecord generateLastResortKey(Context context, MasterSecret masterSecret) { PreKeyStore preKeyStore = new TextSecurePreKeyStore(context, masterSecret); - if (preKeyStore.contains(Medium.MAX_VALUE)) { + if (preKeyStore.containsPreKey(Medium.MAX_VALUE)) { try { - return preKeyStore.load(Medium.MAX_VALUE); + return preKeyStore.loadPreKey(Medium.MAX_VALUE); } catch (InvalidKeyIdException e) { Log.w("PreKeyUtil", e); - preKeyStore.remove(Medium.MAX_VALUE); + preKeyStore.removePreKey(Medium.MAX_VALUE); } } ECKeyPair keyPair = Curve25519.generateKeyPair(true); PreKeyRecord record = new PreKeyRecord(Medium.MAX_VALUE, keyPair); - preKeyStore.store(Medium.MAX_VALUE, record); + preKeyStore.storePreKey(Medium.MAX_VALUE, record); return record; } -// public static List getPreKeys(Context context, MasterSecret masterSecret) { -// List records = new LinkedList(); -// File directory = getPreKeysDirectory(context); -// String[] keyRecordIds = directory.list(); -// -// Arrays.sort(keyRecordIds, new PreKeyRecordIdComparator()); -// -// for (String keyRecordId : keyRecordIds) { -// try { -// if (!keyRecordId.equals(PreKeyIndex.FILE_NAME) && Integer.parseInt(keyRecordId) != Medium.MAX_VALUE) { -// records.add(new PreKeyRecord(context, masterSecret, Integer.parseInt(keyRecordId))); -// } -// } catch (InvalidKeyIdException e) { -// Log.w("PreKeyUtil", e); -// new File(getPreKeysDirectory(context), keyRecordId).delete(); -// } catch (NumberFormatException nfe) { -// Log.w("PreKeyUtil", nfe); -// new File(getPreKeysDirectory(context), keyRecordId).delete(); -// } -// } -// -// return records; -// } -// -// public static void clearPreKeys(Context context) { -// File directory = getPreKeysDirectory(context); -// String[] keyRecords = directory.list(); -// -// for (String keyRecord : keyRecords) { -// new File(directory, keyRecord).delete(); -// } -// } - private static void setNextPreKeyId(Context context, int id) { try { File nextFile = new File(getPreKeysDirectory(context), PreKeyIndex.FILE_NAME); @@ -126,6 +116,17 @@ public class PreKeyUtil { } } + private static void setNextDeviceKeyId(Context context, int id) { + try { + File nextFile = new File(getDeviceKeysDirectory(context), DeviceKeyIndex.FILE_NAME); + FileOutputStream fout = new FileOutputStream(nextFile); + fout.write(new Gson().toJson(new DeviceKeyIndex(id)).getBytes()); + fout.close(); + } catch (IOException e) { + Log.w("PreKeyUtil", e); + } + } + private static int getNextPreKeyId(Context context) { try { File nextFile = new File(getPreKeysDirectory(context), PreKeyIndex.FILE_NAME); @@ -144,8 +145,34 @@ public class PreKeyUtil { } } + private static int getNextDeviceKeyId(Context context) { + try { + File nextFile = new File(getDeviceKeysDirectory(context), DeviceKeyIndex.FILE_NAME); + + if (!nextFile.exists()) { + return Util.getSecureRandom().nextInt(Medium.MAX_VALUE); + } else { + InputStreamReader reader = new InputStreamReader(new FileInputStream(nextFile)); + DeviceKeyIndex index = new Gson().fromJson(reader, DeviceKeyIndex.class); + reader.close(); + return index.nextDeviceKeyId; + } + } catch (IOException e) { + Log.w("PreKeyUtil", e); + return Util.getSecureRandom().nextInt(Medium.MAX_VALUE); + } + } + private static File getPreKeysDirectory(Context context) { - File directory = new File(context.getFilesDir(), TextSecurePreKeyStore.PREKEY_DIRECTORY); + return getKeysDirectory(context, TextSecurePreKeyStore.PREKEY_DIRECTORY); + } + + private static File getDeviceKeysDirectory(Context context) { + return getKeysDirectory(context, TextSecurePreKeyStore.DEVICE_KEY_DIRECTORY); + } + + private static File getKeysDirectory(Context context, String name) { + File directory = new File(context.getFilesDir(), name); if (!directory.exists()) directory.mkdirs(); @@ -153,25 +180,6 @@ public class PreKeyUtil { return directory; } - private static class PreKeyRecordIdComparator implements Comparator { - @Override - public int compare(String lhs, String rhs) { - if (lhs.equals(PreKeyIndex.FILE_NAME)) return -1; - else if (rhs.equals(PreKeyIndex.FILE_NAME)) return 1; - - try { - long lhsLong = Long.parseLong(lhs); - long rhsLong = Long.parseLong(rhs); - - if (lhsLong < rhsLong) return -1; - else if (lhsLong > rhsLong) return 1; - else return 0; - } catch (NumberFormatException e) { - return 0; - } - } - } - private static class PreKeyIndex { public static final String FILE_NAME = "index.dat"; @@ -184,4 +192,17 @@ public class PreKeyUtil { } } + private static class DeviceKeyIndex { + public static final String FILE_NAME = "index.dat"; + + private int nextDeviceKeyId; + + public DeviceKeyIndex() {} + + public DeviceKeyIndex(int nextDeviceKeyId) { + this.nextDeviceKeyId = nextDeviceKeyId; + } + } + + } diff --git a/library/src/org/whispersystems/textsecure/crypto/SessionCipherFactory.java b/library/src/org/whispersystems/textsecure/crypto/SessionCipherFactory.java index 787c90826..c97398a2f 100644 --- a/library/src/org/whispersystems/textsecure/crypto/SessionCipherFactory.java +++ b/library/src/org/whispersystems/textsecure/crypto/SessionCipherFactory.java @@ -32,7 +32,7 @@ public class SessionCipherFactory { { SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret); - if (sessionStore.contains(recipient.getRecipientId(), recipient.getDeviceId())) { + if (sessionStore.containsSession(recipient.getRecipientId(), recipient.getDeviceId())) { return new SessionCipher(sessionStore, recipient.getRecipientId(), recipient.getDeviceId()); } else { throw new AssertionError("Attempt to initialize cipher for non-existing session."); diff --git a/library/src/org/whispersystems/textsecure/push/DeviceKeyEntity.java b/library/src/org/whispersystems/textsecure/push/DeviceKeyEntity.java new file mode 100644 index 000000000..d9a57a39d --- /dev/null +++ b/library/src/org/whispersystems/textsecure/push/DeviceKeyEntity.java @@ -0,0 +1,61 @@ +package org.whispersystems.textsecure.push; + +import com.google.thoughtcrimegson.GsonBuilder; +import com.google.thoughtcrimegson.JsonDeserializationContext; +import com.google.thoughtcrimegson.JsonDeserializer; +import com.google.thoughtcrimegson.JsonElement; +import com.google.thoughtcrimegson.JsonParseException; +import com.google.thoughtcrimegson.JsonPrimitive; +import com.google.thoughtcrimegson.JsonSerializationContext; +import com.google.thoughtcrimegson.JsonSerializer; + +import org.whispersystems.libaxolotl.ecc.ECPublicKey; +import org.whispersystems.textsecure.util.Base64; + +import java.io.IOException; +import java.lang.reflect.Type; + +public class DeviceKeyEntity extends PreKeyEntity { + + private byte[] signature; + + public DeviceKeyEntity() {} + + public DeviceKeyEntity(int keyId, ECPublicKey publicKey, byte[] signature) { + super(keyId, publicKey); + this.signature = signature; + } + + public byte[] getSignature() { + return signature; + } + + public static GsonBuilder forBuilder(GsonBuilder builder) { + return PreKeyEntity.forBuilder(builder) + .registerTypeAdapter(byte[].class, new ByteArrayJsonAdapter()); + + } + + private static class ByteArrayJsonAdapter + implements JsonSerializer, JsonDeserializer + { + @Override + public JsonElement serialize(byte[] signature, Type type, + JsonSerializationContext jsonSerializationContext) + { + return new JsonPrimitive(Base64.encodeBytesWithoutPadding(signature)); + } + + @Override + public byte[] deserialize(JsonElement jsonElement, Type type, + JsonDeserializationContext jsonDeserializationContext) + throws JsonParseException + { + try { + return Base64.decodeWithoutPadding(jsonElement.getAsJsonPrimitive().getAsString()); + } catch (IOException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/library/src/org/whispersystems/textsecure/push/PreKeyEntity.java b/library/src/org/whispersystems/textsecure/push/PreKeyEntity.java index 5bde273a8..e922f2342 100644 --- a/library/src/org/whispersystems/textsecure/push/PreKeyEntity.java +++ b/library/src/org/whispersystems/textsecure/push/PreKeyEntity.java @@ -8,38 +8,26 @@ import com.google.thoughtcrimegson.JsonParseException; import com.google.thoughtcrimegson.JsonPrimitive; import com.google.thoughtcrimegson.JsonSerializationContext; import com.google.thoughtcrimegson.JsonSerializer; -import com.google.thoughtcrimegson.annotations.Expose; import org.whispersystems.libaxolotl.IdentityKey; import org.whispersystems.libaxolotl.InvalidKeyException; import org.whispersystems.libaxolotl.ecc.Curve; import org.whispersystems.libaxolotl.ecc.ECPublicKey; -import org.whispersystems.libaxolotl.state.PreKey; import org.whispersystems.textsecure.util.Base64; import java.io.IOException; import java.lang.reflect.Type; -public class PreKeyEntity implements PreKey { - - @Expose(serialize = false) - private int deviceId; - - @Expose(serialize = false) - private int registrationId; +public class PreKeyEntity { private int keyId; private ECPublicKey publicKey; - private IdentityKey identityKey; - public PreKeyEntity(int keyId, ECPublicKey publicKey, IdentityKey identityKey) { - this.keyId = keyId; - this.publicKey = publicKey; - this.identityKey = identityKey; - } + public PreKeyEntity() {} - public int getDeviceId() { - return deviceId; + public PreKeyEntity(int keyId, ECPublicKey publicKey) { + this.keyId = keyId; + this.publicKey = publicKey; } public int getKeyId() { @@ -50,28 +38,8 @@ public class PreKeyEntity implements PreKey { return publicKey; } - public IdentityKey getIdentityKey() { - return identityKey; - } - - public int getRegistrationId() { - return registrationId; - } - - public static String toJson(PreKeyEntity entity) { - return getBuilder().create().toJson(entity); - } - - public static PreKeyEntity fromJson(String encoded) { - return getBuilder().create().fromJson(encoded, PreKeyEntity.class); - } - - public static GsonBuilder getBuilder() { - GsonBuilder builder = new GsonBuilder(); - builder.registerTypeAdapter(ECPublicKey.class, new ECPublicKeyJsonAdapter()); - builder.registerTypeAdapter(IdentityKey.class, new IdentityKeyJsonAdapter()); - - return builder; + public static GsonBuilder forBuilder(GsonBuilder builder) { + return builder.registerTypeAdapter(ECPublicKey.class, new ECPublicKeyJsonAdapter()); } @@ -92,34 +60,7 @@ public class PreKeyEntity implements PreKey { { try { return Curve.decodePoint(Base64.decodeWithoutPadding(jsonElement.getAsJsonPrimitive().getAsString()), 0); - } catch (InvalidKeyException e) { - throw new JsonParseException(e); - } catch (IOException e) { - throw new JsonParseException(e); - } - } - } - - private static class IdentityKeyJsonAdapter - implements JsonSerializer, JsonDeserializer - { - @Override - public JsonElement serialize(IdentityKey identityKey, Type type, - JsonSerializationContext jsonSerializationContext) - { - return new JsonPrimitive(Base64.encodeBytesWithoutPadding(identityKey.serialize())); - } - - @Override - public IdentityKey deserialize(JsonElement jsonElement, Type type, - JsonDeserializationContext jsonDeserializationContext) - throws JsonParseException - { - try { - return new IdentityKey(Base64.decodeWithoutPadding(jsonElement.getAsJsonPrimitive().getAsString()), 0); - } catch (InvalidKeyException e) { - throw new JsonParseException(e); - } catch (IOException e) { + } catch (InvalidKeyException | IOException e) { throw new JsonParseException(e); } } diff --git a/library/src/org/whispersystems/textsecure/push/PreKeyList.java b/library/src/org/whispersystems/textsecure/push/PreKeyList.java deleted file mode 100644 index 6571fc411..000000000 --- a/library/src/org/whispersystems/textsecure/push/PreKeyList.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.whispersystems.textsecure.push; - -import java.util.List; - -public class PreKeyList { - - private PreKeyEntity lastResortKey; - private List keys; - - public PreKeyList(PreKeyEntity lastResortKey, List keys) { - this.keys = keys; - this.lastResortKey = lastResortKey; - } - - public List getKeys() { - return keys; - } - - public static String toJson(PreKeyList entity) { - return PreKeyEntity.getBuilder().create().toJson(entity); - } - - public static PreKeyList fromJson(String serialized) { - return PreKeyEntity.getBuilder().create().fromJson(serialized, PreKeyList.class); - } - - public PreKeyEntity getLastResortKey() { - return lastResortKey; - } -} diff --git a/library/src/org/whispersystems/textsecure/push/PreKeyResponse.java b/library/src/org/whispersystems/textsecure/push/PreKeyResponse.java new file mode 100644 index 000000000..bb0e81156 --- /dev/null +++ b/library/src/org/whispersystems/textsecure/push/PreKeyResponse.java @@ -0,0 +1,65 @@ +package org.whispersystems.textsecure.push; + +import com.google.thoughtcrimegson.GsonBuilder; +import com.google.thoughtcrimegson.JsonDeserializationContext; +import com.google.thoughtcrimegson.JsonDeserializer; +import com.google.thoughtcrimegson.JsonElement; +import com.google.thoughtcrimegson.JsonParseException; +import com.google.thoughtcrimegson.JsonPrimitive; +import com.google.thoughtcrimegson.JsonSerializationContext; +import com.google.thoughtcrimegson.JsonSerializer; + +import org.whispersystems.libaxolotl.IdentityKey; +import org.whispersystems.libaxolotl.InvalidKeyException; +import org.whispersystems.textsecure.util.Base64; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.List; + +public class PreKeyResponse { + + private IdentityKey identityKey; + private List devices; + + public IdentityKey getIdentityKey() { + return identityKey; + } + + public List getDevices() { + return devices; + } + + public static PreKeyResponse fromJson(String serialized) { + GsonBuilder builder = new GsonBuilder(); + return PreKeyResponseItem.forBuilder(builder) + .registerTypeAdapter(IdentityKey.class, new IdentityKeyJsonAdapter()) + .create().fromJson(serialized, PreKeyResponse.class); + } + + public static class IdentityKeyJsonAdapter + implements JsonSerializer, JsonDeserializer + { + @Override + public JsonElement serialize(IdentityKey identityKey, Type type, + JsonSerializationContext jsonSerializationContext) + { + return new JsonPrimitive(Base64.encodeBytesWithoutPadding(identityKey.serialize())); + } + + @Override + public IdentityKey deserialize(JsonElement jsonElement, Type type, + JsonDeserializationContext jsonDeserializationContext) + throws JsonParseException + { + try { + return new IdentityKey(Base64.decodeWithoutPadding(jsonElement.getAsJsonPrimitive().getAsString()), 0); + } catch (InvalidKeyException | IOException e) { + throw new JsonParseException(e); + } + } + } + + + +} diff --git a/library/src/org/whispersystems/textsecure/push/PreKeyResponseItem.java b/library/src/org/whispersystems/textsecure/push/PreKeyResponseItem.java new file mode 100644 index 000000000..ddbbfec1f --- /dev/null +++ b/library/src/org/whispersystems/textsecure/push/PreKeyResponseItem.java @@ -0,0 +1,31 @@ +package org.whispersystems.textsecure.push; + +import com.google.thoughtcrimegson.GsonBuilder; + +public class PreKeyResponseItem { + + private int deviceId; + private int registrationId; + private DeviceKeyEntity deviceKey; + private PreKeyEntity preKey; + + public int getDeviceId() { + return deviceId; + } + + public int getRegistrationId() { + return registrationId; + } + + public DeviceKeyEntity getDeviceKey() { + return deviceKey; + } + + public PreKeyEntity getPreKey() { + return preKey; + } + + public static GsonBuilder forBuilder(GsonBuilder builder) { + return DeviceKeyEntity.forBuilder(builder); + } +} diff --git a/library/src/org/whispersystems/textsecure/push/PreKeyState.java b/library/src/org/whispersystems/textsecure/push/PreKeyState.java new file mode 100644 index 000000000..d75e14dbc --- /dev/null +++ b/library/src/org/whispersystems/textsecure/push/PreKeyState.java @@ -0,0 +1,32 @@ +package org.whispersystems.textsecure.push; + +import com.google.thoughtcrimegson.GsonBuilder; + +import org.whispersystems.libaxolotl.IdentityKey; + +import java.util.List; + +public class PreKeyState { + + private IdentityKey identityKey; + private List preKeys; + private PreKeyEntity lastResortKey; + private DeviceKeyEntity deviceKey; + + + public PreKeyState(List preKeys, PreKeyEntity lastResortKey, + DeviceKeyEntity deviceKey, IdentityKey identityKey) + { + this.preKeys = preKeys; + this.lastResortKey = lastResortKey; + this.deviceKey = deviceKey; + this.identityKey = identityKey; + } + + public static String toJson(PreKeyState state) { + GsonBuilder builder = new GsonBuilder(); + return DeviceKeyEntity.forBuilder(builder) + .registerTypeAdapter(IdentityKey.class, new PreKeyResponse.IdentityKeyJsonAdapter()) + .create().toJson(state); + } +} diff --git a/library/src/org/whispersystems/textsecure/push/PushMessageProtos.java b/library/src/org/whispersystems/textsecure/push/PushMessageProtos.java index 9bf618be3..6f953827b 100644 --- a/library/src/org/whispersystems/textsecure/push/PushMessageProtos.java +++ b/library/src/org/whispersystems/textsecure/push/PushMessageProtos.java @@ -10,573 +10,133 @@ public final class PushMessageProtos { } public interface IncomingPushMessageSignalOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional .textsecure.IncomingPushMessageSignal.Type type = 1; + /** + * optional .textsecure.IncomingPushMessageSignal.Type type = 1; + */ boolean hasType(); + /** + * optional .textsecure.IncomingPushMessageSignal.Type type = 1; + */ org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type getType(); - + // optional string source = 2; + /** + * optional string source = 2; + */ boolean hasSource(); - String getSource(); - + /** + * optional string source = 2; + */ + java.lang.String getSource(); + /** + * optional string source = 2; + */ + com.google.protobuf.ByteString + getSourceBytes(); + // optional uint32 sourceDevice = 7; + /** + * optional uint32 sourceDevice = 7; + */ boolean hasSourceDevice(); + /** + * optional uint32 sourceDevice = 7; + */ int getSourceDevice(); - + // optional string relay = 3; + /** + * optional string relay = 3; + */ boolean hasRelay(); - String getRelay(); - + /** + * optional string relay = 3; + */ + java.lang.String getRelay(); + /** + * optional string relay = 3; + */ + com.google.protobuf.ByteString + getRelayBytes(); + // optional uint64 timestamp = 5; + /** + * optional uint64 timestamp = 5; + */ boolean hasTimestamp(); + /** + * optional uint64 timestamp = 5; + */ long getTimestamp(); - + // optional bytes message = 6; + /** + * optional bytes message = 6; + * + *
+     * Contains an encrypted PushMessageContent
+     * 
+ */ boolean hasMessage(); + /** + * optional bytes message = 6; + * + *
+     * Contains an encrypted PushMessageContent
+     * 
+ */ com.google.protobuf.ByteString getMessage(); } + /** + * Protobuf type {@code textsecure.IncomingPushMessageSignal} + */ public static final class IncomingPushMessageSignal extends com.google.protobuf.GeneratedMessage implements IncomingPushMessageSignalOrBuilder { // Use IncomingPushMessageSignal.newBuilder() to construct. - private IncomingPushMessageSignal(Builder builder) { + private IncomingPushMessageSignal(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private IncomingPushMessageSignal(boolean noInit) {} - + private IncomingPushMessageSignal(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final IncomingPushMessageSignal defaultInstance; public static IncomingPushMessageSignal getDefaultInstance() { return defaultInstance; } - + public IncomingPushMessageSignal getDefaultInstanceForType() { return defaultInstance; } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_IncomingPushMessageSignal_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_IncomingPushMessageSignal_fieldAccessorTable; - } - - public enum Type - implements com.google.protobuf.ProtocolMessageEnum { - UNKNOWN(0, 0), - CIPHERTEXT(1, 1), - KEY_EXCHANGE(2, 2), - PREKEY_BUNDLE(3, 3), - PLAINTEXT(4, 4), - ; - - public static final int UNKNOWN_VALUE = 0; - public static final int CIPHERTEXT_VALUE = 1; - public static final int KEY_EXCHANGE_VALUE = 2; - public static final int PREKEY_BUNDLE_VALUE = 3; - public static final int PLAINTEXT_VALUE = 4; - - - public final int getNumber() { return value; } - - public static Type valueOf(int value) { - switch (value) { - case 0: return UNKNOWN; - case 1: return CIPHERTEXT; - case 2: return KEY_EXCHANGE; - case 3: return PREKEY_BUNDLE; - case 4: return PLAINTEXT; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public Type findValueByNumber(int number) { - return Type.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.getDescriptor().getEnumTypes().get(0); - } - - private static final Type[] VALUES = { - UNKNOWN, CIPHERTEXT, KEY_EXCHANGE, PREKEY_BUNDLE, PLAINTEXT, - }; - - public static Type valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private Type(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:textsecure.IncomingPushMessageSignal.Type) - } - - private int bitField0_; - // optional .textsecure.IncomingPushMessageSignal.Type type = 1; - public static final int TYPE_FIELD_NUMBER = 1; - private org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type type_; - public boolean hasType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type getType() { - return type_; - } - - // optional string source = 2; - public static final int SOURCE_FIELD_NUMBER = 2; - private java.lang.Object source_; - public boolean hasSource() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getSource() { - java.lang.Object ref = source_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - source_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getSourceBytes() { - java.lang.Object ref = source_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - source_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional uint32 sourceDevice = 7; - public static final int SOURCEDEVICE_FIELD_NUMBER = 7; - private int sourceDevice_; - public boolean hasSourceDevice() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public int getSourceDevice() { - return sourceDevice_; - } - - // optional string relay = 3; - public static final int RELAY_FIELD_NUMBER = 3; - private java.lang.Object relay_; - public boolean hasRelay() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public String getRelay() { - java.lang.Object ref = relay_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - relay_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getRelayBytes() { - java.lang.Object ref = relay_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - relay_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional uint64 timestamp = 5; - public static final int TIMESTAMP_FIELD_NUMBER = 5; - private long timestamp_; - public boolean hasTimestamp() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - public long getTimestamp() { - return timestamp_; - } - - // optional bytes message = 6; - public static final int MESSAGE_FIELD_NUMBER = 6; - private com.google.protobuf.ByteString message_; - public boolean hasMessage() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - public com.google.protobuf.ByteString getMessage() { - return message_; - } - - private void initFields() { - type_ = org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type.UNKNOWN; - source_ = ""; - sourceDevice_ = 0; - relay_ = ""; - timestamp_ = 0L; - message_ = com.google.protobuf.ByteString.EMPTY; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeEnum(1, type_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getSourceBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(3, getRelayBytes()); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeUInt64(5, timestamp_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeBytes(6, message_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeUInt32(7, sourceDevice_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, type_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getSourceBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, getRelayBytes()); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(5, timestamp_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(6, message_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(7, sourceDevice_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; + + private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; } - - public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal 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.push.PushMessageProtos.IncomingPushMessageSignal parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal 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.push.PushMessageProtos.IncomingPushMessageSignal parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom( + private IncomingPushMessageSignal( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignalOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_IncomingPushMessageSignal_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_IncomingPushMessageSignal_fieldAccessorTable; - } - - // Construct using org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - type_ = org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type.UNKNOWN; - bitField0_ = (bitField0_ & ~0x00000001); - source_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - sourceDevice_ = 0; - bitField0_ = (bitField0_ & ~0x00000004); - relay_ = ""; - bitField0_ = (bitField0_ & ~0x00000008); - timestamp_ = 0L; - bitField0_ = (bitField0_ & ~0x00000010); - message_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000020); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.getDescriptor(); - } - - public org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal getDefaultInstanceForType() { - return org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.getDefaultInstance(); - } - - public org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal build() { - org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal buildPartial() { - org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal result = new org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.type_ = type_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.source_ = source_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.sourceDevice_ = sourceDevice_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.relay_ = relay_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.timestamp_ = timestamp_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000020; - } - result.message_ = message_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal) { - return mergeFrom((org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal other) { - if (other == org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.getDefaultInstance()) return this; - if (other.hasType()) { - setType(other.getType()); - } - if (other.hasSource()) { - setSource(other.getSource()); - } - if (other.hasSourceDevice()) { - setSourceDevice(other.getSourceDevice()); - } - if (other.hasRelay()) { - setRelay(other.getRelay()); - } - if (other.hasTimestamp()) { - setTimestamp(other.getTimestamp()); - } - if (other.hasMessage()) { - setMessage(other.getMessage()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { int tag = input.readTag(); switch (tag) { case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; + break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; } break; } @@ -618,18 +178,644 @@ public final class PushMessageProtos { } } } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_IncomingPushMessageSignal_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_IncomingPushMessageSignal_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.class, org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public IncomingPushMessageSignal parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new IncomingPushMessageSignal(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + /** + * Protobuf enum {@code textsecure.IncomingPushMessageSignal.Type} + */ + public enum Type + implements com.google.protobuf.ProtocolMessageEnum { + /** + * UNKNOWN = 0; + */ + UNKNOWN(0, 0), + /** + * CIPHERTEXT = 1; + */ + CIPHERTEXT(1, 1), + /** + * KEY_EXCHANGE = 2; + */ + KEY_EXCHANGE(2, 2), + /** + * PREKEY_BUNDLE = 3; + */ + PREKEY_BUNDLE(3, 3), + /** + * PLAINTEXT = 4; + */ + PLAINTEXT(4, 4), + ; + + /** + * UNKNOWN = 0; + */ + public static final int UNKNOWN_VALUE = 0; + /** + * CIPHERTEXT = 1; + */ + public static final int CIPHERTEXT_VALUE = 1; + /** + * KEY_EXCHANGE = 2; + */ + public static final int KEY_EXCHANGE_VALUE = 2; + /** + * PREKEY_BUNDLE = 3; + */ + public static final int PREKEY_BUNDLE_VALUE = 3; + /** + * PLAINTEXT = 4; + */ + public static final int PLAINTEXT_VALUE = 4; + + + public final int getNumber() { return value; } + + public static Type valueOf(int value) { + switch (value) { + case 0: return UNKNOWN; + case 1: return CIPHERTEXT; + case 2: return KEY_EXCHANGE; + case 3: return PREKEY_BUNDLE; + case 4: return PLAINTEXT; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Type findValueByNumber(int number) { + return Type.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.getDescriptor().getEnumTypes().get(0); + } + + private static final Type[] VALUES = values(); + + public static Type valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private Type(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:textsecure.IncomingPushMessageSignal.Type) + } + + private int bitField0_; + // optional .textsecure.IncomingPushMessageSignal.Type type = 1; + public static final int TYPE_FIELD_NUMBER = 1; + private org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type type_; + /** + * optional .textsecure.IncomingPushMessageSignal.Type type = 1; + */ + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional .textsecure.IncomingPushMessageSignal.Type type = 1; + */ + public org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type getType() { + return type_; + } + + // optional string source = 2; + public static final int SOURCE_FIELD_NUMBER = 2; + private java.lang.Object source_; + /** + * optional string source = 2; + */ + public boolean hasSource() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string source = 2; + */ + public java.lang.String getSource() { + java.lang.Object ref = source_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + source_ = s; + } + return s; + } + } + /** + * optional string source = 2; + */ + public com.google.protobuf.ByteString + getSourceBytes() { + java.lang.Object ref = source_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + source_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional uint32 sourceDevice = 7; + public static final int SOURCEDEVICE_FIELD_NUMBER = 7; + private int sourceDevice_; + /** + * optional uint32 sourceDevice = 7; + */ + public boolean hasSourceDevice() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional uint32 sourceDevice = 7; + */ + public int getSourceDevice() { + return sourceDevice_; + } + + // optional string relay = 3; + public static final int RELAY_FIELD_NUMBER = 3; + private java.lang.Object relay_; + /** + * optional string relay = 3; + */ + public boolean hasRelay() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional string relay = 3; + */ + public java.lang.String getRelay() { + java.lang.Object ref = relay_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + relay_ = s; + } + return s; + } + } + /** + * optional string relay = 3; + */ + public com.google.protobuf.ByteString + getRelayBytes() { + java.lang.Object ref = relay_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + relay_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional uint64 timestamp = 5; + public static final int TIMESTAMP_FIELD_NUMBER = 5; + private long timestamp_; + /** + * optional uint64 timestamp = 5; + */ + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional uint64 timestamp = 5; + */ + public long getTimestamp() { + return timestamp_; + } + + // optional bytes message = 6; + public static final int MESSAGE_FIELD_NUMBER = 6; + private com.google.protobuf.ByteString message_; + /** + * optional bytes message = 6; + * + *
+     * Contains an encrypted PushMessageContent
+     * 
+ */ + public boolean hasMessage() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * optional bytes message = 6; + * + *
+     * Contains an encrypted PushMessageContent
+     * 
+ */ + public com.google.protobuf.ByteString getMessage() { + return message_; + } + + private void initFields() { + type_ = org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type.UNKNOWN; + source_ = ""; + sourceDevice_ = 0; + relay_ = ""; + timestamp_ = 0L; + message_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, type_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getSourceBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(3, getRelayBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeUInt64(5, timestamp_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBytes(6, message_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeUInt32(7, sourceDevice_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, type_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getSourceBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getRelayBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(5, timestamp_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(6, message_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(7, sourceDevice_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code textsecure.IncomingPushMessageSignal} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignalOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_IncomingPushMessageSignal_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_IncomingPushMessageSignal_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.class, org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Builder.class); + } + + // Construct using org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + type_ = org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type.UNKNOWN; + bitField0_ = (bitField0_ & ~0x00000001); + source_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + sourceDevice_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); + relay_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + timestamp_ = 0L; + bitField0_ = (bitField0_ & ~0x00000010); + message_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000020); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_IncomingPushMessageSignal_descriptor; + } + + public org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal getDefaultInstanceForType() { + return org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.getDefaultInstance(); + } + + public org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal build() { + org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal buildPartial() { + org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal result = new org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.type_ = type_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.source_ = source_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.sourceDevice_ = sourceDevice_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.relay_ = relay_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.timestamp_ = timestamp_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.message_ = message_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal) { + return mergeFrom((org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal other) { + if (other == org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.getDefaultInstance()) return this; + if (other.hasType()) { + setType(other.getType()); + } + if (other.hasSource()) { + bitField0_ |= 0x00000002; + source_ = other.source_; + onChanged(); + } + if (other.hasSourceDevice()) { + setSourceDevice(other.getSourceDevice()); + } + if (other.hasRelay()) { + bitField0_ |= 0x00000008; + relay_ = other.relay_; + onChanged(); + } + if (other.hasTimestamp()) { + setTimestamp(other.getTimestamp()); + } + if (other.hasMessage()) { + setMessage(other.getMessage()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; } - private int bitField0_; - + // optional .textsecure.IncomingPushMessageSignal.Type type = 1; private org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type type_ = org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type.UNKNOWN; + /** + * optional .textsecure.IncomingPushMessageSignal.Type type = 1; + */ public boolean hasType() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional .textsecure.IncomingPushMessageSignal.Type type = 1; + */ public org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type getType() { return type_; } + /** + * optional .textsecure.IncomingPushMessageSignal.Type type = 1; + */ public Builder setType(org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type value) { if (value == null) { throw new NullPointerException(); @@ -639,29 +825,59 @@ public final class PushMessageProtos { onChanged(); return this; } + /** + * optional .textsecure.IncomingPushMessageSignal.Type type = 1; + */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000001); type_ = org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Type.UNKNOWN; onChanged(); return this; } - + // optional string source = 2; private java.lang.Object source_ = ""; + /** + * optional string source = 2; + */ public boolean hasSource() { return ((bitField0_ & 0x00000002) == 0x00000002); } - public String getSource() { + /** + * optional string source = 2; + */ + public java.lang.String getSource() { java.lang.Object ref = source_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); source_ = s; return s; } else { - return (String) ref; + return (java.lang.String) ref; } } - public Builder setSource(String value) { + /** + * optional string source = 2; + */ + public com.google.protobuf.ByteString + getSourceBytes() { + java.lang.Object ref = source_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + source_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string source = 2; + */ + public Builder setSource( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } @@ -670,55 +886,105 @@ public final class PushMessageProtos { onChanged(); return this; } + /** + * optional string source = 2; + */ public Builder clearSource() { bitField0_ = (bitField0_ & ~0x00000002); source_ = getDefaultInstance().getSource(); onChanged(); return this; } - void setSource(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; + /** + * optional string source = 2; + */ + public Builder setSourceBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; source_ = value; onChanged(); + return this; } - + // optional uint32 sourceDevice = 7; private int sourceDevice_ ; + /** + * optional uint32 sourceDevice = 7; + */ public boolean hasSourceDevice() { return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional uint32 sourceDevice = 7; + */ public int getSourceDevice() { return sourceDevice_; } + /** + * optional uint32 sourceDevice = 7; + */ public Builder setSourceDevice(int value) { bitField0_ |= 0x00000004; sourceDevice_ = value; onChanged(); return this; } + /** + * optional uint32 sourceDevice = 7; + */ public Builder clearSourceDevice() { bitField0_ = (bitField0_ & ~0x00000004); sourceDevice_ = 0; onChanged(); return this; } - + // optional string relay = 3; private java.lang.Object relay_ = ""; + /** + * optional string relay = 3; + */ public boolean hasRelay() { return ((bitField0_ & 0x00000008) == 0x00000008); } - public String getRelay() { + /** + * optional string relay = 3; + */ + public java.lang.String getRelay() { java.lang.Object ref = relay_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); relay_ = s; return s; } else { - return (String) ref; + return (java.lang.String) ref; } } - public Builder setRelay(String value) { + /** + * optional string relay = 3; + */ + public com.google.protobuf.ByteString + getRelayBytes() { + java.lang.Object ref = relay_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + relay_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string relay = 3; + */ + public Builder setRelay( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } @@ -727,47 +993,91 @@ public final class PushMessageProtos { onChanged(); return this; } + /** + * optional string relay = 3; + */ public Builder clearRelay() { bitField0_ = (bitField0_ & ~0x00000008); relay_ = getDefaultInstance().getRelay(); onChanged(); return this; } - void setRelay(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000008; + /** + * optional string relay = 3; + */ + public Builder setRelayBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; relay_ = value; onChanged(); + return this; } - + // optional uint64 timestamp = 5; private long timestamp_ ; + /** + * optional uint64 timestamp = 5; + */ public boolean hasTimestamp() { return ((bitField0_ & 0x00000010) == 0x00000010); } + /** + * optional uint64 timestamp = 5; + */ public long getTimestamp() { return timestamp_; } + /** + * optional uint64 timestamp = 5; + */ public Builder setTimestamp(long value) { bitField0_ |= 0x00000010; timestamp_ = value; onChanged(); return this; } + /** + * optional uint64 timestamp = 5; + */ public Builder clearTimestamp() { bitField0_ = (bitField0_ & ~0x00000010); timestamp_ = 0L; onChanged(); return this; } - + // optional bytes message = 6; private com.google.protobuf.ByteString message_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes message = 6; + * + *
+       * Contains an encrypted PushMessageContent
+       * 
+ */ public boolean hasMessage() { return ((bitField0_ & 0x00000020) == 0x00000020); } + /** + * optional bytes message = 6; + * + *
+       * Contains an encrypted PushMessageContent
+       * 
+ */ public com.google.protobuf.ByteString getMessage() { return message_; } + /** + * optional bytes message = 6; + * + *
+       * Contains an encrypted PushMessageContent
+       * 
+ */ public Builder setMessage(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -777,95 +1087,248 @@ public final class PushMessageProtos { onChanged(); return this; } + /** + * optional bytes message = 6; + * + *
+       * Contains an encrypted PushMessageContent
+       * 
+ */ public Builder clearMessage() { bitField0_ = (bitField0_ & ~0x00000020); message_ = getDefaultInstance().getMessage(); onChanged(); return this; } - + // @@protoc_insertion_point(builder_scope:textsecure.IncomingPushMessageSignal) } - + static { defaultInstance = new IncomingPushMessageSignal(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.IncomingPushMessageSignal) } - + public interface PushMessageContentOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional string body = 1; + /** + * optional string body = 1; + */ boolean hasBody(); - String getBody(); - + /** + * optional string body = 1; + */ + java.lang.String getBody(); + /** + * optional string body = 1; + */ + com.google.protobuf.ByteString + getBodyBytes(); + // repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ java.util.List getAttachmentsList(); + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer getAttachments(int index); + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ int getAttachmentsCount(); + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ java.util.List getAttachmentsOrBuilderList(); + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointerOrBuilder getAttachmentsOrBuilder( int index); - + // optional .textsecure.PushMessageContent.GroupContext group = 3; + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ boolean hasGroup(); + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext getGroup(); + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContextOrBuilder getGroupOrBuilder(); - + // optional uint32 flags = 4; + /** + * optional uint32 flags = 4; + */ boolean hasFlags(); + /** + * optional uint32 flags = 4; + */ int getFlags(); } + /** + * Protobuf type {@code textsecure.PushMessageContent} + */ public static final class PushMessageContent extends com.google.protobuf.GeneratedMessage implements PushMessageContentOrBuilder { // Use PushMessageContent.newBuilder() to construct. - private PushMessageContent(Builder builder) { + private PushMessageContent(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private PushMessageContent(boolean noInit) {} - + private PushMessageContent(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final PushMessageContent defaultInstance; public static PushMessageContent getDefaultInstance() { return defaultInstance; } - + public PushMessageContent getDefaultInstanceForType() { return defaultInstance; } - + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private PushMessageContent( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + body_ = input.readBytes(); + break; + } + case 18: { + if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + attachments_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + attachments_.add(input.readMessage(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.PARSER, extensionRegistry)); + break; + } + case 26: { + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Builder subBuilder = null; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + subBuilder = group_.toBuilder(); + } + group_ = input.readMessage(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(group_); + group_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000002; + break; + } + case 32: { + bitField0_ |= 0x00000004; + flags_ = input.readUInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + attachments_ = java.util.Collections.unmodifiableList(attachments_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_fieldAccessorTable; + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.class, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.Builder.class); } - + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public PushMessageContent parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PushMessageContent(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + /** + * Protobuf enum {@code textsecure.PushMessageContent.Flags} + */ public enum Flags implements com.google.protobuf.ProtocolMessageEnum { + /** + * END_SESSION = 1; + */ END_SESSION(0, 1), ; - + + /** + * END_SESSION = 1; + */ public static final int END_SESSION_VALUE = 1; - - + + public final int getNumber() { return value; } - + public static Flags valueOf(int value) { switch (value) { case 1: return END_SESSION; default: return null; } } - + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { return internalValueMap; @@ -877,7 +1340,7 @@ public final class PushMessageProtos { return Flags.valueOf(number); } }; - + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(index); @@ -890,11 +1353,9 @@ public final class PushMessageProtos { getDescriptor() { return org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.getDescriptor().getEnumTypes().get(0); } - - private static final Flags[] VALUES = { - END_SESSION, - }; - + + private static final Flags[] VALUES = values(); + public static Flags valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { @@ -903,394 +1364,104 @@ public final class PushMessageProtos { } return VALUES[desc.getIndex()]; } - + private final int index; private final int value; - + private Flags(int index, int value) { this.index = index; this.value = value; } - + // @@protoc_insertion_point(enum_scope:textsecure.PushMessageContent.Flags) } - + public interface AttachmentPointerOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional fixed64 id = 1; + /** + * optional fixed64 id = 1; + */ boolean hasId(); + /** + * optional fixed64 id = 1; + */ long getId(); - + // optional string contentType = 2; + /** + * optional string contentType = 2; + */ boolean hasContentType(); - String getContentType(); - + /** + * optional string contentType = 2; + */ + java.lang.String getContentType(); + /** + * optional string contentType = 2; + */ + com.google.protobuf.ByteString + getContentTypeBytes(); + // optional bytes key = 3; + /** + * optional bytes key = 3; + */ boolean hasKey(); + /** + * optional bytes key = 3; + */ com.google.protobuf.ByteString getKey(); } + /** + * Protobuf type {@code textsecure.PushMessageContent.AttachmentPointer} + */ public static final class AttachmentPointer extends com.google.protobuf.GeneratedMessage implements AttachmentPointerOrBuilder { // Use AttachmentPointer.newBuilder() to construct. - private AttachmentPointer(Builder builder) { + private AttachmentPointer(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private AttachmentPointer(boolean noInit) {} - + private AttachmentPointer(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final AttachmentPointer defaultInstance; public static AttachmentPointer getDefaultInstance() { return defaultInstance; } - + public AttachmentPointer getDefaultInstanceForType() { return defaultInstance; } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_AttachmentPointer_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_AttachmentPointer_fieldAccessorTable; - } - - private int bitField0_; - // optional fixed64 id = 1; - public static final int ID_FIELD_NUMBER = 1; - private long id_; - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public long getId() { - return id_; - } - - // optional string contentType = 2; - public static final int CONTENTTYPE_FIELD_NUMBER = 2; - private java.lang.Object contentType_; - public boolean hasContentType() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getContentType() { - java.lang.Object ref = contentType_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - contentType_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getContentTypeBytes() { - java.lang.Object ref = contentType_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - contentType_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional bytes key = 3; - public static final int KEY_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.google.protobuf.ByteString getKey() { - return key_; - } - - private void initFields() { - id_ = 0L; - contentType_ = ""; - key_ = com.google.protobuf.ByteString.EMPTY; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeFixed64(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getContentTypeBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, key_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeFixed64Size(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getContentTypeBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, key_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; + + private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; } - - public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer 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.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer 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.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom( + private AttachmentPointer( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointerOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_AttachmentPointer_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_AttachmentPointer_fieldAccessorTable; - } - - // Construct using org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - id_ = 0L; - bitField0_ = (bitField0_ & ~0x00000001); - contentType_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - key_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.getDescriptor(); - } - - public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer getDefaultInstanceForType() { - return org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.getDefaultInstance(); - } - - public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer build() { - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer buildPartial() { - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer result = new org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.contentType_ = contentType_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.key_ = key_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer) { - return mergeFrom((org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer other) { - if (other == org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.getDefaultInstance()) return this; - if (other.hasId()) { - setId(other.getId()); - } - if (other.hasContentType()) { - setContentType(other.getContentType()); - } - if (other.hasKey()) { - setKey(other.getKey()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { int tag = input.readTag(); switch (tag) { case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; + break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; + done = true; } break; } @@ -1311,47 +1482,458 @@ public final class PushMessageProtos { } } } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_AttachmentPointer_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_AttachmentPointer_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.class, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public AttachmentPointer parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AttachmentPointer(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // optional fixed64 id = 1; + public static final int ID_FIELD_NUMBER = 1; + private long id_; + /** + * optional fixed64 id = 1; + */ + public boolean hasId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional fixed64 id = 1; + */ + public long getId() { + return id_; + } + + // optional string contentType = 2; + public static final int CONTENTTYPE_FIELD_NUMBER = 2; + private java.lang.Object contentType_; + /** + * optional string contentType = 2; + */ + public boolean hasContentType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string contentType = 2; + */ + public java.lang.String getContentType() { + java.lang.Object ref = contentType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + contentType_ = s; + } + return s; + } + } + /** + * optional string contentType = 2; + */ + public com.google.protobuf.ByteString + getContentTypeBytes() { + java.lang.Object ref = contentType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contentType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional bytes key = 3; + public static final int KEY_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString key_; + /** + * optional bytes key = 3; + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional bytes key = 3; + */ + public com.google.protobuf.ByteString getKey() { + return key_; + } + + private void initFields() { + id_ = 0L; + contentType_ = ""; + key_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeFixed64(1, id_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getContentTypeBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, key_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeFixed64Size(1, id_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getContentTypeBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, key_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code textsecure.PushMessageContent.AttachmentPointer} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointerOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_AttachmentPointer_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_AttachmentPointer_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.class, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder.class); + } + + // Construct using org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + id_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + contentType_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + key_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_AttachmentPointer_descriptor; + } + + public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer getDefaultInstanceForType() { + return org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.getDefaultInstance(); + } + + public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer build() { + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer buildPartial() { + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer result = new org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.id_ = id_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.contentType_ = contentType_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.key_ = key_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer) { + return mergeFrom((org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer other) { + if (other == org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.getDefaultInstance()) return this; + if (other.hasId()) { + setId(other.getId()); + } + if (other.hasContentType()) { + bitField0_ |= 0x00000002; + contentType_ = other.contentType_; + onChanged(); + } + if (other.hasKey()) { + setKey(other.getKey()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; } - private int bitField0_; - + // optional fixed64 id = 1; private long id_ ; + /** + * optional fixed64 id = 1; + */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional fixed64 id = 1; + */ public long getId() { return id_; } + /** + * optional fixed64 id = 1; + */ public Builder setId(long value) { bitField0_ |= 0x00000001; id_ = value; onChanged(); return this; } + /** + * optional fixed64 id = 1; + */ public Builder clearId() { bitField0_ = (bitField0_ & ~0x00000001); id_ = 0L; onChanged(); return this; } - + // optional string contentType = 2; private java.lang.Object contentType_ = ""; + /** + * optional string contentType = 2; + */ public boolean hasContentType() { return ((bitField0_ & 0x00000002) == 0x00000002); } - public String getContentType() { + /** + * optional string contentType = 2; + */ + public java.lang.String getContentType() { java.lang.Object ref = contentType_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); contentType_ = s; return s; } else { - return (String) ref; + return (java.lang.String) ref; } } - public Builder setContentType(String value) { + /** + * optional string contentType = 2; + */ + public com.google.protobuf.ByteString + getContentTypeBytes() { + java.lang.Object ref = contentType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contentType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string contentType = 2; + */ + public Builder setContentType( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } @@ -1360,26 +1942,46 @@ public final class PushMessageProtos { onChanged(); return this; } + /** + * optional string contentType = 2; + */ public Builder clearContentType() { bitField0_ = (bitField0_ & ~0x00000002); contentType_ = getDefaultInstance().getContentType(); onChanged(); return this; } - void setContentType(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; + /** + * optional string contentType = 2; + */ + public Builder setContentTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; contentType_ = value; onChanged(); + return this; } - + // optional bytes key = 3; private com.google.protobuf.ByteString key_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes key = 3; + */ public boolean hasKey() { return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional bytes key = 3; + */ public com.google.protobuf.ByteString getKey() { return key_; } + /** + * optional bytes key = 3; + */ public Builder setKey(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -1389,93 +1991,277 @@ public final class PushMessageProtos { onChanged(); return this; } + /** + * optional bytes key = 3; + */ public Builder clearKey() { bitField0_ = (bitField0_ & ~0x00000004); key_ = getDefaultInstance().getKey(); onChanged(); return this; } - + // @@protoc_insertion_point(builder_scope:textsecure.PushMessageContent.AttachmentPointer) } - + static { defaultInstance = new AttachmentPointer(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.PushMessageContent.AttachmentPointer) } - + public interface GroupContextOrBuilder extends com.google.protobuf.MessageOrBuilder { - + // optional bytes id = 1; + /** + * optional bytes id = 1; + */ boolean hasId(); + /** + * optional bytes id = 1; + */ com.google.protobuf.ByteString getId(); - + // optional .textsecure.PushMessageContent.GroupContext.Type type = 2; + /** + * optional .textsecure.PushMessageContent.GroupContext.Type type = 2; + */ boolean hasType(); + /** + * optional .textsecure.PushMessageContent.GroupContext.Type type = 2; + */ org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type getType(); - + // optional string name = 3; + /** + * optional string name = 3; + */ boolean hasName(); - String getName(); - + /** + * optional string name = 3; + */ + java.lang.String getName(); + /** + * optional string name = 3; + */ + com.google.protobuf.ByteString + getNameBytes(); + // repeated string members = 4; - java.util.List getMembersList(); + /** + * repeated string members = 4; + */ + java.util.List + getMembersList(); + /** + * repeated string members = 4; + */ int getMembersCount(); - String getMembers(int index); - + /** + * repeated string members = 4; + */ + java.lang.String getMembers(int index); + /** + * repeated string members = 4; + */ + com.google.protobuf.ByteString + getMembersBytes(int index); + // optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ boolean hasAvatar(); + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer getAvatar(); + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointerOrBuilder getAvatarOrBuilder(); } + /** + * Protobuf type {@code textsecure.PushMessageContent.GroupContext} + */ public static final class GroupContext extends com.google.protobuf.GeneratedMessage implements GroupContextOrBuilder { // Use GroupContext.newBuilder() to construct. - private GroupContext(Builder builder) { + private GroupContext(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); + this.unknownFields = builder.getUnknownFields(); } - private GroupContext(boolean noInit) {} - + private GroupContext(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private static final GroupContext defaultInstance; public static GroupContext getDefaultInstance() { return defaultInstance; } - + public GroupContext getDefaultInstanceForType() { return defaultInstance; } - + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GroupContext( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + id_ = input.readBytes(); + break; + } + case 16: { + int rawValue = input.readEnum(); + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type value = org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(2, rawValue); + } else { + bitField0_ |= 0x00000002; + type_ = value; + } + break; + } + case 26: { + bitField0_ |= 0x00000004; + name_ = input.readBytes(); + break; + } + case 34: { + if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + members_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000008; + } + members_.add(input.readBytes()); + break; + } + case 42: { + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder subBuilder = null; + if (((bitField0_ & 0x00000008) == 0x00000008)) { + subBuilder = avatar_.toBuilder(); + } + avatar_ = input.readMessage(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(avatar_); + avatar_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000008; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + members_ = new com.google.protobuf.UnmodifiableLazyStringList(members_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_GroupContext_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_GroupContext_fieldAccessorTable; + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_GroupContext_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.class, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Builder.class); } - + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public GroupContext parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GroupContext(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + /** + * Protobuf enum {@code textsecure.PushMessageContent.GroupContext.Type} + */ public enum Type implements com.google.protobuf.ProtocolMessageEnum { + /** + * UNKNOWN = 0; + */ UNKNOWN(0, 0), + /** + * UPDATE = 1; + */ UPDATE(1, 1), + /** + * DELIVER = 2; + */ DELIVER(2, 2), + /** + * QUIT = 3; + */ QUIT(3, 3), ; - + + /** + * UNKNOWN = 0; + */ public static final int UNKNOWN_VALUE = 0; + /** + * UPDATE = 1; + */ public static final int UPDATE_VALUE = 1; + /** + * DELIVER = 2; + */ public static final int DELIVER_VALUE = 2; + /** + * QUIT = 3; + */ public static final int QUIT_VALUE = 3; - - + + public final int getNumber() { return value; } - + public static Type valueOf(int value) { switch (value) { case 0: return UNKNOWN; @@ -1485,7 +2271,7 @@ public final class PushMessageProtos { default: return null; } } - + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { return internalValueMap; @@ -1497,7 +2283,7 @@ public final class PushMessageProtos { return Type.valueOf(number); } }; - + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(index); @@ -1510,11 +2296,9 @@ public final class PushMessageProtos { getDescriptor() { return org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.getDescriptor().getEnumTypes().get(0); } - - private static final Type[] VALUES = { - UNKNOWN, UPDATE, DELIVER, QUIT, - }; - + + private static final Type[] VALUES = values(); + public static Type valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { @@ -1523,98 +2307,146 @@ public final class PushMessageProtos { } return VALUES[desc.getIndex()]; } - + private final int index; private final int value; - + private Type(int index, int value) { this.index = index; this.value = value; } - + // @@protoc_insertion_point(enum_scope:textsecure.PushMessageContent.GroupContext.Type) } - + private int bitField0_; // optional bytes id = 1; public static final int ID_FIELD_NUMBER = 1; private com.google.protobuf.ByteString id_; + /** + * optional bytes id = 1; + */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional bytes id = 1; + */ public com.google.protobuf.ByteString getId() { return id_; } - + // optional .textsecure.PushMessageContent.GroupContext.Type type = 2; public static final int TYPE_FIELD_NUMBER = 2; private org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type type_; + /** + * optional .textsecure.PushMessageContent.GroupContext.Type type = 2; + */ public boolean hasType() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional .textsecure.PushMessageContent.GroupContext.Type type = 2; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type getType() { return type_; } - + // optional string name = 3; public static final int NAME_FIELD_NUMBER = 3; private java.lang.Object name_; + /** + * optional string name = 3; + */ public boolean hasName() { return ((bitField0_ & 0x00000004) == 0x00000004); } - public String getName() { + /** + * optional string name = 3; + */ + public java.lang.String getName() { java.lang.Object ref = name_; - if (ref instanceof String) { - return (String) ref; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { name_ = s; } return s; } } - private com.google.protobuf.ByteString getNameBytes() { + /** + * optional string name = 3; + */ + public com.google.protobuf.ByteString + getNameBytes() { java.lang.Object ref = name_; - if (ref instanceof String) { + if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } - + // repeated string members = 4; public static final int MEMBERS_FIELD_NUMBER = 4; private com.google.protobuf.LazyStringList members_; - public java.util.List + /** + * repeated string members = 4; + */ + public java.util.List getMembersList() { return members_; } + /** + * repeated string members = 4; + */ public int getMembersCount() { return members_.size(); } - public String getMembers(int index) { + /** + * repeated string members = 4; + */ + public java.lang.String getMembers(int index) { return members_.get(index); } - + /** + * repeated string members = 4; + */ + public com.google.protobuf.ByteString + getMembersBytes(int index) { + return members_.getByteString(index); + } + // optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; public static final int AVATAR_FIELD_NUMBER = 5; private org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer avatar_; + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ public boolean hasAvatar() { return ((bitField0_ & 0x00000008) == 0x00000008); } + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer getAvatar() { return avatar_; } + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointerOrBuilder getAvatarOrBuilder() { return avatar_; } - + private void initFields() { id_ = com.google.protobuf.ByteString.EMPTY; type_ = org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type.UNKNOWN; @@ -1626,11 +2458,11 @@ public final class PushMessageProtos { public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); @@ -1651,12 +2483,12 @@ public final class PushMessageProtos { } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream @@ -1687,94 +2519,83 @@ public final class PushMessageProtos { memoizedSerializedSize = size; return size; } - + private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } - + public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** + * Protobuf type {@code textsecure.PushMessageContent.GroupContext} + */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContextOrBuilder { @@ -1782,18 +2603,21 @@ public final class PushMessageProtos { getDescriptor() { return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_GroupContext_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_GroupContext_fieldAccessorTable; + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_GroupContext_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.class, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Builder.class); } - + // Construct using org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.newBuilder() private Builder() { maybeForceBuilderInitialization(); } - - private Builder(BuilderParent parent) { + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } @@ -1805,7 +2629,7 @@ public final class PushMessageProtos { private static Builder create() { return new Builder(); } - + public Builder clear() { super.clear(); id_ = com.google.protobuf.ByteString.EMPTY; @@ -1824,20 +2648,20 @@ public final class PushMessageProtos { bitField0_ = (bitField0_ & ~0x00000010); return this; } - + public Builder clone() { return create().mergeFrom(buildPartial()); } - + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.getDescriptor(); + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_GroupContext_descriptor; } - + public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext getDefaultInstanceForType() { return org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.getDefaultInstance(); } - + public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext build() { org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext result = buildPartial(); if (!result.isInitialized()) { @@ -1845,17 +2669,7 @@ public final class PushMessageProtos { } return result; } - - private org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - + public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext buildPartial() { org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext result = new org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext(this); int from_bitField0_ = bitField0_; @@ -1890,7 +2704,7 @@ public final class PushMessageProtos { onBuilt(); return result; } - + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext) { return mergeFrom((org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext)other); @@ -1899,7 +2713,7 @@ public final class PushMessageProtos { return this; } } - + public Builder mergeFrom(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext other) { if (other == org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.getDefaultInstance()) return this; if (other.hasId()) { @@ -1909,7 +2723,9 @@ public final class PushMessageProtos { setType(other.getType()); } if (other.hasName()) { - setName(other.getName()); + bitField0_ |= 0x00000004; + name_ = other.name_; + onChanged(); } if (!other.members_.isEmpty()) { if (members_.isEmpty()) { @@ -1927,83 +2743,47 @@ public final class PushMessageProtos { this.mergeUnknownFields(other.getUnknownFields()); return this; } - + public final boolean isInitialized() { return true; } - + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - id_ = input.readBytes(); - break; - } - case 16: { - int rawValue = input.readEnum(); - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type value = org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(2, rawValue); - } else { - bitField0_ |= 0x00000002; - type_ = value; - } - break; - } - case 26: { - bitField0_ |= 0x00000004; - name_ = input.readBytes(); - break; - } - case 34: { - ensureMembersIsMutable(); - members_.add(input.readBytes()); - break; - } - case 42: { - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder subBuilder = org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.newBuilder(); - if (hasAvatar()) { - subBuilder.mergeFrom(getAvatar()); - } - input.readMessage(subBuilder, extensionRegistry); - setAvatar(subBuilder.buildPartial()); - break; - } + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - private int bitField0_; - + // optional bytes id = 1; private com.google.protobuf.ByteString id_ = com.google.protobuf.ByteString.EMPTY; + /** + * optional bytes id = 1; + */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * optional bytes id = 1; + */ public com.google.protobuf.ByteString getId() { return id_; } + /** + * optional bytes id = 1; + */ public Builder setId(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); @@ -2013,21 +2793,33 @@ public final class PushMessageProtos { onChanged(); return this; } + /** + * optional bytes id = 1; + */ public Builder clearId() { bitField0_ = (bitField0_ & ~0x00000001); id_ = getDefaultInstance().getId(); onChanged(); return this; } - + // optional .textsecure.PushMessageContent.GroupContext.Type type = 2; private org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type type_ = org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type.UNKNOWN; + /** + * optional .textsecure.PushMessageContent.GroupContext.Type type = 2; + */ public boolean hasType() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional .textsecure.PushMessageContent.GroupContext.Type type = 2; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type getType() { return type_; } + /** + * optional .textsecure.PushMessageContent.GroupContext.Type type = 2; + */ public Builder setType(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type value) { if (value == null) { throw new NullPointerException(); @@ -2037,29 +2829,59 @@ public final class PushMessageProtos { onChanged(); return this; } + /** + * optional .textsecure.PushMessageContent.GroupContext.Type type = 2; + */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000002); type_ = org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Type.UNKNOWN; onChanged(); return this; } - + // optional string name = 3; private java.lang.Object name_ = ""; + /** + * optional string name = 3; + */ public boolean hasName() { return ((bitField0_ & 0x00000004) == 0x00000004); } - public String getName() { + /** + * optional string name = 3; + */ + public java.lang.String getName() { java.lang.Object ref = name_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); name_ = s; return s; } else { - return (String) ref; + return (java.lang.String) ref; } } - public Builder setName(String value) { + /** + * optional string name = 3; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string name = 3; + */ + public Builder setName( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } @@ -2068,18 +2890,29 @@ public final class PushMessageProtos { onChanged(); return this; } + /** + * optional string name = 3; + */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000004); name_ = getDefaultInstance().getName(); onChanged(); return this; } - void setName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000004; + /** + * optional string name = 3; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; name_ = value; onChanged(); + return this; } - + // repeated string members = 4; private com.google.protobuf.LazyStringList members_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureMembersIsMutable() { @@ -2088,18 +2921,37 @@ public final class PushMessageProtos { bitField0_ |= 0x00000008; } } - public java.util.List + /** + * repeated string members = 4; + */ + public java.util.List getMembersList() { return java.util.Collections.unmodifiableList(members_); } + /** + * repeated string members = 4; + */ public int getMembersCount() { return members_.size(); } - public String getMembers(int index) { + /** + * repeated string members = 4; + */ + public java.lang.String getMembers(int index) { return members_.get(index); } + /** + * repeated string members = 4; + */ + public com.google.protobuf.ByteString + getMembersBytes(int index) { + return members_.getByteString(index); + } + /** + * repeated string members = 4; + */ public Builder setMembers( - int index, String value) { + int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } @@ -2108,7 +2960,11 @@ public final class PushMessageProtos { onChanged(); return this; } - public Builder addMembers(String value) { + /** + * repeated string members = 4; + */ + public Builder addMembers( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } @@ -2117,32 +2973,52 @@ public final class PushMessageProtos { onChanged(); return this; } + /** + * repeated string members = 4; + */ public Builder addAllMembers( - java.lang.Iterable values) { + java.lang.Iterable values) { ensureMembersIsMutable(); super.addAll(values, members_); onChanged(); return this; } + /** + * repeated string members = 4; + */ public Builder clearMembers() { members_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000008); onChanged(); return this; } - void addMembers(com.google.protobuf.ByteString value) { - ensureMembersIsMutable(); + /** + * repeated string members = 4; + */ + public Builder addMembersBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureMembersIsMutable(); members_.add(value); onChanged(); + return this; } - + // optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; private org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer avatar_ = org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointerOrBuilder> avatarBuilder_; + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ public boolean hasAvatar() { return ((bitField0_ & 0x00000010) == 0x00000010); } + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer getAvatar() { if (avatarBuilder_ == null) { return avatar_; @@ -2150,6 +3026,9 @@ public final class PushMessageProtos { return avatarBuilder_.getMessage(); } } + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ public Builder setAvatar(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer value) { if (avatarBuilder_ == null) { if (value == null) { @@ -2163,6 +3042,9 @@ public final class PushMessageProtos { bitField0_ |= 0x00000010; return this; } + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ public Builder setAvatar( org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder builderForValue) { if (avatarBuilder_ == null) { @@ -2174,6 +3056,9 @@ public final class PushMessageProtos { bitField0_ |= 0x00000010; return this; } + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ public Builder mergeAvatar(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer value) { if (avatarBuilder_ == null) { if (((bitField0_ & 0x00000010) == 0x00000010) && @@ -2190,6 +3075,9 @@ public final class PushMessageProtos { bitField0_ |= 0x00000010; return this; } + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ public Builder clearAvatar() { if (avatarBuilder_ == null) { avatar_ = org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.getDefaultInstance(); @@ -2200,11 +3088,17 @@ public final class PushMessageProtos { bitField0_ = (bitField0_ & ~0x00000010); return this; } + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder getAvatarBuilder() { bitField0_ |= 0x00000010; onChanged(); return getAvatarFieldBuilder().getBuilder(); } + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointerOrBuilder getAvatarOrBuilder() { if (avatarBuilder_ != null) { return avatarBuilder_.getMessageOrBuilder(); @@ -2212,6 +3106,9 @@ public final class PushMessageProtos { return avatar_; } } + /** + * optional .textsecure.PushMessageContent.AttachmentPointer avatar = 5; + */ private com.google.protobuf.SingleFieldBuilder< org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointerOrBuilder> getAvatarFieldBuilder() { @@ -2225,95 +3122,136 @@ public final class PushMessageProtos { } return avatarBuilder_; } - + // @@protoc_insertion_point(builder_scope:textsecure.PushMessageContent.GroupContext) } - + static { defaultInstance = new GroupContext(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.PushMessageContent.GroupContext) } - + private int bitField0_; // optional string body = 1; public static final int BODY_FIELD_NUMBER = 1; private java.lang.Object body_; + /** + * optional string body = 1; + */ public boolean hasBody() { return ((bitField0_ & 0x00000001) == 0x00000001); } - public String getBody() { + /** + * optional string body = 1; + */ + public java.lang.String getBody() { java.lang.Object ref = body_; - if (ref instanceof String) { - return (String) ref; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { body_ = s; } return s; } } - private com.google.protobuf.ByteString getBodyBytes() { + /** + * optional string body = 1; + */ + public com.google.protobuf.ByteString + getBodyBytes() { java.lang.Object ref = body_; - if (ref instanceof String) { + if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); body_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } - + // repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; public static final int ATTACHMENTS_FIELD_NUMBER = 2; private java.util.List attachments_; + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public java.util.List getAttachmentsList() { return attachments_; } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public java.util.List getAttachmentsOrBuilderList() { return attachments_; } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public int getAttachmentsCount() { return attachments_.size(); } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer getAttachments(int index) { return attachments_.get(index); } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointerOrBuilder getAttachmentsOrBuilder( int index) { return attachments_.get(index); } - + // optional .textsecure.PushMessageContent.GroupContext group = 3; public static final int GROUP_FIELD_NUMBER = 3; private org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext group_; + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ public boolean hasGroup() { return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext getGroup() { return group_; } + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContextOrBuilder getGroupOrBuilder() { return group_; } - + // optional uint32 flags = 4; public static final int FLAGS_FIELD_NUMBER = 4; private int flags_; + /** + * optional uint32 flags = 4; + */ public boolean hasFlags() { return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional uint32 flags = 4; + */ public int getFlags() { return flags_; } - + private void initFields() { body_ = ""; attachments_ = java.util.Collections.emptyList(); @@ -2324,11 +3262,11 @@ public final class PushMessageProtos { public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); @@ -2346,12 +3284,12 @@ public final class PushMessageProtos { } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream @@ -2373,94 +3311,83 @@ public final class PushMessageProtos { memoizedSerializedSize = size; return size; } - + private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } - + public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** + * Protobuf type {@code textsecure.PushMessageContent} + */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContentOrBuilder { @@ -2468,18 +3395,21 @@ public final class PushMessageProtos { getDescriptor() { return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_descriptor; } - + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_fieldAccessorTable; + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.class, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.Builder.class); } - + // Construct using org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.newBuilder() private Builder() { maybeForceBuilderInitialization(); } - - private Builder(BuilderParent parent) { + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } @@ -2492,7 +3422,7 @@ public final class PushMessageProtos { private static Builder create() { return new Builder(); } - + public Builder clear() { super.clear(); body_ = ""; @@ -2513,20 +3443,20 @@ public final class PushMessageProtos { bitField0_ = (bitField0_ & ~0x00000008); return this; } - + public Builder clone() { return create().mergeFrom(buildPartial()); } - + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.getDescriptor(); + return org.whispersystems.textsecure.push.PushMessageProtos.internal_static_textsecure_PushMessageContent_descriptor; } - + public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent getDefaultInstanceForType() { return org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.getDefaultInstance(); } - + public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent build() { org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent result = buildPartial(); if (!result.isInitialized()) { @@ -2534,17 +3464,7 @@ public final class PushMessageProtos { } return result; } - - private org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - + public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent buildPartial() { org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent result = new org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent(this); int from_bitField0_ = bitField0_; @@ -2578,7 +3498,7 @@ public final class PushMessageProtos { onBuilt(); return result; } - + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent) { return mergeFrom((org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent)other); @@ -2587,11 +3507,13 @@ public final class PushMessageProtos { return this; } } - + public Builder mergeFrom(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent other) { if (other == org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.getDefaultInstance()) return this; if (other.hasBody()) { - setBody(other.getBody()); + bitField0_ |= 0x00000001; + body_ = other.body_; + onChanged(); } if (attachmentsBuilder_ == null) { if (!other.attachments_.isEmpty()) { @@ -2628,81 +3550,73 @@ public final class PushMessageProtos { this.mergeUnknownFields(other.getUnknownFields()); return this; } - + public final boolean isInitialized() { return true; } - + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - body_ = input.readBytes(); - break; - } - case 18: { - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder subBuilder = org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addAttachments(subBuilder.buildPartial()); - break; - } - case 26: { - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Builder subBuilder = org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.newBuilder(); - if (hasGroup()) { - subBuilder.mergeFrom(getGroup()); - } - input.readMessage(subBuilder, extensionRegistry); - setGroup(subBuilder.buildPartial()); - break; - } - case 32: { - bitField0_ |= 0x00000008; - flags_ = input.readUInt32(); - break; - } + org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - private int bitField0_; - + // optional string body = 1; private java.lang.Object body_ = ""; + /** + * optional string body = 1; + */ public boolean hasBody() { return ((bitField0_ & 0x00000001) == 0x00000001); } - public String getBody() { + /** + * optional string body = 1; + */ + public java.lang.String getBody() { java.lang.Object ref = body_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); body_ = s; return s; } else { - return (String) ref; + return (java.lang.String) ref; } } - public Builder setBody(String value) { + /** + * optional string body = 1; + */ + public com.google.protobuf.ByteString + getBodyBytes() { + java.lang.Object ref = body_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + body_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string body = 1; + */ + public Builder setBody( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } @@ -2711,18 +3625,29 @@ public final class PushMessageProtos { onChanged(); return this; } + /** + * optional string body = 1; + */ public Builder clearBody() { bitField0_ = (bitField0_ & ~0x00000001); body_ = getDefaultInstance().getBody(); onChanged(); return this; } - void setBody(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; + /** + * optional string body = 1; + */ + public Builder setBodyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; body_ = value; onChanged(); + return this; } - + // repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; private java.util.List attachments_ = java.util.Collections.emptyList(); @@ -2732,10 +3657,13 @@ public final class PushMessageProtos { bitField0_ |= 0x00000002; } } - + private com.google.protobuf.RepeatedFieldBuilder< org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointerOrBuilder> attachmentsBuilder_; - + + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public java.util.List getAttachmentsList() { if (attachmentsBuilder_ == null) { return java.util.Collections.unmodifiableList(attachments_); @@ -2743,6 +3671,9 @@ public final class PushMessageProtos { return attachmentsBuilder_.getMessageList(); } } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public int getAttachmentsCount() { if (attachmentsBuilder_ == null) { return attachments_.size(); @@ -2750,6 +3681,9 @@ public final class PushMessageProtos { return attachmentsBuilder_.getCount(); } } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer getAttachments(int index) { if (attachmentsBuilder_ == null) { return attachments_.get(index); @@ -2757,6 +3691,9 @@ public final class PushMessageProtos { return attachmentsBuilder_.getMessage(index); } } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public Builder setAttachments( int index, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer value) { if (attachmentsBuilder_ == null) { @@ -2771,6 +3708,9 @@ public final class PushMessageProtos { } return this; } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public Builder setAttachments( int index, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder builderForValue) { if (attachmentsBuilder_ == null) { @@ -2782,6 +3722,9 @@ public final class PushMessageProtos { } return this; } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public Builder addAttachments(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer value) { if (attachmentsBuilder_ == null) { if (value == null) { @@ -2795,6 +3738,9 @@ public final class PushMessageProtos { } return this; } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public Builder addAttachments( int index, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer value) { if (attachmentsBuilder_ == null) { @@ -2809,6 +3755,9 @@ public final class PushMessageProtos { } return this; } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public Builder addAttachments( org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder builderForValue) { if (attachmentsBuilder_ == null) { @@ -2820,6 +3769,9 @@ public final class PushMessageProtos { } return this; } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public Builder addAttachments( int index, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder builderForValue) { if (attachmentsBuilder_ == null) { @@ -2831,6 +3783,9 @@ public final class PushMessageProtos { } return this; } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public Builder addAllAttachments( java.lang.Iterable values) { if (attachmentsBuilder_ == null) { @@ -2842,6 +3797,9 @@ public final class PushMessageProtos { } return this; } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public Builder clearAttachments() { if (attachmentsBuilder_ == null) { attachments_ = java.util.Collections.emptyList(); @@ -2852,6 +3810,9 @@ public final class PushMessageProtos { } return this; } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public Builder removeAttachments(int index) { if (attachmentsBuilder_ == null) { ensureAttachmentsIsMutable(); @@ -2862,10 +3823,16 @@ public final class PushMessageProtos { } return this; } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder getAttachmentsBuilder( int index) { return getAttachmentsFieldBuilder().getBuilder(index); } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointerOrBuilder getAttachmentsOrBuilder( int index) { if (attachmentsBuilder_ == null) { @@ -2873,6 +3840,9 @@ public final class PushMessageProtos { return attachmentsBuilder_.getMessageOrBuilder(index); } } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public java.util.List getAttachmentsOrBuilderList() { if (attachmentsBuilder_ != null) { @@ -2881,15 +3851,24 @@ public final class PushMessageProtos { return java.util.Collections.unmodifiableList(attachments_); } } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder addAttachmentsBuilder() { return getAttachmentsFieldBuilder().addBuilder( org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.getDefaultInstance()); } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder addAttachmentsBuilder( int index) { return getAttachmentsFieldBuilder().addBuilder( index, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.getDefaultInstance()); } + /** + * repeated .textsecure.PushMessageContent.AttachmentPointer attachments = 2; + */ public java.util.List getAttachmentsBuilderList() { return getAttachmentsFieldBuilder().getBuilderList(); @@ -2908,14 +3887,20 @@ public final class PushMessageProtos { } return attachmentsBuilder_; } - + // optional .textsecure.PushMessageContent.GroupContext group = 3; private org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext group_ = org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Builder, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContextOrBuilder> groupBuilder_; + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ public boolean hasGroup() { return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext getGroup() { if (groupBuilder_ == null) { return group_; @@ -2923,6 +3908,9 @@ public final class PushMessageProtos { return groupBuilder_.getMessage(); } } + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ public Builder setGroup(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext value) { if (groupBuilder_ == null) { if (value == null) { @@ -2936,6 +3924,9 @@ public final class PushMessageProtos { bitField0_ |= 0x00000004; return this; } + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ public Builder setGroup( org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Builder builderForValue) { if (groupBuilder_ == null) { @@ -2947,6 +3938,9 @@ public final class PushMessageProtos { bitField0_ |= 0x00000004; return this; } + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ public Builder mergeGroup(org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext value) { if (groupBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004) && @@ -2963,6 +3957,9 @@ public final class PushMessageProtos { bitField0_ |= 0x00000004; return this; } + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ public Builder clearGroup() { if (groupBuilder_ == null) { group_ = org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.getDefaultInstance(); @@ -2973,11 +3970,17 @@ public final class PushMessageProtos { bitField0_ = (bitField0_ & ~0x00000004); return this; } + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Builder getGroupBuilder() { bitField0_ |= 0x00000004; onChanged(); return getGroupFieldBuilder().getBuilder(); } + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ public org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContextOrBuilder getGroupOrBuilder() { if (groupBuilder_ != null) { return groupBuilder_.getMessageOrBuilder(); @@ -2985,6 +3988,9 @@ public final class PushMessageProtos { return group_; } } + /** + * optional .textsecure.PushMessageContent.GroupContext group = 3; + */ private com.google.protobuf.SingleFieldBuilder< org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Builder, org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContextOrBuilder> getGroupFieldBuilder() { @@ -2998,39 +4004,51 @@ public final class PushMessageProtos { } return groupBuilder_; } - + // optional uint32 flags = 4; private int flags_ ; + /** + * optional uint32 flags = 4; + */ public boolean hasFlags() { return ((bitField0_ & 0x00000008) == 0x00000008); } + /** + * optional uint32 flags = 4; + */ public int getFlags() { return flags_; } + /** + * optional uint32 flags = 4; + */ public Builder setFlags(int value) { bitField0_ |= 0x00000008; flags_ = value; onChanged(); return this; } + /** + * optional uint32 flags = 4; + */ public Builder clearFlags() { bitField0_ = (bitField0_ & ~0x00000008); flags_ = 0; onChanged(); return this; } - + // @@protoc_insertion_point(builder_scope:textsecure.PushMessageContent) } - + static { defaultInstance = new PushMessageContent(true); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:textsecure.PushMessageContent) } - + private static com.google.protobuf.Descriptors.Descriptor internal_static_textsecure_IncomingPushMessageSignal_descriptor; private static @@ -3051,7 +4069,7 @@ public final class PushMessageProtos { private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_textsecure_PushMessageContent_GroupContext_fieldAccessorTable; - + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -3094,33 +4112,25 @@ public final class PushMessageProtos { internal_static_textsecure_IncomingPushMessageSignal_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_IncomingPushMessageSignal_descriptor, - new java.lang.String[] { "Type", "Source", "SourceDevice", "Relay", "Timestamp", "Message", }, - org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.class, - org.whispersystems.textsecure.push.PushMessageProtos.IncomingPushMessageSignal.Builder.class); + new java.lang.String[] { "Type", "Source", "SourceDevice", "Relay", "Timestamp", "Message", }); internal_static_textsecure_PushMessageContent_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_textsecure_PushMessageContent_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_PushMessageContent_descriptor, - new java.lang.String[] { "Body", "Attachments", "Group", "Flags", }, - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.class, - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.Builder.class); + new java.lang.String[] { "Body", "Attachments", "Group", "Flags", }); internal_static_textsecure_PushMessageContent_AttachmentPointer_descriptor = internal_static_textsecure_PushMessageContent_descriptor.getNestedTypes().get(0); internal_static_textsecure_PushMessageContent_AttachmentPointer_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_PushMessageContent_AttachmentPointer_descriptor, - new java.lang.String[] { "Id", "ContentType", "Key", }, - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.class, - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.AttachmentPointer.Builder.class); + new java.lang.String[] { "Id", "ContentType", "Key", }); internal_static_textsecure_PushMessageContent_GroupContext_descriptor = internal_static_textsecure_PushMessageContent_descriptor.getNestedTypes().get(1); internal_static_textsecure_PushMessageContent_GroupContext_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_textsecure_PushMessageContent_GroupContext_descriptor, - new java.lang.String[] { "Id", "Type", "Name", "Members", "Avatar", }, - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.class, - org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext.Builder.class); + new java.lang.String[] { "Id", "Type", "Name", "Members", "Avatar", }); return null; } }; @@ -3129,6 +4139,6 @@ public final class PushMessageProtos { new com.google.protobuf.Descriptors.FileDescriptor[] { }, assigner); } - + // @@protoc_insertion_point(outer_class_scope) } diff --git a/library/src/org/whispersystems/textsecure/push/PushServiceSocket.java b/library/src/org/whispersystems/textsecure/push/PushServiceSocket.java index 00439088c..e405ca67c 100644 --- a/library/src/org/whispersystems/textsecure/push/PushServiceSocket.java +++ b/library/src/org/whispersystems/textsecure/push/PushServiceSocket.java @@ -24,6 +24,9 @@ import com.google.thoughtcrimegson.JsonParseException; import org.apache.http.conn.ssl.StrictHostnameVerifier; import org.whispersystems.libaxolotl.IdentityKey; +import org.whispersystems.libaxolotl.ecc.ECPublicKey; +import org.whispersystems.libaxolotl.state.DeviceKeyRecord; +import org.whispersystems.libaxolotl.state.PreKeyBundle; import org.whispersystems.libaxolotl.state.PreKeyRecord; import org.whispersystems.textsecure.util.Base64; import org.whispersystems.textsecure.util.BlacklistingTrustManager; @@ -64,9 +67,9 @@ public class PushServiceSocket { private static final String CREATE_ACCOUNT_VOICE_PATH = "/v1/accounts/voice/code/%s"; private static final String VERIFY_ACCOUNT_PATH = "/v1/accounts/code/%s"; private static final String REGISTER_GCM_PATH = "/v1/accounts/gcm/"; - private static final String PREKEY_METADATA_PATH = "/v1/keys/"; - private static final String PREKEY_PATH = "/v1/keys/%s"; - private static final String PREKEY_DEVICE_PATH = "/v1/keys/%s/%s"; + private static final String PREKEY_METADATA_PATH = "/v2/keys/"; + private static final String PREKEY_PATH = "/v2/keys/%s"; + private static final String PREKEY_DEVICE_PATH = "/v2/keys/%s/%s"; private static final String DIRECTORY_TOKENS_PATH = "/v1/directory/tokens"; private static final String DIRECTORY_VERIFY_PATH = "/v1/directory/%s"; @@ -126,6 +129,7 @@ public class PushServiceSocket { public void registerPreKeys(IdentityKey identityKey, PreKeyRecord lastResortKey, + DeviceKeyRecord deviceKey, List records) throws IOException { @@ -133,19 +137,20 @@ public class PushServiceSocket { for (PreKeyRecord record : records) { PreKeyEntity entity = new PreKeyEntity(record.getId(), - record.getKeyPair().getPublicKey(), - identityKey); + record.getKeyPair().getPublicKey()); entities.add(entity); } PreKeyEntity lastResortEntity = new PreKeyEntity(lastResortKey.getId(), - lastResortKey.getKeyPair().getPublicKey(), - identityKey); + lastResortKey.getKeyPair().getPublicKey()); + DeviceKeyEntity deviceKeyEntity = new DeviceKeyEntity(deviceKey.getId(), + deviceKey.getKeyPair().getPublicKey(), + deviceKey.getSignature()); makeRequest(String.format(PREKEY_PATH, ""), "PUT", - PreKeyList.toJson(new PreKeyList(lastResortEntity, entities))); + PreKeyState.toJson(new PreKeyState(entities, lastResortEntity, deviceKeyEntity, identityKey))); } public int getAvailablePreKeys() throws IOException { @@ -155,7 +160,7 @@ public class PushServiceSocket { return preKeyStatus.getCount(); } - public List getPreKeys(PushAddress destination) throws IOException { + public List getPreKeys(PushAddress destination) throws IOException { try { String deviceId = String.valueOf(destination.getDeviceId()); @@ -168,10 +173,34 @@ public class PushServiceSocket { path = path + "?relay=" + destination.getRelay(); } - String responseText = makeRequest(path, "GET", null); - PreKeyList response = PreKeyList.fromJson(responseText); + String responseText = makeRequest(path, "GET", null); + PreKeyResponse response = PreKeyResponse.fromJson(responseText); + List bundles = new LinkedList<>(); - return response.getKeys(); + for (PreKeyResponseItem device : response.getDevices()) { + ECPublicKey preKey = null; + ECPublicKey deviceKey = null; + byte[] deviceKeySignature = null; + int preKeyId = -1; + int deviceKeyId = -1; + + if (device.getDeviceKey() != null) { + deviceKey = device.getDeviceKey().getPublicKey(); + deviceKeyId = device.getDeviceKey().getKeyId(); + deviceKeySignature = device.getDeviceKey().getSignature(); + } + + if (device.getPreKey() != null) { + preKeyId = device.getPreKey().getKeyId(); + preKey = device.getPreKey().getPublicKey(); + } + + bundles.add(new PreKeyBundle(device.getRegistrationId(), device.getDeviceId(), preKeyId, + preKey, deviceKeyId, deviceKey, deviceKeySignature, + response.getIdentityKey())); + } + + return bundles; } catch (JsonParseException e) { throw new IOException(e); } catch (NotFoundException nfe) { @@ -179,7 +208,7 @@ public class PushServiceSocket { } } - public PreKeyEntity getPreKey(PushAddress destination) throws IOException { + public PreKeyBundle getPreKey(PushAddress destination) throws IOException { try { String path = String.format(PREKEY_DEVICE_PATH, destination.getNumber(), String.valueOf(destination.getDeviceId())); @@ -188,13 +217,32 @@ public class PushServiceSocket { path = path + "?relay=" + destination.getRelay(); } - String responseText = makeRequest(path, "GET", null); - PreKeyList response = PreKeyList.fromJson(responseText); + String responseText = makeRequest(path, "GET", null); + PreKeyResponse response = PreKeyResponse.fromJson(responseText); - if (response.getKeys() == null || response.getKeys().size() < 1) + if (response.getDevices() == null || response.getDevices().size() < 1) throw new IOException("Empty prekey list"); - return response.getKeys().get(0); + PreKeyResponseItem device = response.getDevices().get(0); + ECPublicKey preKey = null; + ECPublicKey deviceKey = null; + byte[] deviceKeySignature = null; + int preKeyId = -1; + int deviceKeyId = -1; + + if (device.getPreKey() != null) { + preKeyId = device.getPreKey().getKeyId(); + preKey = device.getPreKey().getPublicKey(); + } + + if (device.getDeviceKey() != null) { + deviceKeyId = device.getDeviceKey().getKeyId(); + deviceKey = device.getDeviceKey().getPublicKey(); + deviceKeySignature = device.getDeviceKey().getSignature(); + } + + return new PreKeyBundle(device.getRegistrationId(), device.getDeviceId(), preKeyId, preKey, + deviceKeyId, deviceKey, deviceKeySignature, response.getIdentityKey()); } catch (JsonParseException e) { throw new IOException(e); } catch (NotFoundException nfe) { diff --git a/library/src/org/whispersystems/textsecure/storage/SessionUtil.java b/library/src/org/whispersystems/textsecure/storage/SessionUtil.java index e4f3142fe..984af341f 100644 --- a/library/src/org/whispersystems/textsecure/storage/SessionUtil.java +++ b/library/src/org/whispersystems/textsecure/storage/SessionUtil.java @@ -25,8 +25,8 @@ public class SessionUtil { SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret); return - sessionStore.contains(recipientId, deviceId) && - !sessionStore.load(recipientId, deviceId).getSessionState().getNeedsRefresh(); + sessionStore.containsSession(recipientId, deviceId) && + !sessionStore.loadSession(recipientId, deviceId).getSessionState().getNeedsRefresh(); } } diff --git a/library/src/org/whispersystems/textsecure/storage/TextSecurePreKeyStore.java b/library/src/org/whispersystems/textsecure/storage/TextSecurePreKeyStore.java index d56882b71..98eb2a505 100644 --- a/library/src/org/whispersystems/textsecure/storage/TextSecurePreKeyStore.java +++ b/library/src/org/whispersystems/textsecure/storage/TextSecurePreKeyStore.java @@ -5,6 +5,8 @@ import android.util.Log; import org.whispersystems.libaxolotl.InvalidKeyIdException; import org.whispersystems.libaxolotl.InvalidMessageException; +import org.whispersystems.libaxolotl.state.DeviceKeyRecord; +import org.whispersystems.libaxolotl.state.DeviceKeyStore; import org.whispersystems.libaxolotl.state.PreKeyRecord; import org.whispersystems.libaxolotl.state.PreKeyStore; import org.whispersystems.textsecure.crypto.MasterCipher; @@ -17,10 +19,15 @@ import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; +import java.util.LinkedList; +import java.util.List; + +public class TextSecurePreKeyStore implements PreKeyStore, DeviceKeyStore { + + public static final String PREKEY_DIRECTORY = "prekeys"; + public static final String DEVICE_KEY_DIRECTORY = "device_keys"; -public class TextSecurePreKeyStore implements PreKeyStore { - public static final String PREKEY_DIRECTORY = "prekeys"; private static final int CURRENT_VERSION_MARKER = 1; private static final Object FILE_LOCK = new Object(); private static final String TAG = TextSecurePreKeyStore.class.getSimpleName(); @@ -34,20 +41,10 @@ public class TextSecurePreKeyStore implements PreKeyStore { } @Override - public PreKeyRecord load(int preKeyId) throws InvalidKeyIdException { + public PreKeyRecord loadPreKey(int preKeyId) throws InvalidKeyIdException { synchronized (FILE_LOCK) { try { - MasterCipher masterCipher = new MasterCipher(masterSecret); - FileInputStream fin = new FileInputStream(getPreKeyFile(preKeyId)); - int recordVersion = readInteger(fin); - - if (recordVersion != CURRENT_VERSION_MARKER) { - throw new AssertionError("Invalid version: " + recordVersion); - } - - byte[] serializedRecord = masterCipher.decryptBytes(readBlob(fin)); - return new PreKeyRecord(serializedRecord); - + return new PreKeyRecord(loadSerializedRecord(getPreKeyFile(preKeyId))); } catch (IOException | InvalidMessageException e) { Log.w(TAG, e); throw new InvalidKeyIdException(e); @@ -56,19 +53,40 @@ public class TextSecurePreKeyStore implements PreKeyStore { } @Override - public void store(int preKeyId, PreKeyRecord record) { + public DeviceKeyRecord loadDeviceKey(int deviceKeyId) throws InvalidKeyIdException { synchronized (FILE_LOCK) { try { - MasterCipher masterCipher = new MasterCipher(masterSecret); - RandomAccessFile recordFile = new RandomAccessFile(getPreKeyFile(preKeyId), "rw"); - FileChannel out = recordFile.getChannel(); + return new DeviceKeyRecord(loadSerializedRecord(getDeviceKeyFile(deviceKeyId))); + } catch (IOException | InvalidMessageException e) { + Log.w(TAG, e); + throw new InvalidKeyIdException(e); + } + } + } - out.position(0); - writeInteger(CURRENT_VERSION_MARKER, out); - writeBlob(masterCipher.encryptBytes(record.serialize()), out); - out.truncate(out.position()); + @Override + public List loadDeviceKeys() { + synchronized (FILE_LOCK) { + File directory = getDeviceKeyDirectory(); + List results = new LinkedList<>(); - recordFile.close(); + for (File deviceKeyFile : directory.listFiles()) { + try { + results.add(new DeviceKeyRecord(loadSerializedRecord(deviceKeyFile))); + } catch (IOException | InvalidMessageException e) { + Log.w(TAG, e); + } + } + + return results; + } + } + + @Override + public void storePreKey(int preKeyId, PreKeyRecord record) { + synchronized (FILE_LOCK) { + try { + storeSerializedRecord(getPreKeyFile(preKeyId), record.serialize()); } catch (IOException e) { throw new AssertionError(e); } @@ -76,23 +94,85 @@ public class TextSecurePreKeyStore implements PreKeyStore { } @Override - public boolean contains(int preKeyId) { + public void storeDeviceKey(int deviceKeyId, DeviceKeyRecord record) { + synchronized (FILE_LOCK) { + try { + storeSerializedRecord(getDeviceKeyFile(deviceKeyId), record.serialize()); + } catch (IOException e) { + throw new AssertionError(e); + } + } + } + + @Override + public boolean containsPreKey(int preKeyId) { File record = getPreKeyFile(preKeyId); return record.exists(); } @Override - public void remove(int preKeyId) { + public boolean containsDeviceKey(int deviceKeyId) { + File record = getDeviceKeyFile(deviceKeyId); + return record.exists(); + } + + + @Override + public void removePreKey(int preKeyId) { File record = getPreKeyFile(preKeyId); record.delete(); } + @Override + public void removeDeviceKey(int deviceKeyId) { + File record = getDeviceKeyFile(deviceKeyId); + record.delete(); + } + + private byte[] loadSerializedRecord(File recordFile) + throws IOException, InvalidMessageException + { + MasterCipher masterCipher = new MasterCipher(masterSecret); + FileInputStream fin = new FileInputStream(recordFile); + int recordVersion = readInteger(fin); + + if (recordVersion != CURRENT_VERSION_MARKER) { + throw new AssertionError("Invalid version: " + recordVersion); + } + + return masterCipher.decryptBytes(readBlob(fin)); + } + + private void storeSerializedRecord(File file, byte[] serialized) throws IOException { + MasterCipher masterCipher = new MasterCipher(masterSecret); + RandomAccessFile recordFile = new RandomAccessFile(file, "rw"); + FileChannel out = recordFile.getChannel(); + + out.position(0); + writeInteger(CURRENT_VERSION_MARKER, out); + writeBlob(masterCipher.encryptBytes(serialized), out); + out.truncate(out.position()); + recordFile.close(); + } + private File getPreKeyFile(int preKeyId) { return new File(getPreKeyDirectory(), String.valueOf(preKeyId)); } + private File getDeviceKeyFile(int deviceKeyId) { + return new File(getDeviceKeyDirectory(), String.valueOf(deviceKeyId)); + } + private File getPreKeyDirectory() { - File directory = new File(context.getFilesDir(), PREKEY_DIRECTORY); + return getRecordsDirectory(PREKEY_DIRECTORY); + } + + private File getDeviceKeyDirectory() { + return getRecordsDirectory(DEVICE_KEY_DIRECTORY); + } + + private File getRecordsDirectory(String directoryName) { + File directory = new File(context.getFilesDir(), directoryName); if (!directory.exists()) { if (!directory.mkdirs()) { @@ -127,4 +207,6 @@ public class TextSecurePreKeyStore implements PreKeyStore { out.write(ByteBuffer.wrap(valueBytes)); } + + } diff --git a/library/src/org/whispersystems/textsecure/storage/TextSecureSessionStore.java b/library/src/org/whispersystems/textsecure/storage/TextSecureSessionStore.java index 7c70fa71b..b06a47238 100644 --- a/library/src/org/whispersystems/textsecure/storage/TextSecureSessionStore.java +++ b/library/src/org/whispersystems/textsecure/storage/TextSecureSessionStore.java @@ -41,7 +41,7 @@ public class TextSecureSessionStore implements SessionStore { } @Override - public SessionRecord load(long recipientId, int deviceId) { + public SessionRecord loadSession(long recipientId, int deviceId) { synchronized (FILE_LOCK) { try { MasterCipher cipher = new MasterCipher(masterSecret); @@ -73,7 +73,7 @@ public class TextSecureSessionStore implements SessionStore { } @Override - public void store(long recipientId, int deviceId, SessionRecord record) { + public void storeSession(long recipientId, int deviceId, SessionRecord record) { synchronized (FILE_LOCK) { try { MasterCipher masterCipher = new MasterCipher(masterSecret); @@ -93,24 +93,24 @@ public class TextSecureSessionStore implements SessionStore { } @Override - public boolean contains(long recipientId, int deviceId) { + public boolean containsSession(long recipientId, int deviceId) { return getSessionFile(recipientId, deviceId).exists() && - load(recipientId, deviceId).getSessionState().hasSenderChain(); + loadSession(recipientId, deviceId).getSessionState().hasSenderChain(); } @Override - public void delete(long recipientId, int deviceId) { + public void deleteSession(long recipientId, int deviceId) { getSessionFile(recipientId, deviceId).delete(); } @Override - public void deleteAll(long recipientId) { + public void deleteAllSessions(long recipientId) { List devices = getSubDeviceSessions(recipientId); - delete(recipientId, RecipientDevice.DEFAULT_DEVICE_ID); + deleteSession(recipientId, RecipientDevice.DEFAULT_DEVICE_ID); for (int device : devices) { - delete(recipientId, device); + deleteSession(recipientId, device); } } diff --git a/src/org/thoughtcrime/securesms/AutoInitiateActivity.java b/src/org/thoughtcrime/securesms/AutoInitiateActivity.java index 74932a61e..7048f5c8a 100644 --- a/src/org/thoughtcrime/securesms/AutoInitiateActivity.java +++ b/src/org/thoughtcrime/securesms/AutoInitiateActivity.java @@ -118,6 +118,6 @@ public class AutoInitiateActivity extends Activity { Recipient recipient) { SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret); - return sessionStore.contains(recipient.getRecipientId(), RecipientDevice.DEFAULT_DEVICE_ID); + return sessionStore.containsSession(recipient.getRecipientId(), RecipientDevice.DEFAULT_DEVICE_ID); } } diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index 526d246ba..54864b085 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -319,8 +319,8 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi SessionStore sessionStore = new TextSecureSessionStore(this, masterSecret); Recipient primaryRecipient = getRecipients() == null ? null : getRecipients().getPrimaryRecipient(); boolean isPushDestination = DirectoryHelper.isPushDestination(this, getRecipients()); - boolean isSecureDestination = isSingleConversation() && sessionStore.contains(primaryRecipient.getRecipientId(), - RecipientDevice.DEFAULT_DEVICE_ID); + boolean isSecureDestination = isSingleConversation() && sessionStore.containsSession(primaryRecipient.getRecipientId(), + RecipientDevice.DEFAULT_DEVICE_ID); getMenuInflater().inflate(R.menu.conversation_button_context, menu); @@ -693,8 +693,8 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi SessionStore sessionStore = new TextSecureSessionStore(this, masterSecret); Recipient primaryRecipient = getRecipients() == null ? null : getRecipients().getPrimaryRecipient(); boolean isPushDestination = DirectoryHelper.isPushDestination(this, getRecipients()); - boolean isSecureDestination = isSingleConversation() && sessionStore.contains(primaryRecipient.getRecipientId(), - RecipientDevice.DEFAULT_DEVICE_ID); + boolean isSecureDestination = isSingleConversation() && sessionStore.containsSession(primaryRecipient.getRecipientId(), + RecipientDevice.DEFAULT_DEVICE_ID); if (isPushDestination || isSecureDestination) { this.isEncryptedConversation = true; diff --git a/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java b/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java index 2d9e7ee92..b97e944d3 100644 --- a/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java +++ b/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java @@ -183,8 +183,8 @@ public class VerifyIdentityActivity extends KeyScanningActivity { private IdentityKey getRemoteIdentityKey(MasterSecret masterSecret, Recipient recipient) { SessionStore sessionStore = new TextSecureSessionStore(this, masterSecret); - SessionRecord record = sessionStore.load(recipient.getRecipientId(), - RecipientDevice.DEFAULT_DEVICE_ID); + SessionRecord record = sessionStore.loadSession(recipient.getRecipientId(), + RecipientDevice.DEFAULT_DEVICE_ID); if (record == null) { return null; diff --git a/src/org/thoughtcrime/securesms/crypto/DecryptingQueue.java b/src/org/thoughtcrime/securesms/crypto/DecryptingQueue.java index 435b11ae7..ab2f361be 100644 --- a/src/org/thoughtcrime/securesms/crypto/DecryptingQueue.java +++ b/src/org/thoughtcrime/securesms/crypto/DecryptingQueue.java @@ -205,7 +205,7 @@ public class DecryptingQueue { Recipient recipient = recipients.getPrimaryRecipient(); RecipientDevice recipientDevice = new RecipientDevice(recipient.getRecipientId(), message.getSourceDevice()); - if (!sessionStore.contains(recipientDevice.getRecipientId(), recipientDevice.getDeviceId())) { + if (!sessionStore.containsSession(recipientDevice.getRecipientId(), recipientDevice.getDeviceId())) { sendResult(PushReceiver.RESULT_NO_SESSION); return; } @@ -280,7 +280,7 @@ public class DecryptingQueue { return; } - if (!sessionStore.contains(recipientDevice.getRecipientId(), recipientDevice.getDeviceId())) { + if (!sessionStore.containsSession(recipientDevice.getRecipientId(), recipientDevice.getDeviceId())) { Log.w("DecryptingQueue", "No such recipient session for MMS..."); database.markAsNoSession(messageId, threadId); return; @@ -371,7 +371,7 @@ public class DecryptingQueue { SmsTransportDetails transportDetails = new SmsTransportDetails(); byte[] decodedCiphertext = transportDetails.getDecodedMessage(body.getBytes()); - if (!sessionStore.contains(recipientDevice.getRecipientId(), recipientDevice.getDeviceId())) { + if (!sessionStore.containsSession(recipientDevice.getRecipientId(), recipientDevice.getDeviceId())) { if (WhisperMessage.isLegacy(decodedCiphertext)) database.markAsLegacyVersion(messageId); else database.markAsNoSession(messageId); return; @@ -384,9 +384,9 @@ public class DecryptingQueue { if (isEndSession && "TERMINATE".equals(plaintextBody) && - sessionStore.contains(recipientDevice.getRecipientId(), recipientDevice.getDeviceId())) + sessionStore.containsSession(recipientDevice.getRecipientId(), recipientDevice.getDeviceId())) { - sessionStore.delete(recipientDevice.getRecipientId(), recipientDevice.getDeviceId()); + sessionStore.deleteSession(recipientDevice.getRecipientId(), recipientDevice.getDeviceId()); } } catch (InvalidMessageException | IOException | RecipientFormattingException e) { Log.w("DecryptionQueue", e); diff --git a/src/org/thoughtcrime/securesms/crypto/KeyExchangeInitiator.java b/src/org/thoughtcrime/securesms/crypto/KeyExchangeInitiator.java index 527cb6716..729752ac3 100644 --- a/src/org/thoughtcrime/securesms/crypto/KeyExchangeInitiator.java +++ b/src/org/thoughtcrime/securesms/crypto/KeyExchangeInitiator.java @@ -28,6 +28,7 @@ import org.thoughtcrime.securesms.sms.OutgoingKeyExchangeMessage; import org.thoughtcrime.securesms.util.Dialogs; import org.whispersystems.libaxolotl.SessionBuilder; import org.whispersystems.libaxolotl.protocol.KeyExchangeMessage; +import org.whispersystems.libaxolotl.state.DeviceKeyStore; import org.whispersystems.libaxolotl.state.IdentityKeyStore; import org.whispersystems.libaxolotl.state.PreKeyStore; import org.whispersystems.libaxolotl.state.SessionRecord; @@ -62,10 +63,11 @@ public class KeyExchangeInitiator { private static void initiateKeyExchange(Context context, MasterSecret masterSecret, Recipient recipient) { SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret); PreKeyStore preKeyStore = new TextSecurePreKeyStore(context, masterSecret); + DeviceKeyStore deviceKeyStore = new TextSecurePreKeyStore(context, masterSecret); IdentityKeyStore identityKeyStore = new TextSecureIdentityKeyStore(context, masterSecret); - SessionBuilder sessionBuilder = new SessionBuilder(sessionStore, preKeyStore, identityKeyStore, - recipient.getRecipientId(), + SessionBuilder sessionBuilder = new SessionBuilder(sessionStore, preKeyStore, deviceKeyStore, + identityKeyStore, recipient.getRecipientId(), RecipientDevice.DEFAULT_DEVICE_ID); KeyExchangeMessage keyExchangeMessage = sessionBuilder.process(); @@ -79,7 +81,7 @@ public class KeyExchangeInitiator { Recipient recipient) { SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret); - SessionRecord sessionRecord = sessionStore.load(recipient.getRecipientId(), RecipientDevice.DEFAULT_DEVICE_ID); + SessionRecord sessionRecord = sessionStore.loadSession(recipient.getRecipientId(), RecipientDevice.DEFAULT_DEVICE_ID); return sessionRecord.getSessionState().hasPendingPreKey(); } diff --git a/src/org/thoughtcrime/securesms/crypto/KeyExchangeProcessor.java b/src/org/thoughtcrime/securesms/crypto/KeyExchangeProcessor.java index 5ce12a56b..4c37e785c 100644 --- a/src/org/thoughtcrime/securesms/crypto/KeyExchangeProcessor.java +++ b/src/org/thoughtcrime/securesms/crypto/KeyExchangeProcessor.java @@ -15,7 +15,9 @@ import org.whispersystems.libaxolotl.StaleKeyExchangeException; import org.whispersystems.libaxolotl.UntrustedIdentityException; import org.whispersystems.libaxolotl.protocol.KeyExchangeMessage; import org.whispersystems.libaxolotl.protocol.PreKeyWhisperMessage; +import org.whispersystems.libaxolotl.state.DeviceKeyStore; import org.whispersystems.libaxolotl.state.IdentityKeyStore; +import org.whispersystems.libaxolotl.state.PreKeyBundle; import org.whispersystems.libaxolotl.state.PreKeyStore; import org.whispersystems.libaxolotl.state.SessionStore; import org.whispersystems.textsecure.crypto.MasterSecret; @@ -48,10 +50,11 @@ public class KeyExchangeProcessor { IdentityKeyStore identityKeyStore = new TextSecureIdentityKeyStore(context, masterSecret); PreKeyStore preKeyStore = new TextSecurePreKeyStore(context, masterSecret); + DeviceKeyStore deviceKeyStore = new TextSecurePreKeyStore(context, masterSecret); SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret); - this.sessionBuilder = new SessionBuilder(sessionStore, preKeyStore, identityKeyStore, - recipientDevice.getRecipientId(), + this.sessionBuilder = new SessionBuilder(sessionStore, preKeyStore, deviceKeyStore, + identityKeyStore, recipientDevice.getRecipientId(), recipientDevice.getDeviceId()); } @@ -62,10 +65,10 @@ public class KeyExchangeProcessor { PreKeyService.initiateRefresh(context, masterSecret); } - public void processKeyExchangeMessage(PreKeyEntity message, long threadId) + public void processKeyExchangeMessage(PreKeyBundle bundle, long threadId) throws InvalidKeyException, UntrustedIdentityException { - sessionBuilder.process(message); + sessionBuilder.process(bundle); if (threadId != -1) { broadcastSecurityUpdateEvent(context, threadId); diff --git a/src/org/thoughtcrime/securesms/service/PreKeyService.java b/src/org/thoughtcrime/securesms/service/PreKeyService.java index 034a27b77..0e09e5042 100644 --- a/src/org/thoughtcrime/securesms/service/PreKeyService.java +++ b/src/org/thoughtcrime/securesms/service/PreKeyService.java @@ -10,12 +10,19 @@ import org.thoughtcrime.securesms.crypto.IdentityKeyUtil; import org.thoughtcrime.securesms.push.PushServiceSocketFactory; import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.whispersystems.libaxolotl.IdentityKey; +import org.whispersystems.libaxolotl.IdentityKeyPair; +import org.whispersystems.libaxolotl.state.DeviceKeyRecord; +import org.whispersystems.libaxolotl.state.DeviceKeyStore; import org.whispersystems.libaxolotl.state.PreKeyRecord; import org.whispersystems.textsecure.crypto.MasterSecret; import org.whispersystems.textsecure.crypto.PreKeyUtil; import org.whispersystems.textsecure.push.PushServiceSocket; +import org.whispersystems.textsecure.storage.TextSecurePreKeyStore; import java.io.IOException; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Iterator; import java.util.List; import java.util.concurrent.Executor; import java.util.concurrent.Executors; @@ -62,6 +69,8 @@ public class PreKeyService extends Service { } public void run() { + DeviceKeyRecord deviceKeyRecord = null; + try { if (!TextSecurePreferences.isPushRegistered(context)) return; @@ -75,13 +84,60 @@ public class PreKeyService extends Service { List preKeyRecords = PreKeyUtil.generatePreKeys(context, masterSecret); PreKeyRecord lastResortKeyRecord = PreKeyUtil.generateLastResortKey(context, masterSecret); - IdentityKey identityKey = IdentityKeyUtil.getIdentityKey(context); + IdentityKeyPair identityKey = IdentityKeyUtil.getIdentityKeyPair(context, masterSecret); + + deviceKeyRecord = PreKeyUtil.generateDeviceKey(context, masterSecret, identityKey); Log.w(TAG, "Registering new prekeys..."); - socket.registerPreKeys(identityKey, lastResortKeyRecord, preKeyRecords); + socket.registerPreKeys(identityKey.getPublicKey(), lastResortKeyRecord, + deviceKeyRecord, preKeyRecords); + + removeOldDeviceKeysIfNecessary(deviceKeyRecord); } catch (IOException e) { Log.w(TAG, e); + if (deviceKeyRecord != null) { + Log.w(TAG, "Remote store failed, removing generated device key: " + deviceKeyRecord.getId()); + new TextSecurePreKeyStore(context, masterSecret).removeDeviceKey(deviceKeyRecord.getId()); + } + } + } + + private void removeOldDeviceKeysIfNecessary(DeviceKeyRecord currentDeviceKey) { + DeviceKeyStore deviceKeyStore = new TextSecurePreKeyStore(context, masterSecret); + List records = deviceKeyStore.loadDeviceKeys(); + Iterator iterator = records.iterator(); + + while (iterator.hasNext()) { + if (iterator.next().getId() == currentDeviceKey.getId()) { + iterator.remove(); + } + } + + DeviceKeyRecord[] recordsArray = (DeviceKeyRecord[])records.toArray(); + Arrays.sort(recordsArray, new Comparator() { + @Override + public int compare(DeviceKeyRecord lhs, DeviceKeyRecord rhs) { + if (lhs.getTimestamp() < rhs.getTimestamp()) return -1; + else if (lhs.getTimestamp() > rhs.getTimestamp()) return 1; + else return 0; + } + }); + + Log.w(TAG, "Existing device key record count: " + recordsArray.length); + + if (recordsArray.length > 3) { + long oldTimestamp = System.currentTimeMillis() - (14 * 24 * 60 * 60 * 1000); + DeviceKeyRecord[] oldRecords = Arrays.copyOf(recordsArray, recordsArray.length - 1); + + for (DeviceKeyRecord oldRecord : oldRecords) { + Log.w(TAG, "Old device key record timestamp: " + oldRecord.getTimestamp()); + + if (oldRecord.getTimestamp() <= oldTimestamp) { + Log.w(TAG, "Remove device key record: " + oldRecord.getId()); + deviceKeyStore.removeDeviceKey(oldRecord.getId()); + } + } } } } diff --git a/src/org/thoughtcrime/securesms/service/PushReceiver.java b/src/org/thoughtcrime/securesms/service/PushReceiver.java index 81f8d073d..0fbf3f5be 100644 --- a/src/org/thoughtcrime/securesms/service/PushReceiver.java +++ b/src/org/thoughtcrime/securesms/service/PushReceiver.java @@ -185,7 +185,7 @@ public class PushReceiver { database.updateMessageBody(masterSecret, messageAndThreadId.first, messageContent.getBody()); SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret); - sessionStore.deleteAll(recipient.getRecipientId()); + sessionStore.deleteAllSessions(recipient.getRecipientId()); KeyExchangeProcessor.broadcastSecurityUpdateEvent(context, messageAndThreadId.second); } catch (RecipientFormattingException e) { diff --git a/src/org/thoughtcrime/securesms/service/RegistrationService.java b/src/org/thoughtcrime/securesms/service/RegistrationService.java index 43c4d255b..e16286c24 100644 --- a/src/org/thoughtcrime/securesms/service/RegistrationService.java +++ b/src/org/thoughtcrime/securesms/service/RegistrationService.java @@ -17,7 +17,8 @@ import org.thoughtcrime.securesms.crypto.IdentityKeyUtil; import org.thoughtcrime.securesms.push.PushServiceSocketFactory; import org.thoughtcrime.securesms.util.DirectoryHelper; import org.thoughtcrime.securesms.util.TextSecurePreferences; -import org.whispersystems.libaxolotl.IdentityKey; +import org.whispersystems.libaxolotl.IdentityKeyPair; +import org.whispersystems.libaxolotl.state.DeviceKeyRecord; import org.whispersystems.libaxolotl.state.PreKeyRecord; import org.whispersystems.libaxolotl.util.KeyHelper; import org.whispersystems.textsecure.crypto.MasterSecret; @@ -227,10 +228,11 @@ public class RegistrationService extends Service { throws IOException { setState(new RegistrationState(RegistrationState.STATE_GENERATING_KEYS, number)); - IdentityKey identityKey = IdentityKeyUtil.getIdentityKey(this); + IdentityKeyPair identityKey = IdentityKeyUtil.getIdentityKeyPair(this, masterSecret); List records = PreKeyUtil.generatePreKeys(this, masterSecret); PreKeyRecord lastResort = PreKeyUtil.generateLastResortKey(this, masterSecret); - socket.registerPreKeys(identityKey, lastResort, records); + DeviceKeyRecord deviceKey = PreKeyUtil.generateDeviceKey(this, masterSecret, identityKey); + socket.registerPreKeys(identityKey.getPublicKey(), lastResort, deviceKey, records); setState(new RegistrationState(RegistrationState.STATE_GCM_REGISTERING, number)); diff --git a/src/org/thoughtcrime/securesms/service/SmsSender.java b/src/org/thoughtcrime/securesms/service/SmsSender.java index 696be3abc..3deafac2e 100644 --- a/src/org/thoughtcrime/securesms/service/SmsSender.java +++ b/src/org/thoughtcrime/securesms/service/SmsSender.java @@ -140,7 +140,7 @@ public class SmsSender { if (record != null && record.isEndSession()) { Log.w("SmsSender", "Ending session..."); SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret); - sessionStore.deleteAll(record.getIndividualRecipient().getRecipientId()); + sessionStore.deleteAllSessions(record.getIndividualRecipient().getRecipientId()); KeyExchangeProcessor.broadcastSecurityUpdateEvent(context, record.getThreadId()); } diff --git a/src/org/thoughtcrime/securesms/transport/PushTransport.java b/src/org/thoughtcrime/securesms/transport/PushTransport.java index f62f215a6..a20230779 100644 --- a/src/org/thoughtcrime/securesms/transport/PushTransport.java +++ b/src/org/thoughtcrime/securesms/transport/PushTransport.java @@ -37,6 +37,7 @@ import org.thoughtcrime.securesms.util.Util; import org.whispersystems.libaxolotl.InvalidKeyException; import org.whispersystems.libaxolotl.SessionCipher; import org.whispersystems.libaxolotl.protocol.CiphertextMessage; +import org.whispersystems.libaxolotl.state.PreKeyBundle; import org.whispersystems.libaxolotl.state.SessionStore; import org.whispersystems.textsecure.crypto.AttachmentCipher; import org.whispersystems.textsecure.crypto.MasterSecret; @@ -45,7 +46,6 @@ import org.whispersystems.textsecure.push.MismatchedDevices; import org.whispersystems.textsecure.push.MismatchedDevicesException; import org.whispersystems.textsecure.push.OutgoingPushMessage; import org.whispersystems.textsecure.push.OutgoingPushMessageList; -import org.whispersystems.textsecure.push.PreKeyEntity; import org.whispersystems.textsecure.push.PushAddress; import org.whispersystems.textsecure.push.PushAttachmentData; import org.whispersystems.textsecure.push.PushAttachmentPointer; @@ -95,7 +95,7 @@ public class PushTransport extends BaseTransport { if (message.isEndSession()) { SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret); - sessionStore.deleteAll(recipient.getRecipientId()); + sessionStore.deleteAllSessions(recipient.getRecipientId()); KeyExchangeProcessor.broadcastSecurityUpdateEvent(context, threadId); } @@ -205,12 +205,12 @@ public class PushTransport extends BaseTransport { long recipientId = recipient.getRecipientId(); for (int extraDeviceId : mismatchedDevices.getExtraDevices()) { - sessionStore.delete(recipientId, extraDeviceId); + sessionStore.deleteSession(recipientId, extraDeviceId); } for (int missingDeviceId : mismatchedDevices.getMissingDevices()) { - PushAddress address = PushAddress.create(context, recipientId, e164number, missingDeviceId); - PreKeyEntity preKey = socket.getPreKey(address); + PushAddress address = PushAddress.create(context, recipientId, e164number, missingDeviceId); + PreKeyBundle preKey = socket.getPreKey(address); KeyExchangeProcessor processor = new KeyExchangeProcessor(context, masterSecret, address); try { @@ -230,7 +230,7 @@ public class PushTransport extends BaseTransport { long recipientId = recipient.getRecipientId(); for (int staleDeviceId : staleDevices.getStaleDevices()) { - sessionStore.delete(recipientId, staleDeviceId); + sessionStore.deleteSession(recipientId, staleDeviceId); } } @@ -327,10 +327,10 @@ public class PushTransport extends BaseTransport { { if (!SessionUtil.hasEncryptCapableSession(context, masterSecret, pushAddress)) { try { - List preKeys = socket.getPreKeys(pushAddress); + List preKeys = socket.getPreKeys(pushAddress); - for (PreKeyEntity preKey : preKeys) { - PushAddress device = PushAddress.create(context, pushAddress.getRecipientId(), pushAddress.getNumber(), preKey.getDeviceId()); + for (PreKeyBundle preKey : preKeys) { + PushAddress device = PushAddress.create(context, pushAddress.getRecipientId(), pushAddress.getNumber(), preKey.getDeviceId()); KeyExchangeProcessor processor = new KeyExchangeProcessor(context, masterSecret, device); try {