Sync Protocol Buffers with libsignal-service-java
(#2046)
Synchronizes our protocol buffers with `libsignal-service-java` project.
**Changes**
- [x] **BREAKING:** Rename `package` from `textsecure` to `signalservice`.
⚠️~~Workaround: Rename back to `textsecure`.~~
Changed all protobuf `package` names across our project.
- [x] Rename `java_` metadata.
- [x] Move `NullMessage`, `ReceiptMessage`, and `Verified`.
- [x] Rename `Contacts.isComplete` to `Contacts.complete`. Confirmed to be
unreferenced in our project.
- [x] Rename `Settings` to `Configuration` (`textsecure.protobuf.Settings` seems
to be unused)
- [x] Rename `libtextsecure` `MessageReceiver` `settings` event to
`configuration`.
- [x] Rename `ReceiptMessage.timestamps` to `ReceiptMessage.timestamp`.
- [x] Add `AttachmentPointer` `width` and `height`.
- [x] Renamed `IncomingPushMessageSignal.proto` to `SignalService.proto` to
match server.
---
commit 2b6aa19bf9ea5d8f2f4fd9e4102699a9d06a2b45
Author: Daniel Gasienica <daniel@gasienica.ch>
Date: Wed Feb 14 19:41:24 2018 -0500
Rename protobuf `package`: `textsecure` --> `signalservice`
Brings us closer to `libsignal-service-java`.
commit 91612880a5bf2c9ae8a9334877ac24e91102b905
Author: Daniel Gasienica <daniel@gasienica.ch>
Date: Wed Feb 14 19:19:35 2018 -0500
Rename `SyncMessage.Settings` to `SyncMessage.Configuration`
commit 848eb9559928c54dffd3426bba8e7cd7b1687cdc
Author: Daniel Gasienica <daniel@gasienica.ch>
Date: Tue Feb 13 20:16:43 2018 -0500
Rename `ReadReceipt` `timestamps` --> `timestamp`
commit 39859e64b41ddf41127b52d963fe7cc2b9fcad68
Author: Daniel Gasienica <daniel@gasienica.ch>
Date: Wed Feb 14 18:43:42 2018 -0500
Rename `IncomingPushMessageSignal.proto` to `SignalService.proto`
This matches the `libsignal-service-java` filename.
commit fd4bfd76af57ffa44178caf21d350cca211dc048
Author: Daniel Gasienica <daniel@gasienica.ch>
Date: Tue Feb 13 16:24:36 2018 -0500
Revert protobuf `package` to `textsecure`
This was a breaking change and would need to be introduced with additional
changes.
commit 9f618fa91717a0349f1ea28bf6d365ef0a5c9ca5
Author: Daniel Gasienica <daniel@gasienica.ch>
Date: Tue Feb 13 16:09:55 2018 -0500
Sync service protocol buffers with Java project
Snapshot: 4684a49b2e/protobuf/SignalService.proto
This commit is contained in:
parent
3a159d5cb8
commit
b6ef67c402
8 changed files with 70 additions and 70 deletions
|
@ -272,7 +272,7 @@
|
||||||
messageReceiver.addEventListener('error', onError);
|
messageReceiver.addEventListener('error', onError);
|
||||||
messageReceiver.addEventListener('empty', onEmpty);
|
messageReceiver.addEventListener('empty', onEmpty);
|
||||||
messageReceiver.addEventListener('progress', onProgress);
|
messageReceiver.addEventListener('progress', onProgress);
|
||||||
messageReceiver.addEventListener('settings', onSettings);
|
messageReceiver.addEventListener('configuration', onConfiguration);
|
||||||
|
|
||||||
window.textsecure.messaging = new textsecure.MessageSender(
|
window.textsecure.messaging = new textsecure.MessageSender(
|
||||||
SERVER_URL, USERNAME, PASSWORD, CDN_URL
|
SERVER_URL, USERNAME, PASSWORD, CDN_URL
|
||||||
|
@ -351,12 +351,8 @@
|
||||||
view.onProgress(count);
|
view.onProgress(count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onSettings(ev) {
|
function onConfiguration(ev) {
|
||||||
if (ev.settings.readReceipts) {
|
storage.put('read-receipt-setting', ev.configuration.readReceipts);
|
||||||
storage.put('read-receipt-setting', true);
|
|
||||||
} else {
|
|
||||||
storage.put('read-receipt-setting', false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onContactReceived(ev) {
|
function onContactReceived(ev) {
|
||||||
|
|
|
@ -558,23 +558,23 @@ MessageReceiver.prototype.extend({
|
||||||
handleReceiptMessage: function(envelope, receiptMessage) {
|
handleReceiptMessage: function(envelope, receiptMessage) {
|
||||||
var results = [];
|
var results = [];
|
||||||
if (receiptMessage.type === textsecure.protobuf.ReceiptMessage.Type.DELIVERY) {
|
if (receiptMessage.type === textsecure.protobuf.ReceiptMessage.Type.DELIVERY) {
|
||||||
for (var i = 0; i < receiptMessage.timestamps.length; ++i) {
|
for (var i = 0; i < receiptMessage.timestamp.length; ++i) {
|
||||||
var ev = new Event('delivery');
|
var ev = new Event('delivery');
|
||||||
ev.confirm = this.removeFromCache.bind(this, envelope);
|
ev.confirm = this.removeFromCache.bind(this, envelope);
|
||||||
ev.deliveryReceipt = {
|
ev.deliveryReceipt = {
|
||||||
timestamp : receiptMessage.timestamps[i].toNumber(),
|
timestamp : receiptMessage.timestamp[i].toNumber(),
|
||||||
source : envelope.source,
|
source : envelope.source,
|
||||||
sourceDevice : envelope.sourceDevice
|
sourceDevice : envelope.sourceDevice
|
||||||
};
|
};
|
||||||
results.push(this.dispatchAndWait(ev));
|
results.push(this.dispatchAndWait(ev));
|
||||||
}
|
}
|
||||||
} else if (receiptMessage.type === textsecure.protobuf.ReceiptMessage.Type.READ) {
|
} else if (receiptMessage.type === textsecure.protobuf.ReceiptMessage.Type.READ) {
|
||||||
for (var i = 0; i < receiptMessage.timestamps.length; ++i) {
|
for (var i = 0; i < receiptMessage.timestamp.length; ++i) {
|
||||||
var ev = new Event('read');
|
var ev = new Event('read');
|
||||||
ev.confirm = this.removeFromCache.bind(this, envelope);
|
ev.confirm = this.removeFromCache.bind(this, envelope);
|
||||||
ev.timestamp = envelope.timestamp.toNumber();
|
ev.timestamp = envelope.timestamp.toNumber();
|
||||||
ev.read = {
|
ev.read = {
|
||||||
timestamp : receiptMessage.timestamps[i].toNumber(),
|
timestamp : receiptMessage.timestamp[i].toNumber(),
|
||||||
reader : envelope.source
|
reader : envelope.source
|
||||||
}
|
}
|
||||||
results.push(this.dispatchAndWait(ev));
|
results.push(this.dispatchAndWait(ev));
|
||||||
|
@ -626,17 +626,17 @@ MessageReceiver.prototype.extend({
|
||||||
return this.handleRead(envelope, syncMessage.read);
|
return this.handleRead(envelope, syncMessage.read);
|
||||||
} else if (syncMessage.verified) {
|
} else if (syncMessage.verified) {
|
||||||
return this.handleVerified(envelope, syncMessage.verified);
|
return this.handleVerified(envelope, syncMessage.verified);
|
||||||
} else if (syncMessage.settings) {
|
} else if (syncMessage.configuration) {
|
||||||
return this.handleSettings(envelope, syncMessage.settings);
|
return this.handleConfiguration(envelope, syncMessage.configuration);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Got empty SyncMessage');
|
throw new Error('Got empty SyncMessage');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSettings: function(envelope, settings) {
|
handleConfiguration: function(envelope, configuration) {
|
||||||
var ev = new Event('settings');
|
var ev = new Event('configuration');
|
||||||
ev.confirm = this.removeFromCache.bind(this, envelope);
|
ev.confirm = this.removeFromCache.bind(this, envelope);
|
||||||
ev.settings = {
|
ev.configuration = {
|
||||||
readReceipts: settings.readReceipts
|
readReceipts: configuration.readReceipts
|
||||||
};
|
};
|
||||||
return this.dispatchAndWait(ev);
|
return this.dispatchAndWait(ev);
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
console.log(text);
|
console.log(text);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
var protos = result.build('textsecure');
|
var protos = result.build('signalservice');
|
||||||
if (!protos) {
|
if (!protos) {
|
||||||
var text = 'Error loading protos from ' + filename + ' (root: ' + window.PROTO_ROOT + ')';
|
var text = 'Error loading protos from ' + filename + ' (root: ' + window.PROTO_ROOT + ')';
|
||||||
console.log(text);
|
console.log(text);
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
loadProtoBufs('IncomingPushMessageSignal.proto');
|
loadProtoBufs('SignalService.proto');
|
||||||
loadProtoBufs('SubProtocol.proto');
|
loadProtoBufs('SubProtocol.proto');
|
||||||
loadProtoBufs('DeviceMessages.proto');
|
loadProtoBufs('DeviceMessages.proto');
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -388,7 +388,7 @@ MessageSender.prototype = {
|
||||||
sendReadReceipts: function(sender, timestamps) {
|
sendReadReceipts: function(sender, timestamps) {
|
||||||
var receiptMessage = new textsecure.protobuf.ReceiptMessage();
|
var receiptMessage = new textsecure.protobuf.ReceiptMessage();
|
||||||
receiptMessage.type = textsecure.protobuf.ReceiptMessage.Type.READ;
|
receiptMessage.type = textsecure.protobuf.ReceiptMessage.Type.READ;
|
||||||
receiptMessage.timestamps = timestamps;
|
receiptMessage.timestamp = timestamps;
|
||||||
|
|
||||||
var contentMessage = new textsecure.protobuf.Content();
|
var contentMessage = new textsecure.protobuf.Content();
|
||||||
contentMessage.receiptMessage = receiptMessage;
|
contentMessage.receiptMessage = receiptMessage;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package textsecure;
|
package signalservice;
|
||||||
|
|
||||||
message ProvisioningUuid {
|
message ProvisioningUuid {
|
||||||
optional string uuid = 1;
|
optional string uuid = 1;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package textsecure;
|
// Source: https://github.com/signalapp/libsignal-service-java/blob/4684a49b2ed8f32be619e0d0eea423626b6cb2cb/protobuf/SignalService.proto
|
||||||
|
package signalservice;
|
||||||
|
|
||||||
option java_package = "org.whispersystems.textsecure.internal.push";
|
option java_package = "org.whispersystems.signalservice.internal.push";
|
||||||
option java_outer_classname = "TextSecureProtos";
|
option java_outer_classname = "SignalServiceProtos";
|
||||||
|
|
||||||
message Envelope {
|
message Envelope {
|
||||||
enum Type {
|
enum Type {
|
||||||
|
@ -22,40 +23,13 @@ message Envelope {
|
||||||
}
|
}
|
||||||
|
|
||||||
message Content {
|
message Content {
|
||||||
optional DataMessage dataMessage = 1;
|
optional DataMessage dataMessage = 1;
|
||||||
optional SyncMessage syncMessage = 2;
|
optional SyncMessage syncMessage = 2;
|
||||||
optional CallMessage callMessage = 3;
|
optional CallMessage callMessage = 3;
|
||||||
optional NullMessage nullMessage = 4;
|
optional NullMessage nullMessage = 4;
|
||||||
optional ReceiptMessage receiptMessage = 5;
|
optional ReceiptMessage receiptMessage = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ReceiptMessage {
|
|
||||||
enum Type {
|
|
||||||
DELIVERY = 0;
|
|
||||||
READ = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
optional Type type = 1;
|
|
||||||
repeated uint64 timestamps = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message NullMessage {
|
|
||||||
optional bytes padding = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Verified {
|
|
||||||
enum State {
|
|
||||||
DEFAULT = 0;
|
|
||||||
VERIFIED = 1;
|
|
||||||
UNVERIFIED = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
optional string destination = 1;
|
|
||||||
optional bytes identityKey = 2;
|
|
||||||
optional State state = 3;
|
|
||||||
optional bytes nullMessage = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CallMessage {
|
message CallMessage {
|
||||||
message Offer {
|
message Offer {
|
||||||
optional uint64 id = 1;
|
optional uint64 id = 1;
|
||||||
|
@ -92,7 +66,7 @@ message CallMessage {
|
||||||
|
|
||||||
message DataMessage {
|
message DataMessage {
|
||||||
enum Flags {
|
enum Flags {
|
||||||
END_SESSION = 1;
|
END_SESSION = 1;
|
||||||
EXPIRATION_TIMER_UPDATE = 2;
|
EXPIRATION_TIMER_UPDATE = 2;
|
||||||
PROFILE_KEY_UPDATE = 4;
|
PROFILE_KEY_UPDATE = 4;
|
||||||
}
|
}
|
||||||
|
@ -103,6 +77,34 @@ message DataMessage {
|
||||||
optional uint32 flags = 4;
|
optional uint32 flags = 4;
|
||||||
optional uint32 expireTimer = 5;
|
optional uint32 expireTimer = 5;
|
||||||
optional bytes profileKey = 6;
|
optional bytes profileKey = 6;
|
||||||
|
optional uint64 timestamp = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message NullMessage {
|
||||||
|
optional bytes padding = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ReceiptMessage {
|
||||||
|
enum Type {
|
||||||
|
DELIVERY = 0;
|
||||||
|
READ = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
optional Type type = 1;
|
||||||
|
repeated uint64 timestamp = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Verified {
|
||||||
|
enum State {
|
||||||
|
DEFAULT = 0;
|
||||||
|
VERIFIED = 1;
|
||||||
|
UNVERIFIED = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
optional string destination = 1;
|
||||||
|
optional bytes identityKey = 2;
|
||||||
|
optional State state = 3;
|
||||||
|
optional bytes nullMessage = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SyncMessage {
|
message SyncMessage {
|
||||||
|
@ -115,7 +117,7 @@ message SyncMessage {
|
||||||
|
|
||||||
message Contacts {
|
message Contacts {
|
||||||
optional AttachmentPointer blob = 1;
|
optional AttachmentPointer blob = 1;
|
||||||
optional bool isComplete = 2 [default = false];
|
optional bool complete = 2 [default = false];
|
||||||
}
|
}
|
||||||
|
|
||||||
message Groups {
|
message Groups {
|
||||||
|
@ -143,19 +145,19 @@ message SyncMessage {
|
||||||
optional uint64 timestamp = 2;
|
optional uint64 timestamp = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Settings {
|
message Configuration {
|
||||||
optional bool readReceipts = 1;
|
optional bool readReceipts = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
optional Sent sent = 1;
|
optional Sent sent = 1;
|
||||||
optional Contacts contacts = 2;
|
optional Contacts contacts = 2;
|
||||||
optional Groups groups = 3;
|
optional Groups groups = 3;
|
||||||
optional Request request = 4;
|
optional Request request = 4;
|
||||||
repeated Read read = 5;
|
repeated Read read = 5;
|
||||||
optional Blocked blocked = 6;
|
optional Blocked blocked = 6;
|
||||||
optional Verified verified = 7;
|
optional Verified verified = 7;
|
||||||
optional bytes padding = 8;
|
optional Configuration configuration = 9;
|
||||||
optional Settings settings = 9;
|
optional bytes padding = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message AttachmentPointer {
|
message AttachmentPointer {
|
||||||
|
@ -171,6 +173,8 @@ message AttachmentPointer {
|
||||||
optional bytes digest = 6;
|
optional bytes digest = 6;
|
||||||
optional string fileName = 7;
|
optional string fileName = 7;
|
||||||
optional uint32 flags = 8;
|
optional uint32 flags = 8;
|
||||||
|
optional uint32 width = 9;
|
||||||
|
optional uint32 height = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GroupContext {
|
message GroupContext {
|
|
@ -14,7 +14,7 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package textsecure;
|
package signalservice;
|
||||||
|
|
||||||
option java_package = "org.whispersystems.websocket.messages.protobuf";
|
option java_package = "org.whispersystems.websocket.messages.protobuf";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package textsecure;
|
package signalservice;
|
||||||
|
|
||||||
option java_package = "org.whispersystems.libsignal.protocol";
|
option java_package = "org.whispersystems.libsignal.protocol";
|
||||||
option java_outer_classname = "WhisperProtos";
|
option java_outer_classname = "WhisperProtos";
|
||||||
|
|
Loading…
Reference in a new issue