From 2f2d099a133bfa8338e0d77177ccb5524a7fade2 Mon Sep 17 00:00:00 2001 From: "Andrew E. Bruno" Date: Tue, 14 Nov 2017 18:28:10 -0500 Subject: [PATCH] Update to latest signal protocol. - Remove legacy data messages - Add digest for attachment uploads - Update signal protocol buffers --- .gitignore | 1 + attachments.go | 33 +- axolotl/messages.go | 10 +- axolotl/prekeys.go | 2 +- axolotl/protobuf/FingerprintProtocol.pb.go | 88 ++ axolotl/protobuf/FingerprintProtocol.proto | 15 + axolotl/protobuf/LocalStorageProtocol.pb.go | 166 ++- axolotl/protobuf/LocalStorageProtocol.proto | 4 +- axolotl/protobuf/Makefile | 6 + axolotl/protobuf/WhisperTextProtocol.pb.go | 163 ++- axolotl/protobuf/WhisperTextProtocol.proto | 17 +- axolotl/session.go | 10 +- cmd/textsecure/main.go | 4 +- crypto.go | 8 +- groups.go | 20 +- prekeys.go | 4 +- protobuf/Makefile | 3 + protobuf/Provisioning.pb.go | 72 +- protobuf/Provisioning.proto | 13 +- protobuf/SignalService.pb.go | 1422 +++++++++++++++++++ protobuf/SignalService.proto | 223 +++ protobuf/TextSecure.pb.go | 686 --------- protobuf/TextSecure.proto | 121 -- protobuf/WebSocketResources.pb.go | 107 +- protobuf/WebSocketResources.proto | 30 +- server.go | 41 +- store.go | 2 +- sync.go | 30 +- textsecure.go | 59 +- transport.go | 8 +- websocket.go | 10 +- 31 files changed, 2322 insertions(+), 1056 deletions(-) create mode 100644 .gitignore create mode 100644 axolotl/protobuf/FingerprintProtocol.pb.go create mode 100644 axolotl/protobuf/FingerprintProtocol.proto create mode 100644 axolotl/protobuf/Makefile create mode 100644 protobuf/Makefile create mode 100644 protobuf/SignalService.pb.go create mode 100644 protobuf/SignalService.proto delete mode 100644 protobuf/TextSecure.pb.go delete mode 100644 protobuf/TextSecure.proto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1184bfe --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +cmd/textsecure/textsecure diff --git a/attachments.go b/attachments.go index a6fe3d9..ac54f0c 100644 --- a/attachments.go +++ b/attachments.go @@ -5,6 +5,7 @@ package textsecure import ( "bytes" + "crypto/sha256" "errors" "fmt" "io" @@ -12,13 +13,13 @@ import ( "net/http" "strconv" - "github.com/janimo/textsecure/protobuf" + textsecure "github.com/aebruno/textsecure/protobuf" ) // getAttachment downloads an encrypted attachment blob from the given URL func getAttachment(url string) (io.ReadCloser, error) { req, err := http.NewRequest("GET", url, nil) - req.Header.Add("Content-type", "application/octet-stream") + req.Header.Add("Content-Type", "application/octet-stream") resp, err := http.DefaultClient.Do(req) if err != nil { return nil, err @@ -28,21 +29,25 @@ func getAttachment(url string) (io.ReadCloser, error) { } // putAttachment uploads an encrypted attachment to the given URL -func putAttachment(url string, body []byte) error { +func putAttachment(url string, body []byte) ([]byte, error) { br := bytes.NewReader(body) req, err := http.NewRequest("PUT", url, br) if err != nil { - return err + return nil, err } - req.Header.Add("Content-type", "application/octet-stream") - req.Header.Add("Content-length", strconv.Itoa(len(body))) + req.Header.Add("Content-Type", "application/octet-stream") + req.Header.Add("Content-Length", strconv.Itoa(len(body))) resp, err := http.DefaultClient.Do(req) - if resp != nil && (resp.StatusCode < 200 || resp.StatusCode >= 300) { - return fmt.Errorf("HTTP status %d\n", resp.StatusCode) + return nil, fmt.Errorf("HTTP status %d\n", resp.StatusCode) } - return err + defer resp.Body.Close() + + hasher := sha256.New() + hasher.Write(body) + + return hasher.Sum(nil), nil } // uploadAttachment encrypts, authenticates and uploads a given attachment to a location requested from the server @@ -56,6 +61,8 @@ func uploadAttachment(r io.Reader, ct string) (*att, error) { return nil, err } + plaintextLength := len(b) + e, err := aesEncrypt(keys[:32], b) if err != nil { return nil, err @@ -67,11 +74,12 @@ func uploadAttachment(r io.Reader, ct string) (*att, error) { if err != nil { return nil, err } - err = putAttachment(location, m) + digest, err := putAttachment(location, m) if err != nil { return nil, err } - return &att{id, ct, keys}, nil + + return &att{id, ct, keys, digest, uint32(plaintextLength)}, nil } // ErrInvalidMACForAttachment signals that the downloaded attachment has an invalid MAC. @@ -102,6 +110,9 @@ func handleSingleAttachment(a *textsecure.AttachmentPointer) (*Attachment, error if err != nil { return nil, err } + + // TODO: verify digest + return &Attachment{bytes.NewReader(b), a.GetContentType()}, nil } diff --git a/axolotl/messages.go b/axolotl/messages.go index 9ec1084..e4ecc62 100644 --- a/axolotl/messages.go +++ b/axolotl/messages.go @@ -7,7 +7,7 @@ import ( "crypto/hmac" "errors" - protobuf "github.com/janimo/textsecure/axolotl/protobuf" + protobuf "github.com/aebruno/textsecure/axolotl/protobuf" "github.com/golang/protobuf/proto" ) @@ -45,7 +45,7 @@ func LoadWhisperMessage(serialized []byte) (*WhisperMessage, error) { if version != currentVersion { return nil, UnsupportedVersionError{version} } - pwm := &protobuf.WhisperMessage{} + pwm := &protobuf.SignalMessage{} err := proto.Unmarshal(message, pwm) if err != nil { return nil, err @@ -73,7 +73,7 @@ func newWhisperMessage(messageVersion byte, macKey []byte, ratchetKey *ECPublicK version := makeVersionByte(messageVersion, currentVersion) - pwm := &protobuf.WhisperMessage{ + pwm := &protobuf.SignalMessage{ RatchetKey: ratchetKey.Serialize(), Counter: &counter, PreviousCounter: &previousCounter, @@ -148,7 +148,7 @@ func LoadPreKeyWhisperMessage(serialized []byte) (*PreKeyWhisperMessage, error) return nil, UnsupportedVersionError{version} } - ppkwm := &protobuf.PreKeyWhisperMessage{} + ppkwm := &protobuf.PreKeySignalMessage{} err := proto.Unmarshal(serialized[1:], ppkwm) if err != nil { return nil, err @@ -181,7 +181,7 @@ func LoadPreKeyWhisperMessage(serialized []byte) (*PreKeyWhisperMessage, error) func newPreKeyWhisperMessage(messageVersion byte, registrationID, preKeyID, signedPreKeyID uint32, baseKey *ECPublicKey, identityKey *IdentityKey, wm *WhisperMessage) (*PreKeyWhisperMessage, error) { - ppkwm := &protobuf.PreKeyWhisperMessage{ + ppkwm := &protobuf.PreKeySignalMessage{ RegistrationId: ®istrationID, PreKeyId: &preKeyID, SignedPreKeyId: &signedPreKeyID, diff --git a/axolotl/prekeys.go b/axolotl/prekeys.go index b6e0ebe..7ffd611 100644 --- a/axolotl/prekeys.go +++ b/axolotl/prekeys.go @@ -6,8 +6,8 @@ package axolotl // PreKey and SignedPreKey support import ( + protobuf "github.com/aebruno/textsecure/axolotl/protobuf" "github.com/golang/protobuf/proto" - protobuf "github.com/janimo/textsecure/axolotl/protobuf" ) var maxValue uint32 = 0xFFFFFF diff --git a/axolotl/protobuf/FingerprintProtocol.pb.go b/axolotl/protobuf/FingerprintProtocol.pb.go new file mode 100644 index 0000000..048177c --- /dev/null +++ b/axolotl/protobuf/FingerprintProtocol.pb.go @@ -0,0 +1,88 @@ +// Code generated by protoc-gen-go. +// source: FingerprintProtocol.proto +// DO NOT EDIT! + +package textsecure + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +type LogicalFingerprint struct { + Content []byte `protobuf:"bytes,1,opt,name=content" json:"content,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *LogicalFingerprint) Reset() { *m = LogicalFingerprint{} } +func (m *LogicalFingerprint) String() string { return proto.CompactTextString(m) } +func (*LogicalFingerprint) ProtoMessage() {} +func (*LogicalFingerprint) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } + +func (m *LogicalFingerprint) GetContent() []byte { + if m != nil { + return m.Content + } + return nil +} + +type CombinedFingerprints struct { + Version *uint32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` + LocalFingerprint *LogicalFingerprint `protobuf:"bytes,2,opt,name=localFingerprint" json:"localFingerprint,omitempty"` + RemoteFingerprint *LogicalFingerprint `protobuf:"bytes,3,opt,name=remoteFingerprint" json:"remoteFingerprint,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CombinedFingerprints) Reset() { *m = CombinedFingerprints{} } +func (m *CombinedFingerprints) String() string { return proto.CompactTextString(m) } +func (*CombinedFingerprints) ProtoMessage() {} +func (*CombinedFingerprints) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} } + +func (m *CombinedFingerprints) GetVersion() uint32 { + if m != nil && m.Version != nil { + return *m.Version + } + return 0 +} + +func (m *CombinedFingerprints) GetLocalFingerprint() *LogicalFingerprint { + if m != nil { + return m.LocalFingerprint + } + return nil +} + +func (m *CombinedFingerprints) GetRemoteFingerprint() *LogicalFingerprint { + if m != nil { + return m.RemoteFingerprint + } + return nil +} + +func init() { + proto.RegisterType((*LogicalFingerprint)(nil), "textsecure.LogicalFingerprint") + proto.RegisterType((*CombinedFingerprints)(nil), "textsecure.CombinedFingerprints") +} + +func init() { proto.RegisterFile("FingerprintProtocol.proto", fileDescriptor2) } + +var fileDescriptor2 = []byte{ + // 207 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0x3f, 0x4b, 0xc5, 0x40, + 0x10, 0xc4, 0x39, 0x2d, 0x84, 0x55, 0xc1, 0x77, 0x58, 0xc4, 0x46, 0x1e, 0xaf, 0x4a, 0x75, 0x85, + 0xbd, 0x8d, 0x82, 0x85, 0xbc, 0x42, 0xf2, 0x0d, 0x92, 0x73, 0x3d, 0x17, 0x2e, 0xb7, 0x61, 0x77, + 0xfd, 0xf7, 0x15, 0xfd, 0x54, 0x12, 0x21, 0x78, 0x9a, 0xc6, 0x6e, 0x07, 0xe6, 0x37, 0x3b, 0x0c, + 0x5c, 0xdc, 0x51, 0x49, 0x28, 0x93, 0x50, 0xb1, 0x07, 0x61, 0xe3, 0xc8, 0x39, 0x4c, 0xf3, 0xe1, + 0xc1, 0xf0, 0xdd, 0x14, 0xe3, 0x8b, 0xe0, 0x2e, 0x80, 0xdf, 0x73, 0xa2, 0xd8, 0xe7, 0xca, 0xef, + 0x1b, 0x38, 0x8a, 0x5c, 0x0c, 0x8b, 0x35, 0x6e, 0xeb, 0xda, 0x93, 0x6e, 0x91, 0xbb, 0x4f, 0x07, + 0xe7, 0xb7, 0x3c, 0x0e, 0x54, 0xf0, 0xb1, 0x22, 0x74, 0x46, 0x5e, 0x51, 0x94, 0xb8, 0x7c, 0x23, + 0xa7, 0xdd, 0x22, 0xfd, 0x3d, 0x9c, 0x65, 0xfe, 0xfd, 0xa0, 0x39, 0xd8, 0xba, 0xf6, 0xf8, 0xea, + 0x32, 0xfc, 0x34, 0x09, 0xeb, 0x1a, 0xdd, 0x8a, 0xf3, 0x7b, 0xd8, 0x08, 0x8e, 0x6c, 0x58, 0x87, + 0x1d, 0xfe, 0x2b, 0x6c, 0x0d, 0xde, 0x5c, 0x43, 0xcb, 0x92, 0xc2, 0xdb, 0x33, 0xe9, 0x84, 0xa2, + 0x1f, 0x6a, 0x38, 0x6a, 0xc8, 0x34, 0x28, 0xa5, 0xd2, 0xe7, 0xf0, 0x54, 0x79, 0x37, 0x7f, 0xf7, + 0xd4, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x44, 0x19, 0x98, 0x63, 0x01, 0x00, 0x00, +} diff --git a/axolotl/protobuf/FingerprintProtocol.proto b/axolotl/protobuf/FingerprintProtocol.proto new file mode 100644 index 0000000..b5112a2 --- /dev/null +++ b/axolotl/protobuf/FingerprintProtocol.proto @@ -0,0 +1,15 @@ +package textsecure; + +option java_package = "org.whispersystems.libsignal.fingerprint"; +option java_outer_classname = "FingerprintProtos"; + +message LogicalFingerprint { + optional bytes content = 1; +// optional bytes identifier = 2; +} + +message CombinedFingerprints { + optional uint32 version = 1; + optional LogicalFingerprint localFingerprint = 2; + optional LogicalFingerprint remoteFingerprint = 3; +} \ No newline at end of file diff --git a/axolotl/protobuf/LocalStorageProtocol.pb.go b/axolotl/protobuf/LocalStorageProtocol.pb.go index 2d48123..f7f24b3 100644 --- a/axolotl/protobuf/LocalStorageProtocol.pb.go +++ b/axolotl/protobuf/LocalStorageProtocol.pb.go @@ -2,15 +2,15 @@ // source: LocalStorageProtocol.proto // DO NOT EDIT! -package axolotl +package textsecure import proto "github.com/golang/protobuf/proto" -import json "encoding/json" +import fmt "fmt" import math "math" -// Reference proto, json, and math imports to suppress error if they are not otherwise used. +// Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal -var _ = &json.SyntaxError{} +var _ = fmt.Errorf var _ = math.Inf type SessionStructure struct { @@ -30,9 +30,10 @@ type SessionStructure struct { XXX_unrecognized []byte `json:"-"` } -func (m *SessionStructure) Reset() { *m = SessionStructure{} } -func (m *SessionStructure) String() string { return proto.CompactTextString(m) } -func (*SessionStructure) ProtoMessage() {} +func (m *SessionStructure) Reset() { *m = SessionStructure{} } +func (m *SessionStructure) String() string { return proto.CompactTextString(m) } +func (*SessionStructure) ProtoMessage() {} +func (*SessionStructure) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } func (m *SessionStructure) GetSessionVersion() uint32 { if m != nil && m.SessionVersion != nil { @@ -133,9 +134,10 @@ type SessionStructure_Chain struct { XXX_unrecognized []byte `json:"-"` } -func (m *SessionStructure_Chain) Reset() { *m = SessionStructure_Chain{} } -func (m *SessionStructure_Chain) String() string { return proto.CompactTextString(m) } -func (*SessionStructure_Chain) ProtoMessage() {} +func (m *SessionStructure_Chain) Reset() { *m = SessionStructure_Chain{} } +func (m *SessionStructure_Chain) String() string { return proto.CompactTextString(m) } +func (*SessionStructure_Chain) ProtoMessage() {} +func (*SessionStructure_Chain) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0, 0} } func (m *SessionStructure_Chain) GetSenderRatchetKey() []byte { if m != nil { @@ -174,6 +176,9 @@ type SessionStructure_Chain_ChainKey struct { func (m *SessionStructure_Chain_ChainKey) Reset() { *m = SessionStructure_Chain_ChainKey{} } func (m *SessionStructure_Chain_ChainKey) String() string { return proto.CompactTextString(m) } func (*SessionStructure_Chain_ChainKey) ProtoMessage() {} +func (*SessionStructure_Chain_ChainKey) Descriptor() ([]byte, []int) { + return fileDescriptor1, []int{0, 0, 0} +} func (m *SessionStructure_Chain_ChainKey) GetIndex() uint32 { if m != nil && m.Index != nil { @@ -200,6 +205,9 @@ type SessionStructure_Chain_MessageKey struct { func (m *SessionStructure_Chain_MessageKey) Reset() { *m = SessionStructure_Chain_MessageKey{} } func (m *SessionStructure_Chain_MessageKey) String() string { return proto.CompactTextString(m) } func (*SessionStructure_Chain_MessageKey) ProtoMessage() {} +func (*SessionStructure_Chain_MessageKey) Descriptor() ([]byte, []int) { + return fileDescriptor1, []int{0, 0, 1} +} func (m *SessionStructure_Chain_MessageKey) GetIndex() uint32 { if m != nil && m.Index != nil { @@ -243,6 +251,9 @@ type SessionStructure_PendingKeyExchange struct { func (m *SessionStructure_PendingKeyExchange) Reset() { *m = SessionStructure_PendingKeyExchange{} } func (m *SessionStructure_PendingKeyExchange) String() string { return proto.CompactTextString(m) } func (*SessionStructure_PendingKeyExchange) ProtoMessage() {} +func (*SessionStructure_PendingKeyExchange) Descriptor() ([]byte, []int) { + return fileDescriptor1, []int{0, 1} +} func (m *SessionStructure_PendingKeyExchange) GetSequence() uint32 { if m != nil && m.Sequence != nil { @@ -303,6 +314,9 @@ type SessionStructure_PendingPreKey struct { func (m *SessionStructure_PendingPreKey) Reset() { *m = SessionStructure_PendingPreKey{} } func (m *SessionStructure_PendingPreKey) String() string { return proto.CompactTextString(m) } func (*SessionStructure_PendingPreKey) ProtoMessage() {} +func (*SessionStructure_PendingPreKey) Descriptor() ([]byte, []int) { + return fileDescriptor1, []int{0, 2} +} func (m *SessionStructure_PendingPreKey) GetPreKeyId() uint32 { if m != nil && m.PreKeyId != nil { @@ -331,9 +345,10 @@ type RecordStructure struct { XXX_unrecognized []byte `json:"-"` } -func (m *RecordStructure) Reset() { *m = RecordStructure{} } -func (m *RecordStructure) String() string { return proto.CompactTextString(m) } -func (*RecordStructure) ProtoMessage() {} +func (m *RecordStructure) Reset() { *m = RecordStructure{} } +func (m *RecordStructure) String() string { return proto.CompactTextString(m) } +func (*RecordStructure) ProtoMessage() {} +func (*RecordStructure) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } func (m *RecordStructure) GetCurrentSession() *SessionStructure { if m != nil { @@ -356,9 +371,10 @@ type PreKeyRecordStructure struct { XXX_unrecognized []byte `json:"-"` } -func (m *PreKeyRecordStructure) Reset() { *m = PreKeyRecordStructure{} } -func (m *PreKeyRecordStructure) String() string { return proto.CompactTextString(m) } -func (*PreKeyRecordStructure) ProtoMessage() {} +func (m *PreKeyRecordStructure) Reset() { *m = PreKeyRecordStructure{} } +func (m *PreKeyRecordStructure) String() string { return proto.CompactTextString(m) } +func (*PreKeyRecordStructure) ProtoMessage() {} +func (*PreKeyRecordStructure) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } func (m *PreKeyRecordStructure) GetId() uint32 { if m != nil && m.Id != nil { @@ -390,9 +406,10 @@ type SignedPreKeyRecordStructure struct { XXX_unrecognized []byte `json:"-"` } -func (m *SignedPreKeyRecordStructure) Reset() { *m = SignedPreKeyRecordStructure{} } -func (m *SignedPreKeyRecordStructure) String() string { return proto.CompactTextString(m) } -func (*SignedPreKeyRecordStructure) ProtoMessage() {} +func (m *SignedPreKeyRecordStructure) Reset() { *m = SignedPreKeyRecordStructure{} } +func (m *SignedPreKeyRecordStructure) String() string { return proto.CompactTextString(m) } +func (*SignedPreKeyRecordStructure) ProtoMessage() {} +func (*SignedPreKeyRecordStructure) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} } func (m *SignedPreKeyRecordStructure) GetId() uint32 { if m != nil && m.Id != nil { @@ -435,9 +452,10 @@ type IdentityKeyPairStructure struct { XXX_unrecognized []byte `json:"-"` } -func (m *IdentityKeyPairStructure) Reset() { *m = IdentityKeyPairStructure{} } -func (m *IdentityKeyPairStructure) String() string { return proto.CompactTextString(m) } -func (*IdentityKeyPairStructure) ProtoMessage() {} +func (m *IdentityKeyPairStructure) Reset() { *m = IdentityKeyPairStructure{} } +func (m *IdentityKeyPairStructure) String() string { return proto.CompactTextString(m) } +func (*IdentityKeyPairStructure) ProtoMessage() {} +func (*IdentityKeyPairStructure) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} } func (m *IdentityKeyPairStructure) GetPublicKey() []byte { if m != nil { @@ -461,9 +479,10 @@ type SenderKeyStateStructure struct { XXX_unrecognized []byte `json:"-"` } -func (m *SenderKeyStateStructure) Reset() { *m = SenderKeyStateStructure{} } -func (m *SenderKeyStateStructure) String() string { return proto.CompactTextString(m) } -func (*SenderKeyStateStructure) ProtoMessage() {} +func (m *SenderKeyStateStructure) Reset() { *m = SenderKeyStateStructure{} } +func (m *SenderKeyStateStructure) String() string { return proto.CompactTextString(m) } +func (*SenderKeyStateStructure) ProtoMessage() {} +func (*SenderKeyStateStructure) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} } func (m *SenderKeyStateStructure) GetSenderKeyId() uint32 { if m != nil && m.SenderKeyId != nil { @@ -504,6 +523,9 @@ func (m *SenderKeyStateStructure_SenderChainKey) Reset() { } func (m *SenderKeyStateStructure_SenderChainKey) String() string { return proto.CompactTextString(m) } func (*SenderKeyStateStructure_SenderChainKey) ProtoMessage() {} +func (*SenderKeyStateStructure_SenderChainKey) Descriptor() ([]byte, []int) { + return fileDescriptor1, []int{5, 0} +} func (m *SenderKeyStateStructure_SenderChainKey) GetIteration() uint32 { if m != nil && m.Iteration != nil { @@ -530,6 +552,9 @@ func (m *SenderKeyStateStructure_SenderMessageKey) Reset() { } func (m *SenderKeyStateStructure_SenderMessageKey) String() string { return proto.CompactTextString(m) } func (*SenderKeyStateStructure_SenderMessageKey) ProtoMessage() {} +func (*SenderKeyStateStructure_SenderMessageKey) Descriptor() ([]byte, []int) { + return fileDescriptor1, []int{5, 1} +} func (m *SenderKeyStateStructure_SenderMessageKey) GetIteration() uint32 { if m != nil && m.Iteration != nil { @@ -556,6 +581,9 @@ func (m *SenderKeyStateStructure_SenderSigningKey) Reset() { } func (m *SenderKeyStateStructure_SenderSigningKey) String() string { return proto.CompactTextString(m) } func (*SenderKeyStateStructure_SenderSigningKey) ProtoMessage() {} +func (*SenderKeyStateStructure_SenderSigningKey) Descriptor() ([]byte, []int) { + return fileDescriptor1, []int{5, 2} +} func (m *SenderKeyStateStructure_SenderSigningKey) GetPublic() []byte { if m != nil { @@ -576,9 +604,10 @@ type SenderKeyRecordStructure struct { XXX_unrecognized []byte `json:"-"` } -func (m *SenderKeyRecordStructure) Reset() { *m = SenderKeyRecordStructure{} } -func (m *SenderKeyRecordStructure) String() string { return proto.CompactTextString(m) } -func (*SenderKeyRecordStructure) ProtoMessage() {} +func (m *SenderKeyRecordStructure) Reset() { *m = SenderKeyRecordStructure{} } +func (m *SenderKeyRecordStructure) String() string { return proto.CompactTextString(m) } +func (*SenderKeyRecordStructure) ProtoMessage() {} +func (*SenderKeyRecordStructure) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{6} } func (m *SenderKeyRecordStructure) GetSenderKeyStates() []*SenderKeyStateStructure { if m != nil { @@ -588,4 +617,85 @@ func (m *SenderKeyRecordStructure) GetSenderKeyStates() []*SenderKeyStateStructu } func init() { + proto.RegisterType((*SessionStructure)(nil), "textsecure.SessionStructure") + proto.RegisterType((*SessionStructure_Chain)(nil), "textsecure.SessionStructure.Chain") + proto.RegisterType((*SessionStructure_Chain_ChainKey)(nil), "textsecure.SessionStructure.Chain.ChainKey") + proto.RegisterType((*SessionStructure_Chain_MessageKey)(nil), "textsecure.SessionStructure.Chain.MessageKey") + proto.RegisterType((*SessionStructure_PendingKeyExchange)(nil), "textsecure.SessionStructure.PendingKeyExchange") + proto.RegisterType((*SessionStructure_PendingPreKey)(nil), "textsecure.SessionStructure.PendingPreKey") + proto.RegisterType((*RecordStructure)(nil), "textsecure.RecordStructure") + proto.RegisterType((*PreKeyRecordStructure)(nil), "textsecure.PreKeyRecordStructure") + proto.RegisterType((*SignedPreKeyRecordStructure)(nil), "textsecure.SignedPreKeyRecordStructure") + proto.RegisterType((*IdentityKeyPairStructure)(nil), "textsecure.IdentityKeyPairStructure") + proto.RegisterType((*SenderKeyStateStructure)(nil), "textsecure.SenderKeyStateStructure") + proto.RegisterType((*SenderKeyStateStructure_SenderChainKey)(nil), "textsecure.SenderKeyStateStructure.SenderChainKey") + proto.RegisterType((*SenderKeyStateStructure_SenderMessageKey)(nil), "textsecure.SenderKeyStateStructure.SenderMessageKey") + proto.RegisterType((*SenderKeyStateStructure_SenderSigningKey)(nil), "textsecure.SenderKeyStateStructure.SenderSigningKey") + proto.RegisterType((*SenderKeyRecordStructure)(nil), "textsecure.SenderKeyRecordStructure") +} + +func init() { proto.RegisterFile("LocalStorageProtocol.proto", fileDescriptor1) } + +var fileDescriptor1 = []byte{ + // 951 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x6e, 0x2b, 0x35, + 0x17, 0xd5, 0x24, 0x4d, 0x9b, 0xb3, 0xf3, 0xd3, 0x7e, 0xfe, 0x0e, 0x3d, 0xa3, 0xe1, 0x08, 0x45, + 0x83, 0x84, 0xa2, 0x83, 0x08, 0x28, 0x20, 0xc4, 0x75, 0x4f, 0x11, 0x94, 0x52, 0x11, 0x39, 0x12, + 0x42, 0xdc, 0xc0, 0x74, 0x66, 0x93, 0x58, 0x24, 0x33, 0x83, 0xed, 0x84, 0xe6, 0x71, 0xb8, 0x40, + 0x5c, 0xf1, 0x0c, 0xbc, 0x01, 0xcf, 0x84, 0xec, 0xb1, 0xe7, 0xc7, 0x49, 0x4b, 0x10, 0xe2, 0x26, + 0x19, 0x2f, 0x7b, 0xaf, 0xed, 0x59, 0x7b, 0x79, 0x7b, 0x20, 0xf8, 0x32, 0x8b, 0xa3, 0xd5, 0x5c, + 0x66, 0x3c, 0x5a, 0xe0, 0x8c, 0x67, 0x32, 0x8b, 0xb3, 0xd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 0xa7, 0xaa, 0x17, 0x93, 0x58, 0xdc, 0x9f, 0x46, 0xd3, 0x0a, 0x20, + 0x04, 0x4e, 0x04, 0x62, 0x62, 0x2a, 0xa5, 0x9f, 0x83, 0x6b, 0xf5, 0xcd, 0xd7, 0x24, 0xfe, 0x37, + 0x2c, 0x35, 0x05, 0x2e, 0xe1, 0xb4, 0xb0, 0x8a, 0x31, 0x8e, 0x19, 0xa9, 0xf6, 0x91, 0x37, 0xae, + 0x51, 0x3b, 0x0c, 0x19, 0xf8, 0xa5, 0x1c, 0xee, 0x79, 0xb9, 0x83, 0x73, 0xd1, 0x90, 0x4a, 0xf8, + 0x9e, 0x56, 0xf3, 0xed, 0x23, 0xd4, 0xa4, 0x6e, 0xec, 0xd5, 0x87, 0x10, 0x66, 0x7c, 0x31, 0xf9, + 0x79, 0xc9, 0x44, 0x8e, 0x5c, 0xec, 0x84, 0xc4, 0xb5, 0x98, 0xac, 0xd8, 0xbd, 0x3e, 0x35, 0xab, + 0x89, 0x50, 0xcb, 0xae, 0x06, 0xf5, 0x8f, 0x66, 0xf1, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x27, + 0x39, 0xca, 0x13, 0x49, 0x0b, 0x00, 0x00, } diff --git a/axolotl/protobuf/LocalStorageProtocol.proto b/axolotl/protobuf/LocalStorageProtocol.proto index ed26384..7de2f19 100644 --- a/axolotl/protobuf/LocalStorageProtocol.proto +++ b/axolotl/protobuf/LocalStorageProtocol.proto @@ -1,6 +1,6 @@ package textsecure; -option java_package = "org.whispersystems.libaxolotl.state"; +option java_package = "org.whispersystems.libsignal.state"; option java_outer_classname = "StorageProtos"; message SessionStructure { @@ -109,4 +109,4 @@ message SenderKeyStateStructure { message SenderKeyRecordStructure { repeated SenderKeyStateStructure senderKeyStates = 1; -} +} \ No newline at end of file diff --git a/axolotl/protobuf/Makefile b/axolotl/protobuf/Makefile new file mode 100644 index 0000000..9017b23 --- /dev/null +++ b/axolotl/protobuf/Makefile @@ -0,0 +1,6 @@ + +all: + protoc --go_out=. WhisperTextProtocol.proto LocalStorageProtocol.proto FingerprintProtocol.proto + +clean: + rm -f WhisperTextProtocol.pb.go LocalStorageProtocol.pb.go FingerprintProtocol.pb.go diff --git a/axolotl/protobuf/WhisperTextProtocol.pb.go b/axolotl/protobuf/WhisperTextProtocol.pb.go index 54d537a..760ec63 100644 --- a/axolotl/protobuf/WhisperTextProtocol.pb.go +++ b/axolotl/protobuf/WhisperTextProtocol.pb.go @@ -2,18 +2,49 @@ // source: WhisperTextProtocol.proto // DO NOT EDIT! -package axolotl +/* +Package textsecure is a generated protocol buffer package. + +It is generated from these files: + WhisperTextProtocol.proto + LocalStorageProtocol.proto + FingerprintProtocol.proto + +It has these top-level messages: + SignalMessage + PreKeySignalMessage + KeyExchangeMessage + SenderKeyMessage + SenderKeyDistributionMessage + DeviceConsistencyCodeMessage + SessionStructure + RecordStructure + PreKeyRecordStructure + SignedPreKeyRecordStructure + IdentityKeyPairStructure + SenderKeyStateStructure + SenderKeyRecordStructure + LogicalFingerprint + CombinedFingerprints +*/ +package textsecure import proto "github.com/golang/protobuf/proto" -import json "encoding/json" +import fmt "fmt" import math "math" -// Reference proto, json, and math imports to suppress error if they are not otherwise used. +// Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal -var _ = &json.SyntaxError{} +var _ = fmt.Errorf var _ = math.Inf -type WhisperMessage struct { +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type SignalMessage struct { RatchetKey []byte `protobuf:"bytes,1,opt,name=ratchetKey" json:"ratchetKey,omitempty"` Counter *uint32 `protobuf:"varint,2,opt,name=counter" json:"counter,omitempty"` PreviousCounter *uint32 `protobuf:"varint,3,opt,name=previousCounter" json:"previousCounter,omitempty"` @@ -21,39 +52,40 @@ type WhisperMessage struct { XXX_unrecognized []byte `json:"-"` } -func (m *WhisperMessage) Reset() { *m = WhisperMessage{} } -func (m *WhisperMessage) String() string { return proto.CompactTextString(m) } -func (*WhisperMessage) ProtoMessage() {} +func (m *SignalMessage) Reset() { *m = SignalMessage{} } +func (m *SignalMessage) String() string { return proto.CompactTextString(m) } +func (*SignalMessage) ProtoMessage() {} +func (*SignalMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } -func (m *WhisperMessage) GetRatchetKey() []byte { +func (m *SignalMessage) GetRatchetKey() []byte { if m != nil { return m.RatchetKey } return nil } -func (m *WhisperMessage) GetCounter() uint32 { +func (m *SignalMessage) GetCounter() uint32 { if m != nil && m.Counter != nil { return *m.Counter } return 0 } -func (m *WhisperMessage) GetPreviousCounter() uint32 { +func (m *SignalMessage) GetPreviousCounter() uint32 { if m != nil && m.PreviousCounter != nil { return *m.PreviousCounter } return 0 } -func (m *WhisperMessage) GetCiphertext() []byte { +func (m *SignalMessage) GetCiphertext() []byte { if m != nil { return m.Ciphertext } return nil } -type PreKeyWhisperMessage struct { +type PreKeySignalMessage struct { RegistrationId *uint32 `protobuf:"varint,5,opt,name=registrationId" json:"registrationId,omitempty"` PreKeyId *uint32 `protobuf:"varint,1,opt,name=preKeyId" json:"preKeyId,omitempty"` SignedPreKeyId *uint32 `protobuf:"varint,6,opt,name=signedPreKeyId" json:"signedPreKeyId,omitempty"` @@ -63,46 +95,47 @@ type PreKeyWhisperMessage struct { XXX_unrecognized []byte `json:"-"` } -func (m *PreKeyWhisperMessage) Reset() { *m = PreKeyWhisperMessage{} } -func (m *PreKeyWhisperMessage) String() string { return proto.CompactTextString(m) } -func (*PreKeyWhisperMessage) ProtoMessage() {} +func (m *PreKeySignalMessage) Reset() { *m = PreKeySignalMessage{} } +func (m *PreKeySignalMessage) String() string { return proto.CompactTextString(m) } +func (*PreKeySignalMessage) ProtoMessage() {} +func (*PreKeySignalMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } -func (m *PreKeyWhisperMessage) GetRegistrationId() uint32 { +func (m *PreKeySignalMessage) GetRegistrationId() uint32 { if m != nil && m.RegistrationId != nil { return *m.RegistrationId } return 0 } -func (m *PreKeyWhisperMessage) GetPreKeyId() uint32 { +func (m *PreKeySignalMessage) GetPreKeyId() uint32 { if m != nil && m.PreKeyId != nil { return *m.PreKeyId } return 0 } -func (m *PreKeyWhisperMessage) GetSignedPreKeyId() uint32 { +func (m *PreKeySignalMessage) GetSignedPreKeyId() uint32 { if m != nil && m.SignedPreKeyId != nil { return *m.SignedPreKeyId } return 0 } -func (m *PreKeyWhisperMessage) GetBaseKey() []byte { +func (m *PreKeySignalMessage) GetBaseKey() []byte { if m != nil { return m.BaseKey } return nil } -func (m *PreKeyWhisperMessage) GetIdentityKey() []byte { +func (m *PreKeySignalMessage) GetIdentityKey() []byte { if m != nil { return m.IdentityKey } return nil } -func (m *PreKeyWhisperMessage) GetMessage() []byte { +func (m *PreKeySignalMessage) GetMessage() []byte { if m != nil { return m.Message } @@ -118,9 +151,10 @@ type KeyExchangeMessage struct { XXX_unrecognized []byte `json:"-"` } -func (m *KeyExchangeMessage) Reset() { *m = KeyExchangeMessage{} } -func (m *KeyExchangeMessage) String() string { return proto.CompactTextString(m) } -func (*KeyExchangeMessage) ProtoMessage() {} +func (m *KeyExchangeMessage) Reset() { *m = KeyExchangeMessage{} } +func (m *KeyExchangeMessage) String() string { return proto.CompactTextString(m) } +func (*KeyExchangeMessage) ProtoMessage() {} +func (*KeyExchangeMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } func (m *KeyExchangeMessage) GetId() uint32 { if m != nil && m.Id != nil { @@ -164,9 +198,10 @@ type SenderKeyMessage struct { XXX_unrecognized []byte `json:"-"` } -func (m *SenderKeyMessage) Reset() { *m = SenderKeyMessage{} } -func (m *SenderKeyMessage) String() string { return proto.CompactTextString(m) } -func (*SenderKeyMessage) ProtoMessage() {} +func (m *SenderKeyMessage) Reset() { *m = SenderKeyMessage{} } +func (m *SenderKeyMessage) String() string { return proto.CompactTextString(m) } +func (*SenderKeyMessage) ProtoMessage() {} +func (*SenderKeyMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } func (m *SenderKeyMessage) GetId() uint32 { if m != nil && m.Id != nil { @@ -197,9 +232,10 @@ type SenderKeyDistributionMessage struct { XXX_unrecognized []byte `json:"-"` } -func (m *SenderKeyDistributionMessage) Reset() { *m = SenderKeyDistributionMessage{} } -func (m *SenderKeyDistributionMessage) String() string { return proto.CompactTextString(m) } -func (*SenderKeyDistributionMessage) ProtoMessage() {} +func (m *SenderKeyDistributionMessage) Reset() { *m = SenderKeyDistributionMessage{} } +func (m *SenderKeyDistributionMessage) String() string { return proto.CompactTextString(m) } +func (*SenderKeyDistributionMessage) ProtoMessage() {} +func (*SenderKeyDistributionMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } func (m *SenderKeyDistributionMessage) GetId() uint32 { if m != nil && m.Id != nil { @@ -229,5 +265,70 @@ func (m *SenderKeyDistributionMessage) GetSigningKey() []byte { return nil } +type DeviceConsistencyCodeMessage struct { + Generation *uint32 `protobuf:"varint,1,opt,name=generation" json:"generation,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DeviceConsistencyCodeMessage) Reset() { *m = DeviceConsistencyCodeMessage{} } +func (m *DeviceConsistencyCodeMessage) String() string { return proto.CompactTextString(m) } +func (*DeviceConsistencyCodeMessage) ProtoMessage() {} +func (*DeviceConsistencyCodeMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *DeviceConsistencyCodeMessage) GetGeneration() uint32 { + if m != nil && m.Generation != nil { + return *m.Generation + } + return 0 +} + +func (m *DeviceConsistencyCodeMessage) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + func init() { + proto.RegisterType((*SignalMessage)(nil), "textsecure.SignalMessage") + proto.RegisterType((*PreKeySignalMessage)(nil), "textsecure.PreKeySignalMessage") + proto.RegisterType((*KeyExchangeMessage)(nil), "textsecure.KeyExchangeMessage") + proto.RegisterType((*SenderKeyMessage)(nil), "textsecure.SenderKeyMessage") + proto.RegisterType((*SenderKeyDistributionMessage)(nil), "textsecure.SenderKeyDistributionMessage") + proto.RegisterType((*DeviceConsistencyCodeMessage)(nil), "textsecure.DeviceConsistencyCodeMessage") +} + +func init() { proto.RegisterFile("WhisperTextProtocol.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 446 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcd, 0x8e, 0xd3, 0x30, + 0x10, 0x56, 0xda, 0x05, 0x96, 0xa1, 0x5d, 0x56, 0xe1, 0x12, 0x56, 0x15, 0xaa, 0x22, 0x81, 0x2a, + 0x0e, 0xbd, 0xf1, 0x02, 0xdb, 0xe5, 0xb0, 0xaa, 0x90, 0xaa, 0x2c, 0x12, 0x17, 0x0e, 0xa4, 0xce, + 0xc8, 0x19, 0xa9, 0x6b, 0x47, 0xb6, 0x53, 0x9a, 0x37, 0xe0, 0xce, 0x6b, 0xf0, 0x3e, 0xbc, 0x0e, + 0xb2, 0x9d, 0xbf, 0x26, 0x82, 0x03, 0xb7, 0xcc, 0x97, 0xb1, 0xbf, 0x6f, 0xbe, 0xcf, 0x03, 0xaf, + 0xbf, 0xe4, 0xa4, 0x0b, 0x54, 0x9f, 0xf1, 0x64, 0x76, 0x4a, 0x1a, 0xc9, 0xe4, 0x61, 0x5d, 0xd8, + 0x8f, 0x10, 0x0c, 0x9e, 0x8c, 0x46, 0x56, 0x2a, 0x8c, 0x7f, 0x06, 0x30, 0x7f, 0x20, 0x2e, 0xd2, + 0xc3, 0x27, 0xd4, 0x3a, 0xe5, 0x18, 0xbe, 0x01, 0x50, 0xa9, 0x61, 0x39, 0x9a, 0x2d, 0x56, 0x51, + 0xb0, 0x0c, 0x56, 0xb3, 0xa4, 0x87, 0x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b, 0xd5, 0xdf, 0xb4, + 0x2e, 0xe0, 0x39, 0x19, 0xf4, 0xde, 0xd7, 0x4f, 0xa2, 0x03, 0x06, 0x51, 0x4f, 0x47, 0x51, 0xff, + 0x08, 0x60, 0xd1, 0x52, 0xdc, 0xd9, 0x10, 0x69, 0x5f, 0xda, 0x93, 0xff, 0x47, 0x77, 0x03, 0x97, + 0x2c, 0x4f, 0x49, 0x74, 0xe6, 0xb4, 0xb5, 0x95, 0x62, 0x33, 0x26, 0xc1, 0x3b, 0x67, 0x7a, 0x48, + 0xfc, 0x15, 0x16, 0x77, 0x78, 0x24, 0x86, 0x1b, 0x29, 0x34, 0x69, 0x83, 0x82, 0x55, 0x1b, 0x99, + 0x61, 0x6f, 0x33, 0x38, 0x8a, 0x86, 0xda, 0x2b, 0xea, 0x21, 0x56, 0x99, 0x6e, 0x1d, 0xf5, 0xb1, + 0x75, 0xc0, 0xed, 0x07, 0x78, 0x2b, 0x15, 0x5f, 0x7f, 0xf7, 0x6b, 0xa9, 0x2b, 0x6d, 0xf0, 0x51, + 0xaf, 0x0f, 0xb4, 0x77, 0x2d, 0xf5, 0x6e, 0x32, 0x79, 0xb8, 0x9d, 0xf9, 0x37, 0xef, 0x96, 0x56, + 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x32, 0x36, 0x08, 0x6d, 0xc8, 0x03, 0x00, 0x00, } diff --git a/axolotl/protobuf/WhisperTextProtocol.proto b/axolotl/protobuf/WhisperTextProtocol.proto index bbbd0ad..f6a3c95 100644 --- a/axolotl/protobuf/WhisperTextProtocol.proto +++ b/axolotl/protobuf/WhisperTextProtocol.proto @@ -1,22 +1,22 @@ -package axolotl; +package textsecure; -option java_package = "org.whispersystems.libaxolotl.protocol"; -option java_outer_classname = "WhisperProtos"; +option java_package = "org.whispersystems.libsignal.protocol"; +option java_outer_classname = "SignalProtos"; -message WhisperMessage { +message SignalMessage { optional bytes ratchetKey = 1; optional uint32 counter = 2; optional uint32 previousCounter = 3; optional bytes ciphertext = 4; } -message PreKeyWhisperMessage { +message PreKeySignalMessage { optional uint32 registrationId = 5; optional uint32 preKeyId = 1; optional uint32 signedPreKeyId = 6; optional bytes baseKey = 2; optional bytes identityKey = 3; - optional bytes message = 4; // WhisperMessage + optional bytes message = 4; // SignalMessage } message KeyExchangeMessage { @@ -39,3 +39,8 @@ message SenderKeyDistributionMessage { optional bytes chainKey = 3; optional bytes signingKey = 4; } + +message DeviceConsistencyCodeMessage { + optional uint32 generation = 1; + optional bytes signature = 2; +} \ No newline at end of file diff --git a/axolotl/session.go b/axolotl/session.go index 8c1ee43..198a636 100644 --- a/axolotl/session.go +++ b/axolotl/session.go @@ -9,10 +9,10 @@ import ( "errors" "fmt" + protobuf "github.com/aebruno/textsecure/axolotl/protobuf" + "github.com/aebruno/textsecure/curve25519sign" + "github.com/aebruno/textsecure/protobuf" "github.com/golang/protobuf/proto" - protobuf "github.com/janimo/textsecure/axolotl/protobuf" - "github.com/janimo/textsecure/curve25519sign" - "github.com/janimo/textsecure/protobuf" ) type sessionState struct { @@ -548,7 +548,7 @@ func (sc *SessionCipher) SessionEncryptMessage(plaintext []byte) ([]byte, int32, return nil, 0, err } msg := wm.serialize() - msgType := int32(textsecure.Envelope_CIPHERTEXT) + msgType := int32(signalservice.Envelope_CIPHERTEXT) if ss.hasUnacknowledgedPreKeyMessage() { items := ss.getUnacknowledgedPreKeyMessageItems() @@ -559,7 +559,7 @@ func (sc *SessionCipher) SessionEncryptMessage(plaintext []byte) ([]byte, int32, return nil, 0, nil } msg = pkwm.serialize() - msgType = int32(textsecure.Envelope_PREKEY_BUNDLE) + msgType = int32(signalservice.Envelope_PREKEY_BUNDLE) } ss.setSenderChainKey(chainKey.getNextChainKey()) diff --git a/cmd/textsecure/main.go b/cmd/textsecure/main.go index 59882ae..16178fd 100644 --- a/cmd/textsecure/main.go +++ b/cmd/textsecure/main.go @@ -12,8 +12,8 @@ import ( "strings" "time" - "github.com/janimo/textsecure" - "github.com/janimo/textsecure/axolotl" + "github.com/aebruno/textsecure" + "github.com/aebruno/textsecure/axolotl" "golang.org/x/crypto/ssh/terminal" ) diff --git a/crypto.go b/crypto.go index b1fc6f8..c2cfb0a 100644 --- a/crypto.go +++ b/crypto.go @@ -16,9 +16,9 @@ import ( "fmt" "io" + "github.com/aebruno/textsecure/axolotl" + "github.com/aebruno/textsecure/protobuf" "github.com/golang/protobuf/proto" - "github.com/janimo/textsecure/axolotl" - "github.com/janimo/textsecure/protobuf" "golang.org/x/crypto/curve25519" ) @@ -101,7 +101,7 @@ func aesDecrypt(key, ciphertext []byte) ([]byte, error) { } // ProvisioningCipher -func provisioningCipher(pm *textsecure.ProvisionMessage, theirPublicKey *axolotl.ECPublicKey) ([]byte, error) { +func provisioningCipher(pm *signalservice.ProvisionMessage, theirPublicKey *axolotl.ECPublicKey) ([]byte, error) { ourKeyPair := axolotl.GenerateIdentityKeyPair() version := []byte{0x01} @@ -133,7 +133,7 @@ func provisioningCipher(pm *textsecure.ProvisionMessage, theirPublicKey *axolotl body = append(body, ciphertext[:]...) body = append(body, mac[:]...) - pe := &textsecure.ProvisionEnvelope{ + pe := &signalservice.ProvisionEnvelope{ PublicKey: ourKeyPair.PublicKey.Serialize(), Body: body, } diff --git a/groups.go b/groups.go index 7147223..ead7cc4 100644 --- a/groups.go +++ b/groups.go @@ -12,7 +12,7 @@ import ( "path/filepath" "strings" - "github.com/janimo/textsecure/protobuf" + "github.com/aebruno/textsecure/protobuf" "gopkg.in/yaml.v2" ) @@ -101,7 +101,7 @@ func removeMember(tel string, members []string) []string { } // updateGroup updates a group's state based on an incoming message. -func updateGroup(gr *textsecure.GroupContext) error { +func updateGroup(gr *signalservice.GroupContext) error { hexid := idToHex(gr.GetId()) var r io.Reader @@ -152,7 +152,7 @@ var GroupUpdateFlag uint32 = 1 var GroupLeaveFlag uint32 = 2 // handleGroups is the main entry point for handling the group metadata on messages. -func handleGroups(src string, dm *textsecure.DataMessage) (*Group, error) { +func handleGroups(src string, dm *signalservice.DataMessage) (*Group, error) { gr := dm.GetGroup() if gr == nil { return nil, nil @@ -160,17 +160,17 @@ func handleGroups(src string, dm *textsecure.DataMessage) (*Group, error) { hexid := idToHex(gr.GetId()) switch gr.GetType() { - case textsecure.GroupContext_UPDATE: + case signalservice.GroupContext_UPDATE: if err := updateGroup(gr); err != nil { return nil, err } groups[hexid].Flags = GroupUpdateFlag - case textsecure.GroupContext_DELIVER: + case signalservice.GroupContext_DELIVER: if _, ok := groups[hexid]; !ok { return nil, UnknownGroupIDError{hexid} } groups[hexid].Flags = 0 - case textsecure.GroupContext_QUIT: + case signalservice.GroupContext_QUIT: if err := quitGroup(src, hexid); err != nil { return nil, err } @@ -184,7 +184,7 @@ type groupMessage struct { id []byte name string members []string - typ textsecure.GroupContext_Type + typ signalservice.GroupContext_Type } func sendGroupHelper(hexid string, msg string, a *att) (uint64, error) { @@ -202,7 +202,7 @@ func sendGroupHelper(hexid string, msg string, a *att) (uint64, error) { attachment: a, group: &groupMessage{ id: g.ID, - typ: textsecure.GroupContext_DELIVER, + typ: signalservice.GroupContext_DELIVER, }, } ts, err = sendMessage(omsg) @@ -273,7 +273,7 @@ func sendUpdate(g *Group) error { id: g.ID, name: g.Name, members: g.Members, - typ: textsecure.GroupContext_UPDATE, + typ: signalservice.GroupContext_UPDATE, }, } _, err := sendMessage(omsg) @@ -327,7 +327,7 @@ func LeaveGroup(hexid string) error { tel: m, group: &groupMessage{ id: g.ID, - typ: textsecure.GroupContext_QUIT, + typ: signalservice.GroupContext_QUIT, }, } _, err := sendMessage(omsg) diff --git a/prekeys.go b/prekeys.go index 08377ec..9284c09 100644 --- a/prekeys.go +++ b/prekeys.go @@ -8,8 +8,8 @@ import ( "path/filepath" "time" - "github.com/janimo/textsecure/axolotl" - "github.com/janimo/textsecure/curve25519sign" + "github.com/aebruno/textsecure/axolotl" + "github.com/aebruno/textsecure/curve25519sign" ) type preKeyEntity struct { diff --git a/protobuf/Makefile b/protobuf/Makefile new file mode 100644 index 0000000..8ce1c88 --- /dev/null +++ b/protobuf/Makefile @@ -0,0 +1,3 @@ + +all: + protoc --go_out=. SignalService.proto Provisioning.proto WebSocketResources.proto diff --git a/protobuf/Provisioning.pb.go b/protobuf/Provisioning.pb.go index 982422e..a091407 100644 --- a/protobuf/Provisioning.pb.go +++ b/protobuf/Provisioning.pb.go @@ -2,15 +2,15 @@ // source: Provisioning.proto // DO NOT EDIT! -package textsecure +package signalservice import proto "github.com/golang/protobuf/proto" -import json "encoding/json" +import fmt "fmt" import math "math" -// Reference proto, json, and math imports to suppress error if they are not otherwise used. +// Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal -var _ = &json.SyntaxError{} +var _ = fmt.Errorf var _ = math.Inf type ProvisionEnvelope struct { @@ -19,9 +19,10 @@ type ProvisionEnvelope struct { XXX_unrecognized []byte `json:"-"` } -func (m *ProvisionEnvelope) Reset() { *m = ProvisionEnvelope{} } -func (m *ProvisionEnvelope) String() string { return proto.CompactTextString(m) } -func (*ProvisionEnvelope) ProtoMessage() {} +func (m *ProvisionEnvelope) Reset() { *m = ProvisionEnvelope{} } +func (m *ProvisionEnvelope) String() string { return proto.CompactTextString(m) } +func (*ProvisionEnvelope) ProtoMessage() {} +func (*ProvisionEnvelope) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } func (m *ProvisionEnvelope) GetPublicKey() []byte { if m != nil { @@ -42,12 +43,16 @@ type ProvisionMessage struct { IdentityKeyPrivate []byte `protobuf:"bytes,2,opt,name=identityKeyPrivate" json:"identityKeyPrivate,omitempty"` Number *string `protobuf:"bytes,3,opt,name=number" json:"number,omitempty"` ProvisioningCode *string `protobuf:"bytes,4,opt,name=provisioningCode" json:"provisioningCode,omitempty"` + UserAgent *string `protobuf:"bytes,5,opt,name=userAgent" json:"userAgent,omitempty"` + ProfileKey []byte `protobuf:"bytes,6,opt,name=profileKey" json:"profileKey,omitempty"` + ReadReceipts *bool `protobuf:"varint,7,opt,name=readReceipts" json:"readReceipts,omitempty"` XXX_unrecognized []byte `json:"-"` } -func (m *ProvisionMessage) Reset() { *m = ProvisionMessage{} } -func (m *ProvisionMessage) String() string { return proto.CompactTextString(m) } -func (*ProvisionMessage) ProtoMessage() {} +func (m *ProvisionMessage) Reset() { *m = ProvisionMessage{} } +func (m *ProvisionMessage) String() string { return proto.CompactTextString(m) } +func (*ProvisionMessage) ProtoMessage() {} +func (*ProvisionMessage) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } func (m *ProvisionMessage) GetIdentityKeyPublic() []byte { if m != nil { @@ -77,5 +82,52 @@ func (m *ProvisionMessage) GetProvisioningCode() string { return "" } +func (m *ProvisionMessage) GetUserAgent() string { + if m != nil && m.UserAgent != nil { + return *m.UserAgent + } + return "" +} + +func (m *ProvisionMessage) GetProfileKey() []byte { + if m != nil { + return m.ProfileKey + } + return nil +} + +func (m *ProvisionMessage) GetReadReceipts() bool { + if m != nil && m.ReadReceipts != nil { + return *m.ReadReceipts + } + return false +} + func init() { + proto.RegisterType((*ProvisionEnvelope)(nil), "signalservice.ProvisionEnvelope") + proto.RegisterType((*ProvisionMessage)(nil), "signalservice.ProvisionMessage") +} + +func init() { proto.RegisterFile("Provisioning.proto", fileDescriptor1) } + +var fileDescriptor1 = []byte{ + // 280 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xd1, 0x6a, 0xf2, 0x40, + 0x10, 0x85, 0x89, 0xbf, 0xbf, 0xad, 0x83, 0x05, 0x9d, 0x8b, 0xb2, 0x17, 0xa5, 0x88, 0x57, 0x52, + 0xca, 0xb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0x08, 0xae, 0x60, 0xe6, 0x29, 0xcb, 0x53, 0x3a, 0x12, + 0xbb, 0x20, 0xea, 0x6e, 0x99, 0xac, 0xef, 0xd3, 0x01, 0xdb, 0x7c, 0x80, 0xb6, 0xbe, 0xd0, 0xdf, + 0x27, 0x16, 0x47, 0x5e, 0x1a, 0x09, 0x74, 0x16, 0x3d, 0xe8, 0x40, 0xb3, 0x09, 0xe4, 0x4d, 0x56, + 0x6a, 0x57, 0xc9, 0x69, 0x33, 0x28, 0x6d, 0xdf, 0x76, 0x26, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, + 0xfa, 0x84, 0x2a, 0x4b, 0xc9, 0x01, 0x00, 0x00, } diff --git a/protobuf/Provisioning.proto b/protobuf/Provisioning.proto index 776877c..92d8b7d 100644 --- a/protobuf/Provisioning.proto +++ b/protobuf/Provisioning.proto @@ -1,6 +1,12 @@ -package textsecure; +/** + * Copyright (C) 2014-2016 Open Whisper Systems + * + * Licensed according to the LICENSE file in this repository. + */ -option java_package = "org.whispersystems.textsecure.internal.push"; +package signalservice; + +option java_package = "org.whispersystems.signalservice.internal.push"; option java_outer_classname = "ProvisioningProtos"; message ProvisionEnvelope { @@ -13,4 +19,7 @@ message ProvisionMessage { optional bytes identityKeyPrivate = 2; optional string number = 3; optional string provisioningCode = 4; + optional string userAgent = 5; + optional bytes profileKey = 6; + optional bool readReceipts = 7; } diff --git a/protobuf/SignalService.pb.go b/protobuf/SignalService.pb.go new file mode 100644 index 0000000..f7eeb1b --- /dev/null +++ b/protobuf/SignalService.pb.go @@ -0,0 +1,1422 @@ +// Code generated by protoc-gen-go. +// source: SignalService.proto +// DO NOT EDIT! + +/* +Package signalservice is a generated protocol buffer package. + +It is generated from these files: + SignalService.proto + Provisioning.proto + WebSocketResources.proto + +It has these top-level messages: + Envelope + Content + CallMessage + DataMessage + NullMessage + ReceiptMessage + Verified + SyncMessage + AttachmentPointer + GroupContext + ContactDetails + GroupDetails + ProvisionEnvelope + ProvisionMessage + WebSocketRequestMessage + WebSocketResponseMessage + WebSocketMessage +*/ +package signalservice + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Envelope_Type int32 + +const ( + Envelope_UNKNOWN Envelope_Type = 0 + Envelope_CIPHERTEXT Envelope_Type = 1 + Envelope_KEY_EXCHANGE Envelope_Type = 2 + Envelope_PREKEY_BUNDLE Envelope_Type = 3 + Envelope_RECEIPT Envelope_Type = 5 +) + +var Envelope_Type_name = map[int32]string{ + 0: "UNKNOWN", + 1: "CIPHERTEXT", + 2: "KEY_EXCHANGE", + 3: "PREKEY_BUNDLE", + 5: "RECEIPT", +} +var Envelope_Type_value = map[string]int32{ + "UNKNOWN": 0, + "CIPHERTEXT": 1, + "KEY_EXCHANGE": 2, + "PREKEY_BUNDLE": 3, + "RECEIPT": 5, +} + +func (x Envelope_Type) Enum() *Envelope_Type { + p := new(Envelope_Type) + *p = x + return p +} +func (x Envelope_Type) String() string { + return proto.EnumName(Envelope_Type_name, int32(x)) +} +func (x *Envelope_Type) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Envelope_Type_value, data, "Envelope_Type") + if err != nil { + return err + } + *x = Envelope_Type(value) + return nil +} +func (Envelope_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} } + +type DataMessage_Flags int32 + +const ( + DataMessage_END_SESSION DataMessage_Flags = 1 + DataMessage_EXPIRATION_TIMER_UPDATE DataMessage_Flags = 2 + DataMessage_PROFILE_KEY_UPDATE DataMessage_Flags = 4 +) + +var DataMessage_Flags_name = map[int32]string{ + 1: "END_SESSION", + 2: "EXPIRATION_TIMER_UPDATE", + 4: "PROFILE_KEY_UPDATE", +} +var DataMessage_Flags_value = map[string]int32{ + "END_SESSION": 1, + "EXPIRATION_TIMER_UPDATE": 2, + "PROFILE_KEY_UPDATE": 4, +} + +func (x DataMessage_Flags) Enum() *DataMessage_Flags { + p := new(DataMessage_Flags) + *p = x + return p +} +func (x DataMessage_Flags) String() string { + return proto.EnumName(DataMessage_Flags_name, int32(x)) +} +func (x *DataMessage_Flags) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(DataMessage_Flags_value, data, "DataMessage_Flags") + if err != nil { + return err + } + *x = DataMessage_Flags(value) + return nil +} +func (DataMessage_Flags) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{3, 0} } + +type ReceiptMessage_Type int32 + +const ( + ReceiptMessage_DELIVERY ReceiptMessage_Type = 0 + ReceiptMessage_READ ReceiptMessage_Type = 1 +) + +var ReceiptMessage_Type_name = map[int32]string{ + 0: "DELIVERY", + 1: "READ", +} +var ReceiptMessage_Type_value = map[string]int32{ + "DELIVERY": 0, + "READ": 1, +} + +func (x ReceiptMessage_Type) Enum() *ReceiptMessage_Type { + p := new(ReceiptMessage_Type) + *p = x + return p +} +func (x ReceiptMessage_Type) String() string { + return proto.EnumName(ReceiptMessage_Type_name, int32(x)) +} +func (x *ReceiptMessage_Type) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ReceiptMessage_Type_value, data, "ReceiptMessage_Type") + if err != nil { + return err + } + *x = ReceiptMessage_Type(value) + return nil +} +func (ReceiptMessage_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 0} } + +type Verified_State int32 + +const ( + Verified_DEFAULT Verified_State = 0 + Verified_VERIFIED Verified_State = 1 + Verified_UNVERIFIED Verified_State = 2 +) + +var Verified_State_name = map[int32]string{ + 0: "DEFAULT", + 1: "VERIFIED", + 2: "UNVERIFIED", +} +var Verified_State_value = map[string]int32{ + "DEFAULT": 0, + "VERIFIED": 1, + "UNVERIFIED": 2, +} + +func (x Verified_State) Enum() *Verified_State { + p := new(Verified_State) + *p = x + return p +} +func (x Verified_State) String() string { + return proto.EnumName(Verified_State_name, int32(x)) +} +func (x *Verified_State) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Verified_State_value, data, "Verified_State") + if err != nil { + return err + } + *x = Verified_State(value) + return nil +} +func (Verified_State) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{6, 0} } + +type SyncMessage_Request_Type int32 + +const ( + SyncMessage_Request_UNKNOWN SyncMessage_Request_Type = 0 + SyncMessage_Request_CONTACTS SyncMessage_Request_Type = 1 + SyncMessage_Request_GROUPS SyncMessage_Request_Type = 2 + SyncMessage_Request_BLOCKED SyncMessage_Request_Type = 3 + SyncMessage_Request_CONFIGURATION SyncMessage_Request_Type = 4 +) + +var SyncMessage_Request_Type_name = map[int32]string{ + 0: "UNKNOWN", + 1: "CONTACTS", + 2: "GROUPS", + 3: "BLOCKED", + 4: "CONFIGURATION", +} +var SyncMessage_Request_Type_value = map[string]int32{ + "UNKNOWN": 0, + "CONTACTS": 1, + "GROUPS": 2, + "BLOCKED": 3, + "CONFIGURATION": 4, +} + +func (x SyncMessage_Request_Type) Enum() *SyncMessage_Request_Type { + p := new(SyncMessage_Request_Type) + *p = x + return p +} +func (x SyncMessage_Request_Type) String() string { + return proto.EnumName(SyncMessage_Request_Type_name, int32(x)) +} +func (x *SyncMessage_Request_Type) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(SyncMessage_Request_Type_value, data, "SyncMessage_Request_Type") + if err != nil { + return err + } + *x = SyncMessage_Request_Type(value) + return nil +} +func (SyncMessage_Request_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{7, 4, 0} +} + +type AttachmentPointer_Flags int32 + +const ( + AttachmentPointer_VOICE_MESSAGE AttachmentPointer_Flags = 1 +) + +var AttachmentPointer_Flags_name = map[int32]string{ + 1: "VOICE_MESSAGE", +} +var AttachmentPointer_Flags_value = map[string]int32{ + "VOICE_MESSAGE": 1, +} + +func (x AttachmentPointer_Flags) Enum() *AttachmentPointer_Flags { + p := new(AttachmentPointer_Flags) + *p = x + return p +} +func (x AttachmentPointer_Flags) String() string { + return proto.EnumName(AttachmentPointer_Flags_name, int32(x)) +} +func (x *AttachmentPointer_Flags) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(AttachmentPointer_Flags_value, data, "AttachmentPointer_Flags") + if err != nil { + return err + } + *x = AttachmentPointer_Flags(value) + return nil +} +func (AttachmentPointer_Flags) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{8, 0} } + +type GroupContext_Type int32 + +const ( + GroupContext_UNKNOWN GroupContext_Type = 0 + GroupContext_UPDATE GroupContext_Type = 1 + GroupContext_DELIVER GroupContext_Type = 2 + GroupContext_QUIT GroupContext_Type = 3 + GroupContext_REQUEST_INFO GroupContext_Type = 4 +) + +var GroupContext_Type_name = map[int32]string{ + 0: "UNKNOWN", + 1: "UPDATE", + 2: "DELIVER", + 3: "QUIT", + 4: "REQUEST_INFO", +} +var GroupContext_Type_value = map[string]int32{ + "UNKNOWN": 0, + "UPDATE": 1, + "DELIVER": 2, + "QUIT": 3, + "REQUEST_INFO": 4, +} + +func (x GroupContext_Type) Enum() *GroupContext_Type { + p := new(GroupContext_Type) + *p = x + return p +} +func (x GroupContext_Type) String() string { + return proto.EnumName(GroupContext_Type_name, int32(x)) +} +func (x *GroupContext_Type) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(GroupContext_Type_value, data, "GroupContext_Type") + if err != nil { + return err + } + *x = GroupContext_Type(value) + return nil +} +func (GroupContext_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{9, 0} } + +type Envelope struct { + Type *Envelope_Type `protobuf:"varint,1,opt,name=type,enum=signalservice.Envelope_Type" json:"type,omitempty"` + Source *string `protobuf:"bytes,2,opt,name=source" json:"source,omitempty"` + SourceDevice *uint32 `protobuf:"varint,7,opt,name=sourceDevice" json:"sourceDevice,omitempty"` + Relay *string `protobuf:"bytes,3,opt,name=relay" json:"relay,omitempty"` + Timestamp *uint64 `protobuf:"varint,5,opt,name=timestamp" json:"timestamp,omitempty"` + LegacyMessage []byte `protobuf:"bytes,6,opt,name=legacyMessage" json:"legacyMessage,omitempty"` + Content []byte `protobuf:"bytes,8,opt,name=content" json:"content,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Envelope) Reset() { *m = Envelope{} } +func (m *Envelope) String() string { return proto.CompactTextString(m) } +func (*Envelope) ProtoMessage() {} +func (*Envelope) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *Envelope) GetType() Envelope_Type { + if m != nil && m.Type != nil { + return *m.Type + } + return Envelope_UNKNOWN +} + +func (m *Envelope) GetSource() string { + if m != nil && m.Source != nil { + return *m.Source + } + return "" +} + +func (m *Envelope) GetSourceDevice() uint32 { + if m != nil && m.SourceDevice != nil { + return *m.SourceDevice + } + return 0 +} + +func (m *Envelope) GetRelay() string { + if m != nil && m.Relay != nil { + return *m.Relay + } + return "" +} + +func (m *Envelope) GetTimestamp() uint64 { + if m != nil && m.Timestamp != nil { + return *m.Timestamp + } + return 0 +} + +func (m *Envelope) GetLegacyMessage() []byte { + if m != nil { + return m.LegacyMessage + } + return nil +} + +func (m *Envelope) GetContent() []byte { + if m != nil { + return m.Content + } + return nil +} + +type Content struct { + DataMessage *DataMessage `protobuf:"bytes,1,opt,name=dataMessage" json:"dataMessage,omitempty"` + SyncMessage *SyncMessage `protobuf:"bytes,2,opt,name=syncMessage" json:"syncMessage,omitempty"` + CallMessage *CallMessage `protobuf:"bytes,3,opt,name=callMessage" json:"callMessage,omitempty"` + NullMessage *NullMessage `protobuf:"bytes,4,opt,name=nullMessage" json:"nullMessage,omitempty"` + ReceiptMessage *ReceiptMessage `protobuf:"bytes,5,opt,name=receiptMessage" json:"receiptMessage,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Content) Reset() { *m = Content{} } +func (m *Content) String() string { return proto.CompactTextString(m) } +func (*Content) ProtoMessage() {} +func (*Content) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *Content) GetDataMessage() *DataMessage { + if m != nil { + return m.DataMessage + } + return nil +} + +func (m *Content) GetSyncMessage() *SyncMessage { + if m != nil { + return m.SyncMessage + } + return nil +} + +func (m *Content) GetCallMessage() *CallMessage { + if m != nil { + return m.CallMessage + } + return nil +} + +func (m *Content) GetNullMessage() *NullMessage { + if m != nil { + return m.NullMessage + } + return nil +} + +func (m *Content) GetReceiptMessage() *ReceiptMessage { + if m != nil { + return m.ReceiptMessage + } + return nil +} + +type CallMessage struct { + Offer *CallMessage_Offer `protobuf:"bytes,1,opt,name=offer" json:"offer,omitempty"` + Answer *CallMessage_Answer `protobuf:"bytes,2,opt,name=answer" json:"answer,omitempty"` + IceUpdate []*CallMessage_IceUpdate `protobuf:"bytes,3,rep,name=iceUpdate" json:"iceUpdate,omitempty"` + Hangup *CallMessage_Hangup `protobuf:"bytes,4,opt,name=hangup" json:"hangup,omitempty"` + Busy *CallMessage_Busy `protobuf:"bytes,5,opt,name=busy" json:"busy,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CallMessage) Reset() { *m = CallMessage{} } +func (m *CallMessage) String() string { return proto.CompactTextString(m) } +func (*CallMessage) ProtoMessage() {} +func (*CallMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *CallMessage) GetOffer() *CallMessage_Offer { + if m != nil { + return m.Offer + } + return nil +} + +func (m *CallMessage) GetAnswer() *CallMessage_Answer { + if m != nil { + return m.Answer + } + return nil +} + +func (m *CallMessage) GetIceUpdate() []*CallMessage_IceUpdate { + if m != nil { + return m.IceUpdate + } + return nil +} + +func (m *CallMessage) GetHangup() *CallMessage_Hangup { + if m != nil { + return m.Hangup + } + return nil +} + +func (m *CallMessage) GetBusy() *CallMessage_Busy { + if m != nil { + return m.Busy + } + return nil +} + +type CallMessage_Offer struct { + Id *uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + Description *string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CallMessage_Offer) Reset() { *m = CallMessage_Offer{} } +func (m *CallMessage_Offer) String() string { return proto.CompactTextString(m) } +func (*CallMessage_Offer) ProtoMessage() {} +func (*CallMessage_Offer) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } + +func (m *CallMessage_Offer) GetId() uint64 { + if m != nil && m.Id != nil { + return *m.Id + } + return 0 +} + +func (m *CallMessage_Offer) GetDescription() string { + if m != nil && m.Description != nil { + return *m.Description + } + return "" +} + +type CallMessage_Answer struct { + Id *uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + Description *string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CallMessage_Answer) Reset() { *m = CallMessage_Answer{} } +func (m *CallMessage_Answer) String() string { return proto.CompactTextString(m) } +func (*CallMessage_Answer) ProtoMessage() {} +func (*CallMessage_Answer) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 1} } + +func (m *CallMessage_Answer) GetId() uint64 { + if m != nil && m.Id != nil { + return *m.Id + } + return 0 +} + +func (m *CallMessage_Answer) GetDescription() string { + if m != nil && m.Description != nil { + return *m.Description + } + return "" +} + +type CallMessage_IceUpdate struct { + Id *uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + SdpMid *string `protobuf:"bytes,2,opt,name=sdpMid" json:"sdpMid,omitempty"` + SdpMLineIndex *uint32 `protobuf:"varint,3,opt,name=sdpMLineIndex" json:"sdpMLineIndex,omitempty"` + Sdp *string `protobuf:"bytes,4,opt,name=sdp" json:"sdp,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CallMessage_IceUpdate) Reset() { *m = CallMessage_IceUpdate{} } +func (m *CallMessage_IceUpdate) String() string { return proto.CompactTextString(m) } +func (*CallMessage_IceUpdate) ProtoMessage() {} +func (*CallMessage_IceUpdate) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 2} } + +func (m *CallMessage_IceUpdate) GetId() uint64 { + if m != nil && m.Id != nil { + return *m.Id + } + return 0 +} + +func (m *CallMessage_IceUpdate) GetSdpMid() string { + if m != nil && m.SdpMid != nil { + return *m.SdpMid + } + return "" +} + +func (m *CallMessage_IceUpdate) GetSdpMLineIndex() uint32 { + if m != nil && m.SdpMLineIndex != nil { + return *m.SdpMLineIndex + } + return 0 +} + +func (m *CallMessage_IceUpdate) GetSdp() string { + if m != nil && m.Sdp != nil { + return *m.Sdp + } + return "" +} + +type CallMessage_Busy struct { + Id *uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CallMessage_Busy) Reset() { *m = CallMessage_Busy{} } +func (m *CallMessage_Busy) String() string { return proto.CompactTextString(m) } +func (*CallMessage_Busy) ProtoMessage() {} +func (*CallMessage_Busy) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 3} } + +func (m *CallMessage_Busy) GetId() uint64 { + if m != nil && m.Id != nil { + return *m.Id + } + return 0 +} + +type CallMessage_Hangup struct { + Id *uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CallMessage_Hangup) Reset() { *m = CallMessage_Hangup{} } +func (m *CallMessage_Hangup) String() string { return proto.CompactTextString(m) } +func (*CallMessage_Hangup) ProtoMessage() {} +func (*CallMessage_Hangup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 4} } + +func (m *CallMessage_Hangup) GetId() uint64 { + if m != nil && m.Id != nil { + return *m.Id + } + return 0 +} + +type DataMessage struct { + Body *string `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + Attachments []*AttachmentPointer `protobuf:"bytes,2,rep,name=attachments" json:"attachments,omitempty"` + Group *GroupContext `protobuf:"bytes,3,opt,name=group" json:"group,omitempty"` + Flags *uint32 `protobuf:"varint,4,opt,name=flags" json:"flags,omitempty"` + ExpireTimer *uint32 `protobuf:"varint,5,opt,name=expireTimer" json:"expireTimer,omitempty"` + ProfileKey []byte `protobuf:"bytes,6,opt,name=profileKey" json:"profileKey,omitempty"` + Timestamp *uint64 `protobuf:"varint,7,opt,name=timestamp" json:"timestamp,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DataMessage) Reset() { *m = DataMessage{} } +func (m *DataMessage) String() string { return proto.CompactTextString(m) } +func (*DataMessage) ProtoMessage() {} +func (*DataMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *DataMessage) GetBody() string { + if m != nil && m.Body != nil { + return *m.Body + } + return "" +} + +func (m *DataMessage) GetAttachments() []*AttachmentPointer { + if m != nil { + return m.Attachments + } + return nil +} + +func (m *DataMessage) GetGroup() *GroupContext { + if m != nil { + return m.Group + } + return nil +} + +func (m *DataMessage) GetFlags() uint32 { + if m != nil && m.Flags != nil { + return *m.Flags + } + return 0 +} + +func (m *DataMessage) GetExpireTimer() uint32 { + if m != nil && m.ExpireTimer != nil { + return *m.ExpireTimer + } + return 0 +} + +func (m *DataMessage) GetProfileKey() []byte { + if m != nil { + return m.ProfileKey + } + return nil +} + +func (m *DataMessage) GetTimestamp() uint64 { + if m != nil && m.Timestamp != nil { + return *m.Timestamp + } + return 0 +} + +type NullMessage struct { + Padding []byte `protobuf:"bytes,1,opt,name=padding" json:"padding,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *NullMessage) Reset() { *m = NullMessage{} } +func (m *NullMessage) String() string { return proto.CompactTextString(m) } +func (*NullMessage) ProtoMessage() {} +func (*NullMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *NullMessage) GetPadding() []byte { + if m != nil { + return m.Padding + } + return nil +} + +type ReceiptMessage struct { + Type *ReceiptMessage_Type `protobuf:"varint,1,opt,name=type,enum=signalservice.ReceiptMessage_Type" json:"type,omitempty"` + Timestamp []uint64 `protobuf:"varint,2,rep,name=timestamp" json:"timestamp,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ReceiptMessage) Reset() { *m = ReceiptMessage{} } +func (m *ReceiptMessage) String() string { return proto.CompactTextString(m) } +func (*ReceiptMessage) ProtoMessage() {} +func (*ReceiptMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *ReceiptMessage) GetType() ReceiptMessage_Type { + if m != nil && m.Type != nil { + return *m.Type + } + return ReceiptMessage_DELIVERY +} + +func (m *ReceiptMessage) GetTimestamp() []uint64 { + if m != nil { + return m.Timestamp + } + return nil +} + +type Verified struct { + Destination *string `protobuf:"bytes,1,opt,name=destination" json:"destination,omitempty"` + IdentityKey []byte `protobuf:"bytes,2,opt,name=identityKey" json:"identityKey,omitempty"` + State *Verified_State `protobuf:"varint,3,opt,name=state,enum=signalservice.Verified_State" json:"state,omitempty"` + NullMessage []byte `protobuf:"bytes,4,opt,name=nullMessage" json:"nullMessage,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Verified) Reset() { *m = Verified{} } +func (m *Verified) String() string { return proto.CompactTextString(m) } +func (*Verified) ProtoMessage() {} +func (*Verified) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *Verified) GetDestination() string { + if m != nil && m.Destination != nil { + return *m.Destination + } + return "" +} + +func (m *Verified) GetIdentityKey() []byte { + if m != nil { + return m.IdentityKey + } + return nil +} + +func (m *Verified) GetState() Verified_State { + if m != nil && m.State != nil { + return *m.State + } + return Verified_DEFAULT +} + +func (m *Verified) GetNullMessage() []byte { + if m != nil { + return m.NullMessage + } + return nil +} + +type SyncMessage struct { + Sent *SyncMessage_Sent `protobuf:"bytes,1,opt,name=sent" json:"sent,omitempty"` + Contacts *SyncMessage_Contacts `protobuf:"bytes,2,opt,name=contacts" json:"contacts,omitempty"` + Groups *SyncMessage_Groups `protobuf:"bytes,3,opt,name=groups" json:"groups,omitempty"` + Request *SyncMessage_Request `protobuf:"bytes,4,opt,name=request" json:"request,omitempty"` + Read []*SyncMessage_Read `protobuf:"bytes,5,rep,name=read" json:"read,omitempty"` + Blocked *SyncMessage_Blocked `protobuf:"bytes,6,opt,name=blocked" json:"blocked,omitempty"` + Verified *Verified `protobuf:"bytes,7,opt,name=verified" json:"verified,omitempty"` + Configuration *SyncMessage_Configuration `protobuf:"bytes,9,opt,name=configuration" json:"configuration,omitempty"` + Padding []byte `protobuf:"bytes,8,opt,name=padding" json:"padding,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SyncMessage) Reset() { *m = SyncMessage{} } +func (m *SyncMessage) String() string { return proto.CompactTextString(m) } +func (*SyncMessage) ProtoMessage() {} +func (*SyncMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *SyncMessage) GetSent() *SyncMessage_Sent { + if m != nil { + return m.Sent + } + return nil +} + +func (m *SyncMessage) GetContacts() *SyncMessage_Contacts { + if m != nil { + return m.Contacts + } + return nil +} + +func (m *SyncMessage) GetGroups() *SyncMessage_Groups { + if m != nil { + return m.Groups + } + return nil +} + +func (m *SyncMessage) GetRequest() *SyncMessage_Request { + if m != nil { + return m.Request + } + return nil +} + +func (m *SyncMessage) GetRead() []*SyncMessage_Read { + if m != nil { + return m.Read + } + return nil +} + +func (m *SyncMessage) GetBlocked() *SyncMessage_Blocked { + if m != nil { + return m.Blocked + } + return nil +} + +func (m *SyncMessage) GetVerified() *Verified { + if m != nil { + return m.Verified + } + return nil +} + +func (m *SyncMessage) GetConfiguration() *SyncMessage_Configuration { + if m != nil { + return m.Configuration + } + return nil +} + +func (m *SyncMessage) GetPadding() []byte { + if m != nil { + return m.Padding + } + return nil +} + +type SyncMessage_Sent struct { + Destination *string `protobuf:"bytes,1,opt,name=destination" json:"destination,omitempty"` + Timestamp *uint64 `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"` + Message *DataMessage `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` + ExpirationStartTimestamp *uint64 `protobuf:"varint,4,opt,name=expirationStartTimestamp" json:"expirationStartTimestamp,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SyncMessage_Sent) Reset() { *m = SyncMessage_Sent{} } +func (m *SyncMessage_Sent) String() string { return proto.CompactTextString(m) } +func (*SyncMessage_Sent) ProtoMessage() {} +func (*SyncMessage_Sent) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 0} } + +func (m *SyncMessage_Sent) GetDestination() string { + if m != nil && m.Destination != nil { + return *m.Destination + } + return "" +} + +func (m *SyncMessage_Sent) GetTimestamp() uint64 { + if m != nil && m.Timestamp != nil { + return *m.Timestamp + } + return 0 +} + +func (m *SyncMessage_Sent) GetMessage() *DataMessage { + if m != nil { + return m.Message + } + return nil +} + +func (m *SyncMessage_Sent) GetExpirationStartTimestamp() uint64 { + if m != nil && m.ExpirationStartTimestamp != nil { + return *m.ExpirationStartTimestamp + } + return 0 +} + +type SyncMessage_Contacts struct { + Blob *AttachmentPointer `protobuf:"bytes,1,opt,name=blob" json:"blob,omitempty"` + Complete *bool `protobuf:"varint,2,opt,name=complete,def=0" json:"complete,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SyncMessage_Contacts) Reset() { *m = SyncMessage_Contacts{} } +func (m *SyncMessage_Contacts) String() string { return proto.CompactTextString(m) } +func (*SyncMessage_Contacts) ProtoMessage() {} +func (*SyncMessage_Contacts) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 1} } + +const Default_SyncMessage_Contacts_Complete bool = false + +func (m *SyncMessage_Contacts) GetBlob() *AttachmentPointer { + if m != nil { + return m.Blob + } + return nil +} + +func (m *SyncMessage_Contacts) GetComplete() bool { + if m != nil && m.Complete != nil { + return *m.Complete + } + return Default_SyncMessage_Contacts_Complete +} + +type SyncMessage_Groups struct { + Blob *AttachmentPointer `protobuf:"bytes,1,opt,name=blob" json:"blob,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SyncMessage_Groups) Reset() { *m = SyncMessage_Groups{} } +func (m *SyncMessage_Groups) String() string { return proto.CompactTextString(m) } +func (*SyncMessage_Groups) ProtoMessage() {} +func (*SyncMessage_Groups) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 2} } + +func (m *SyncMessage_Groups) GetBlob() *AttachmentPointer { + if m != nil { + return m.Blob + } + return nil +} + +type SyncMessage_Blocked struct { + Numbers []string `protobuf:"bytes,1,rep,name=numbers" json:"numbers,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SyncMessage_Blocked) Reset() { *m = SyncMessage_Blocked{} } +func (m *SyncMessage_Blocked) String() string { return proto.CompactTextString(m) } +func (*SyncMessage_Blocked) ProtoMessage() {} +func (*SyncMessage_Blocked) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 3} } + +func (m *SyncMessage_Blocked) GetNumbers() []string { + if m != nil { + return m.Numbers + } + return nil +} + +type SyncMessage_Request struct { + Type *SyncMessage_Request_Type `protobuf:"varint,1,opt,name=type,enum=signalservice.SyncMessage_Request_Type" json:"type,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SyncMessage_Request) Reset() { *m = SyncMessage_Request{} } +func (m *SyncMessage_Request) String() string { return proto.CompactTextString(m) } +func (*SyncMessage_Request) ProtoMessage() {} +func (*SyncMessage_Request) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 4} } + +func (m *SyncMessage_Request) GetType() SyncMessage_Request_Type { + if m != nil && m.Type != nil { + return *m.Type + } + return SyncMessage_Request_UNKNOWN +} + +type SyncMessage_Read struct { + Sender *string `protobuf:"bytes,1,opt,name=sender" json:"sender,omitempty"` + Timestamp *uint64 `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SyncMessage_Read) Reset() { *m = SyncMessage_Read{} } +func (m *SyncMessage_Read) String() string { return proto.CompactTextString(m) } +func (*SyncMessage_Read) ProtoMessage() {} +func (*SyncMessage_Read) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 5} } + +func (m *SyncMessage_Read) GetSender() string { + if m != nil && m.Sender != nil { + return *m.Sender + } + return "" +} + +func (m *SyncMessage_Read) GetTimestamp() uint64 { + if m != nil && m.Timestamp != nil { + return *m.Timestamp + } + return 0 +} + +type SyncMessage_Configuration struct { + ReadReceipts *bool `protobuf:"varint,1,opt,name=readReceipts" json:"readReceipts,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SyncMessage_Configuration) Reset() { *m = SyncMessage_Configuration{} } +func (m *SyncMessage_Configuration) String() string { return proto.CompactTextString(m) } +func (*SyncMessage_Configuration) ProtoMessage() {} +func (*SyncMessage_Configuration) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 6} } + +func (m *SyncMessage_Configuration) GetReadReceipts() bool { + if m != nil && m.ReadReceipts != nil { + return *m.ReadReceipts + } + return false +} + +type AttachmentPointer struct { + Id *uint64 `protobuf:"fixed64,1,opt,name=id" json:"id,omitempty"` + ContentType *string `protobuf:"bytes,2,opt,name=contentType" json:"contentType,omitempty"` + Key []byte `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"` + Size *uint32 `protobuf:"varint,4,opt,name=size" json:"size,omitempty"` + Thumbnail []byte `protobuf:"bytes,5,opt,name=thumbnail" json:"thumbnail,omitempty"` + Digest []byte `protobuf:"bytes,6,opt,name=digest" json:"digest,omitempty"` + FileName *string `protobuf:"bytes,7,opt,name=fileName" json:"fileName,omitempty"` + Flags *uint32 `protobuf:"varint,8,opt,name=flags" json:"flags,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *AttachmentPointer) Reset() { *m = AttachmentPointer{} } +func (m *AttachmentPointer) String() string { return proto.CompactTextString(m) } +func (*AttachmentPointer) ProtoMessage() {} +func (*AttachmentPointer) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *AttachmentPointer) GetId() uint64 { + if m != nil && m.Id != nil { + return *m.Id + } + return 0 +} + +func (m *AttachmentPointer) GetContentType() string { + if m != nil && m.ContentType != nil { + return *m.ContentType + } + return "" +} + +func (m *AttachmentPointer) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *AttachmentPointer) GetSize() uint32 { + if m != nil && m.Size != nil { + return *m.Size + } + return 0 +} + +func (m *AttachmentPointer) GetThumbnail() []byte { + if m != nil { + return m.Thumbnail + } + return nil +} + +func (m *AttachmentPointer) GetDigest() []byte { + if m != nil { + return m.Digest + } + return nil +} + +func (m *AttachmentPointer) GetFileName() string { + if m != nil && m.FileName != nil { + return *m.FileName + } + return "" +} + +func (m *AttachmentPointer) GetFlags() uint32 { + if m != nil && m.Flags != nil { + return *m.Flags + } + return 0 +} + +type GroupContext struct { + Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Type *GroupContext_Type `protobuf:"varint,2,opt,name=type,enum=signalservice.GroupContext_Type" json:"type,omitempty"` + Name *string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` + Members []string `protobuf:"bytes,4,rep,name=members" json:"members,omitempty"` + Avatar *AttachmentPointer `protobuf:"bytes,5,opt,name=avatar" json:"avatar,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *GroupContext) Reset() { *m = GroupContext{} } +func (m *GroupContext) String() string { return proto.CompactTextString(m) } +func (*GroupContext) ProtoMessage() {} +func (*GroupContext) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *GroupContext) GetId() []byte { + if m != nil { + return m.Id + } + return nil +} + +func (m *GroupContext) GetType() GroupContext_Type { + if m != nil && m.Type != nil { + return *m.Type + } + return GroupContext_UNKNOWN +} + +func (m *GroupContext) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *GroupContext) GetMembers() []string { + if m != nil { + return m.Members + } + return nil +} + +func (m *GroupContext) GetAvatar() *AttachmentPointer { + if m != nil { + return m.Avatar + } + return nil +} + +type ContactDetails struct { + Number *string `protobuf:"bytes,1,opt,name=number" json:"number,omitempty"` + Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + Avatar *ContactDetails_Avatar `protobuf:"bytes,3,opt,name=avatar" json:"avatar,omitempty"` + Color *string `protobuf:"bytes,4,opt,name=color" json:"color,omitempty"` + Verified *Verified `protobuf:"bytes,5,opt,name=verified" json:"verified,omitempty"` + ProfileKey []byte `protobuf:"bytes,6,opt,name=profileKey" json:"profileKey,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ContactDetails) Reset() { *m = ContactDetails{} } +func (m *ContactDetails) String() string { return proto.CompactTextString(m) } +func (*ContactDetails) ProtoMessage() {} +func (*ContactDetails) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } + +func (m *ContactDetails) GetNumber() string { + if m != nil && m.Number != nil { + return *m.Number + } + return "" +} + +func (m *ContactDetails) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *ContactDetails) GetAvatar() *ContactDetails_Avatar { + if m != nil { + return m.Avatar + } + return nil +} + +func (m *ContactDetails) GetColor() string { + if m != nil && m.Color != nil { + return *m.Color + } + return "" +} + +func (m *ContactDetails) GetVerified() *Verified { + if m != nil { + return m.Verified + } + return nil +} + +func (m *ContactDetails) GetProfileKey() []byte { + if m != nil { + return m.ProfileKey + } + return nil +} + +type ContactDetails_Avatar struct { + ContentType *string `protobuf:"bytes,1,opt,name=contentType" json:"contentType,omitempty"` + Length *uint32 `protobuf:"varint,2,opt,name=length" json:"length,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ContactDetails_Avatar) Reset() { *m = ContactDetails_Avatar{} } +func (m *ContactDetails_Avatar) String() string { return proto.CompactTextString(m) } +func (*ContactDetails_Avatar) ProtoMessage() {} +func (*ContactDetails_Avatar) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10, 0} } + +func (m *ContactDetails_Avatar) GetContentType() string { + if m != nil && m.ContentType != nil { + return *m.ContentType + } + return "" +} + +func (m *ContactDetails_Avatar) GetLength() uint32 { + if m != nil && m.Length != nil { + return *m.Length + } + return 0 +} + +type GroupDetails struct { + Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + Members []string `protobuf:"bytes,3,rep,name=members" json:"members,omitempty"` + Avatar *GroupDetails_Avatar `protobuf:"bytes,4,opt,name=avatar" json:"avatar,omitempty"` + Active *bool `protobuf:"varint,5,opt,name=active,def=1" json:"active,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *GroupDetails) Reset() { *m = GroupDetails{} } +func (m *GroupDetails) String() string { return proto.CompactTextString(m) } +func (*GroupDetails) ProtoMessage() {} +func (*GroupDetails) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +const Default_GroupDetails_Active bool = true + +func (m *GroupDetails) GetId() []byte { + if m != nil { + return m.Id + } + return nil +} + +func (m *GroupDetails) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *GroupDetails) GetMembers() []string { + if m != nil { + return m.Members + } + return nil +} + +func (m *GroupDetails) GetAvatar() *GroupDetails_Avatar { + if m != nil { + return m.Avatar + } + return nil +} + +func (m *GroupDetails) GetActive() bool { + if m != nil && m.Active != nil { + return *m.Active + } + return Default_GroupDetails_Active +} + +type GroupDetails_Avatar struct { + ContentType *string `protobuf:"bytes,1,opt,name=contentType" json:"contentType,omitempty"` + Length *uint32 `protobuf:"varint,2,opt,name=length" json:"length,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *GroupDetails_Avatar) Reset() { *m = GroupDetails_Avatar{} } +func (m *GroupDetails_Avatar) String() string { return proto.CompactTextString(m) } +func (*GroupDetails_Avatar) ProtoMessage() {} +func (*GroupDetails_Avatar) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11, 0} } + +func (m *GroupDetails_Avatar) GetContentType() string { + if m != nil && m.ContentType != nil { + return *m.ContentType + } + return "" +} + +func (m *GroupDetails_Avatar) GetLength() uint32 { + if m != nil && m.Length != nil { + return *m.Length + } + return 0 +} + +func init() { + proto.RegisterType((*Envelope)(nil), "signalservice.Envelope") + proto.RegisterType((*Content)(nil), "signalservice.Content") + proto.RegisterType((*CallMessage)(nil), "signalservice.CallMessage") + proto.RegisterType((*CallMessage_Offer)(nil), "signalservice.CallMessage.Offer") + proto.RegisterType((*CallMessage_Answer)(nil), "signalservice.CallMessage.Answer") + proto.RegisterType((*CallMessage_IceUpdate)(nil), "signalservice.CallMessage.IceUpdate") + proto.RegisterType((*CallMessage_Busy)(nil), "signalservice.CallMessage.Busy") + proto.RegisterType((*CallMessage_Hangup)(nil), "signalservice.CallMessage.Hangup") + proto.RegisterType((*DataMessage)(nil), "signalservice.DataMessage") + proto.RegisterType((*NullMessage)(nil), "signalservice.NullMessage") + proto.RegisterType((*ReceiptMessage)(nil), "signalservice.ReceiptMessage") + proto.RegisterType((*Verified)(nil), "signalservice.Verified") + proto.RegisterType((*SyncMessage)(nil), "signalservice.SyncMessage") + proto.RegisterType((*SyncMessage_Sent)(nil), "signalservice.SyncMessage.Sent") + proto.RegisterType((*SyncMessage_Contacts)(nil), "signalservice.SyncMessage.Contacts") + proto.RegisterType((*SyncMessage_Groups)(nil), "signalservice.SyncMessage.Groups") + proto.RegisterType((*SyncMessage_Blocked)(nil), "signalservice.SyncMessage.Blocked") + proto.RegisterType((*SyncMessage_Request)(nil), "signalservice.SyncMessage.Request") + proto.RegisterType((*SyncMessage_Read)(nil), "signalservice.SyncMessage.Read") + proto.RegisterType((*SyncMessage_Configuration)(nil), "signalservice.SyncMessage.Configuration") + proto.RegisterType((*AttachmentPointer)(nil), "signalservice.AttachmentPointer") + proto.RegisterType((*GroupContext)(nil), "signalservice.GroupContext") + proto.RegisterType((*ContactDetails)(nil), "signalservice.ContactDetails") + proto.RegisterType((*ContactDetails_Avatar)(nil), "signalservice.ContactDetails.Avatar") + proto.RegisterType((*GroupDetails)(nil), "signalservice.GroupDetails") + proto.RegisterType((*GroupDetails_Avatar)(nil), "signalservice.GroupDetails.Avatar") + proto.RegisterEnum("signalservice.Envelope_Type", Envelope_Type_name, Envelope_Type_value) + proto.RegisterEnum("signalservice.DataMessage_Flags", DataMessage_Flags_name, DataMessage_Flags_value) + proto.RegisterEnum("signalservice.ReceiptMessage_Type", ReceiptMessage_Type_name, ReceiptMessage_Type_value) + proto.RegisterEnum("signalservice.Verified_State", Verified_State_name, Verified_State_value) + proto.RegisterEnum("signalservice.SyncMessage_Request_Type", SyncMessage_Request_Type_name, SyncMessage_Request_Type_value) + proto.RegisterEnum("signalservice.AttachmentPointer_Flags", AttachmentPointer_Flags_name, AttachmentPointer_Flags_value) + proto.RegisterEnum("signalservice.GroupContext_Type", GroupContext_Type_name, GroupContext_Type_value) +} + +func init() { proto.RegisterFile("SignalService.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 1670 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd, 0x6e, 0xdb, 0xca, + 0x15, 0x0e, 0x29, 0xea, 0xef, 0x48, 0x72, 0x99, 0x69, 0xe1, 0x08, 0x4a, 0x9a, 0x28, 0x4c, 0x80, + 0x68, 0x25, 0xb4, 0x76, 0x10, 0x34, 0xae, 0xd1, 0x42, 0x3f, 0xb4, 0x4d, 0xd8, 0x96, 0x94, 0x91, + 0xe4, 0x26, 0x2b, 0x83, 0x26, 0xc7, 0x32, 0x11, 0x8a, 0x64, 0x49, 0xca, 0x89, 0xfa, 0x00, 0x79, + 0x83, 0x6e, 0xbb, 0xef, 0x1b, 0x74, 0xdf, 0x4d, 0xd1, 0x37, 0xb8, 0x8b, 0xfb, 0x02, 0x77, 0x73, + 0x5f, 0xe1, 0x62, 0x86, 0x43, 0x89, 0xa4, 0x65, 0x25, 0x08, 0xee, 0x8e, 0x73, 0xf4, 0x7d, 0x33, + 0x3c, 0x67, 0xce, 0xf9, 0xce, 0xa1, 0x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xfd, 0x70, + 0xa9, 0xbe, 0xef, 0x9d, 0x74, 0x06, 0xc7, 0xaa, 0x2c, 0xa2, 0x87, 0x50, 0x1b, 0x61, 0x95, 0x1a, + 0xbb, 0xd3, 0x41, 0xff, 0x4c, 0x95, 0x73, 0x74, 0x07, 0xac, 0xf6, 0x54, 0x6d, 0x34, 0x91, 0xf3, + 0xca, 0xff, 0x44, 0x28, 0xf6, 0xa2, 0x23, 0xd0, 0x21, 0x54, 0x4c, 0x3d, 0xd4, 0xe3, 0x17, 0xa4, + 0xb1, 0xac, 0xec, 0x35, 0x32, 0xb1, 0xec, 0xaf, 0x11, 0x38, 0x09, 0xa7, 0xec, 0x60, 0xe9, 0x18, + 0x31, 0x5b, 0xdc, 0xc8, 0x1e, 0xaf, 0x11, 0x38, 0x09, 0xa7, 0x6c, 0x43, 0xb7, 0xed, 0x98, 0x9d, + 0xdb, 0xc8, 0xee, 0xad, 0x11, 0x38, 0x09, 0xa7, 0x6c, 0x67, 0xb1, 0x66, 0x4b, 0x1b, 0xd9, 0x83, + 0x45, 0x82, 0x9d, 0x80, 0x23, 0x15, 0x76, 0x7c, 0x62, 0x10, 0xcb, 0x0b, 0xe3, 0x0d, 0xf2, 0x6c, + 0x83, 0xdf, 0x67, 0x36, 0xc0, 0x29, 0x10, 0xce, 0x90, 0x94, 0xff, 0x4b, 0x50, 0x49, 0xbc, 0x21, + 0x7a, 0x03, 0x79, 0xf7, 0xfa, 0x9a, 0xf8, 0x3c, 0x90, 0xcd, 0xfb, 0x9d, 0x69, 0x0f, 0x29, 0x0e, + 0x47, 0x70, 0xf4, 0x16, 0x0a, 0xba, 0x13, 0x7c, 0x22, 0x3e, 0x8f, 0xe1, 0xf3, 0x2d, 0xc4, 0x0e, + 0x03, 0x62, 0x4e, 0x40, 0x5d, 0x28, 0x5b, 0x06, 0x99, 0x7a, 0xa6, 0x1e, 0xd2, 0x18, 0xe6, 0x5a, + 0x95, 0xbd, 0x97, 0x5b, 0xd8, 0x5a, 0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de, 0x30, 0x57, + 0x6b, 0x98, 0xaf, 0x94, 0x9f, 0x04, 0x9e, 0x34, 0x71, 0xa4, 0xb2, 0x49, 0xb3, 0x29, 0x42, 0x89, + 0xeb, 0xcf, 0xa5, 0xaf, 0xff, 0x60, 0x15, 0xbb, 0xcd, 0x4d, 0x35, 0x79, 0x54, 0x36, 0x72, 0x4f, + 0xa0, 0xa0, 0x1b, 0xa1, 0x75, 0x1b, 0x7d, 0xcc, 0x95, 0x0e, 0xa4, 0xd0, 0x5f, 0x10, 0xcc, 0x6d, + 0xbf, 0x86, 0xb3, 0x5d, 0x15, 0xda, 0xae, 0x3f, 0x6b, 0x7f, 0xba, 0xb1, 0x02, 0x8f, 0xf8, 0xc1, + 0x32, 0x08, 0xc9, 0x3c, 0xc8, 0xbc, 0x21, 0x4b, 0x4a, 0x47, 0xb7, 0xdb, 0xde, 0x22, 0xb8, 0xe9, + 0xa6, 0xff, 0xd6, 0x18, 0xf9, 0x6e, 0xe8, 0x06, 0xbf, 0x04, 0x00, 0x00, 0xff, 0xff, 0xe1, 0xdb, + 0xce, 0xca, 0xec, 0x10, 0x00, 0x00, +} diff --git a/protobuf/SignalService.proto b/protobuf/SignalService.proto new file mode 100644 index 0000000..e67fa60 --- /dev/null +++ b/protobuf/SignalService.proto @@ -0,0 +1,223 @@ +/** + * Copyright (C) 2014-2016 Open Whisper Systems + * + * Licensed according to the LICENSE file in this repository. + */ + +package signalservice; + +option java_package = "org.whispersystems.signalservice.internal.push"; +option java_outer_classname = "SignalServiceProtos"; + +message Envelope { + enum Type { + UNKNOWN = 0; + CIPHERTEXT = 1; + KEY_EXCHANGE = 2; + PREKEY_BUNDLE = 3; + RECEIPT = 5; + } + + optional Type type = 1; + optional string source = 2; + optional uint32 sourceDevice = 7; + optional string relay = 3; + optional uint64 timestamp = 5; + optional bytes legacyMessage = 6; // Contains an encrypted DataMessage + optional bytes content = 8; // Contains an encrypted Content +} + +message Content { + optional DataMessage dataMessage = 1; + optional SyncMessage syncMessage = 2; + optional CallMessage callMessage = 3; + optional NullMessage nullMessage = 4; + optional ReceiptMessage receiptMessage = 5; +} + +message CallMessage { + message Offer { + optional uint64 id = 1; + optional string description = 2; + } + + message Answer { + optional uint64 id = 1; + optional string description = 2; + } + + message IceUpdate { + optional uint64 id = 1; + optional string sdpMid = 2; + optional uint32 sdpMLineIndex = 3; + optional string sdp = 4; + } + + message Busy { + optional uint64 id = 1; + } + + message Hangup { + optional uint64 id = 1; + } + + + optional Offer offer = 1; + optional Answer answer = 2; + repeated IceUpdate iceUpdate = 3; + optional Hangup hangup = 4; + optional Busy busy = 5; +} + +message DataMessage { + enum Flags { + END_SESSION = 1; + EXPIRATION_TIMER_UPDATE = 2; + PROFILE_KEY_UPDATE = 4; + } + + optional string body = 1; + repeated AttachmentPointer attachments = 2; + optional GroupContext group = 3; + optional uint32 flags = 4; + optional uint32 expireTimer = 5; + 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 Sent { + optional string destination = 1; + optional uint64 timestamp = 2; + optional DataMessage message = 3; + optional uint64 expirationStartTimestamp = 4; + } + + message Contacts { + optional AttachmentPointer blob = 1; + optional bool complete = 2 [default = false]; + } + + message Groups { + optional AttachmentPointer blob = 1; + } + + message Blocked { + repeated string numbers = 1; + } + + message Request { + enum Type { + UNKNOWN = 0; + CONTACTS = 1; + GROUPS = 2; + BLOCKED = 3; + CONFIGURATION = 4; + } + + optional Type type = 1; + } + + message Read { + optional string sender = 1; + optional uint64 timestamp = 2; + } + + message Configuration { + optional bool readReceipts = 1; + } + + optional Sent sent = 1; + optional Contacts contacts = 2; + optional Groups groups = 3; + optional Request request = 4; + repeated Read read = 5; + optional Blocked blocked = 6; + optional Verified verified = 7; + optional Configuration configuration = 9; + optional bytes padding = 8; +} + +message AttachmentPointer { + enum Flags { + VOICE_MESSAGE = 1; + } + + optional fixed64 id = 1; + optional string contentType = 2; + optional bytes key = 3; + optional uint32 size = 4; + optional bytes thumbnail = 5; + optional bytes digest = 6; + optional string fileName = 7; + optional uint32 flags = 8; +} + +message GroupContext { + enum Type { + UNKNOWN = 0; + UPDATE = 1; + DELIVER = 2; + QUIT = 3; + REQUEST_INFO = 4; + } + optional bytes id = 1; + optional Type type = 2; + optional string name = 3; + repeated string members = 4; + optional AttachmentPointer avatar = 5; +} + +message ContactDetails { + message Avatar { + optional string contentType = 1; + optional uint32 length = 2; + } + + optional string number = 1; + optional string name = 2; + optional Avatar avatar = 3; + optional string color = 4; + optional Verified verified = 5; + optional bytes profileKey = 6; +} + +message GroupDetails { + message Avatar { + optional string contentType = 1; + optional uint32 length = 2; + } + + optional bytes id = 1; + optional string name = 2; + repeated string members = 3; + optional Avatar avatar = 4; + optional bool active = 5 [default = true]; +} diff --git a/protobuf/TextSecure.pb.go b/protobuf/TextSecure.pb.go deleted file mode 100644 index c59d217..0000000 --- a/protobuf/TextSecure.pb.go +++ /dev/null @@ -1,686 +0,0 @@ -// Code generated by protoc-gen-go. -// source: TextSecure.proto -// DO NOT EDIT! - -package textsecure - -import proto "github.com/golang/protobuf/proto" -import json "encoding/json" -import math "math" - -// Reference proto, json, and math imports to suppress error if they are not otherwise used. -var _ = proto.Marshal -var _ = &json.SyntaxError{} -var _ = math.Inf - -type Envelope_Type int32 - -const ( - Envelope_UNKNOWN Envelope_Type = 0 - Envelope_CIPHERTEXT Envelope_Type = 1 - Envelope_KEY_EXCHANGE Envelope_Type = 2 - Envelope_PREKEY_BUNDLE Envelope_Type = 3 - Envelope_RECEIPT Envelope_Type = 5 -) - -var Envelope_Type_name = map[int32]string{ - 0: "UNKNOWN", - 1: "CIPHERTEXT", - 2: "KEY_EXCHANGE", - 3: "PREKEY_BUNDLE", - 5: "RECEIPT", -} -var Envelope_Type_value = map[string]int32{ - "UNKNOWN": 0, - "CIPHERTEXT": 1, - "KEY_EXCHANGE": 2, - "PREKEY_BUNDLE": 3, - "RECEIPT": 5, -} - -func (x Envelope_Type) Enum() *Envelope_Type { - p := new(Envelope_Type) - *p = x - return p -} -func (x Envelope_Type) String() string { - return proto.EnumName(Envelope_Type_name, int32(x)) -} -func (x Envelope_Type) MarshalJSON() ([]byte, error) { - return json.Marshal(x.String()) -} -func (x *Envelope_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Envelope_Type_value, data, "Envelope_Type") - if err != nil { - return err - } - *x = Envelope_Type(value) - return nil -} - -type DataMessage_Flags int32 - -const ( - DataMessage_END_SESSION DataMessage_Flags = 1 -) - -var DataMessage_Flags_name = map[int32]string{ - 1: "END_SESSION", -} -var DataMessage_Flags_value = map[string]int32{ - "END_SESSION": 1, -} - -func (x DataMessage_Flags) Enum() *DataMessage_Flags { - p := new(DataMessage_Flags) - *p = x - return p -} -func (x DataMessage_Flags) String() string { - return proto.EnumName(DataMessage_Flags_name, int32(x)) -} -func (x DataMessage_Flags) MarshalJSON() ([]byte, error) { - return json.Marshal(x.String()) -} -func (x *DataMessage_Flags) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(DataMessage_Flags_value, data, "DataMessage_Flags") - if err != nil { - return err - } - *x = DataMessage_Flags(value) - return nil -} - -type SyncMessage_Request_Type int32 - -const ( - SyncMessage_Request_UNKNOWN SyncMessage_Request_Type = 0 - SyncMessage_Request_CONTACTS SyncMessage_Request_Type = 1 - SyncMessage_Request_GROUPS SyncMessage_Request_Type = 2 -) - -var SyncMessage_Request_Type_name = map[int32]string{ - 0: "UNKNOWN", - 1: "CONTACTS", - 2: "GROUPS", -} -var SyncMessage_Request_Type_value = map[string]int32{ - "UNKNOWN": 0, - "CONTACTS": 1, - "GROUPS": 2, -} - -func (x SyncMessage_Request_Type) Enum() *SyncMessage_Request_Type { - p := new(SyncMessage_Request_Type) - *p = x - return p -} -func (x SyncMessage_Request_Type) String() string { - return proto.EnumName(SyncMessage_Request_Type_name, int32(x)) -} -func (x SyncMessage_Request_Type) MarshalJSON() ([]byte, error) { - return json.Marshal(x.String()) -} -func (x *SyncMessage_Request_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(SyncMessage_Request_Type_value, data, "SyncMessage_Request_Type") - if err != nil { - return err - } - *x = SyncMessage_Request_Type(value) - return nil -} - -type GroupContext_Type int32 - -const ( - GroupContext_UNKNOWN GroupContext_Type = 0 - GroupContext_UPDATE GroupContext_Type = 1 - GroupContext_DELIVER GroupContext_Type = 2 - GroupContext_QUIT GroupContext_Type = 3 -) - -var GroupContext_Type_name = map[int32]string{ - 0: "UNKNOWN", - 1: "UPDATE", - 2: "DELIVER", - 3: "QUIT", -} -var GroupContext_Type_value = map[string]int32{ - "UNKNOWN": 0, - "UPDATE": 1, - "DELIVER": 2, - "QUIT": 3, -} - -func (x GroupContext_Type) Enum() *GroupContext_Type { - p := new(GroupContext_Type) - *p = x - return p -} -func (x GroupContext_Type) String() string { - return proto.EnumName(GroupContext_Type_name, int32(x)) -} -func (x GroupContext_Type) MarshalJSON() ([]byte, error) { - return json.Marshal(x.String()) -} -func (x *GroupContext_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(GroupContext_Type_value, data, "GroupContext_Type") - if err != nil { - return err - } - *x = GroupContext_Type(value) - return nil -} - -type Envelope struct { - Type *Envelope_Type `protobuf:"varint,1,opt,name=type,enum=textsecure.Envelope_Type" json:"type,omitempty"` - Source *string `protobuf:"bytes,2,opt,name=source" json:"source,omitempty"` - SourceDevice *uint32 `protobuf:"varint,7,opt,name=sourceDevice" json:"sourceDevice,omitempty"` - Relay *string `protobuf:"bytes,3,opt,name=relay" json:"relay,omitempty"` - Timestamp *uint64 `protobuf:"varint,5,opt,name=timestamp" json:"timestamp,omitempty"` - LegacyMessage []byte `protobuf:"bytes,6,opt,name=legacyMessage" json:"legacyMessage,omitempty"` - Content []byte `protobuf:"bytes,8,opt,name=content" json:"content,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Envelope) Reset() { *m = Envelope{} } -func (m *Envelope) String() string { return proto.CompactTextString(m) } -func (*Envelope) ProtoMessage() {} - -func (m *Envelope) GetType() Envelope_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return 0 -} - -func (m *Envelope) GetSource() string { - if m != nil && m.Source != nil { - return *m.Source - } - return "" -} - -func (m *Envelope) GetSourceDevice() uint32 { - if m != nil && m.SourceDevice != nil { - return *m.SourceDevice - } - return 0 -} - -func (m *Envelope) GetRelay() string { - if m != nil && m.Relay != nil { - return *m.Relay - } - return "" -} - -func (m *Envelope) GetTimestamp() uint64 { - if m != nil && m.Timestamp != nil { - return *m.Timestamp - } - return 0 -} - -func (m *Envelope) GetLegacyMessage() []byte { - if m != nil { - return m.LegacyMessage - } - return nil -} - -func (m *Envelope) GetContent() []byte { - if m != nil { - return m.Content - } - return nil -} - -type Content struct { - DataMessage *DataMessage `protobuf:"bytes,1,opt,name=dataMessage" json:"dataMessage,omitempty"` - SyncMessage *SyncMessage `protobuf:"bytes,2,opt,name=syncMessage" json:"syncMessage,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Content) Reset() { *m = Content{} } -func (m *Content) String() string { return proto.CompactTextString(m) } -func (*Content) ProtoMessage() {} - -func (m *Content) GetDataMessage() *DataMessage { - if m != nil { - return m.DataMessage - } - return nil -} - -func (m *Content) GetSyncMessage() *SyncMessage { - if m != nil { - return m.SyncMessage - } - return nil -} - -type DataMessage struct { - Body *string `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` - Attachments []*AttachmentPointer `protobuf:"bytes,2,rep,name=attachments" json:"attachments,omitempty"` - Group *GroupContext `protobuf:"bytes,3,opt,name=group" json:"group,omitempty"` - Flags *uint32 `protobuf:"varint,4,opt,name=flags" json:"flags,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *DataMessage) Reset() { *m = DataMessage{} } -func (m *DataMessage) String() string { return proto.CompactTextString(m) } -func (*DataMessage) ProtoMessage() {} - -func (m *DataMessage) GetBody() string { - if m != nil && m.Body != nil { - return *m.Body - } - return "" -} - -func (m *DataMessage) GetAttachments() []*AttachmentPointer { - if m != nil { - return m.Attachments - } - return nil -} - -func (m *DataMessage) GetGroup() *GroupContext { - if m != nil { - return m.Group - } - return nil -} - -func (m *DataMessage) GetFlags() uint32 { - if m != nil && m.Flags != nil { - return *m.Flags - } - return 0 -} - -type SyncMessage struct { - Sent *SyncMessage_Sent `protobuf:"bytes,1,opt,name=sent" json:"sent,omitempty"` - Contacts *SyncMessage_Contacts `protobuf:"bytes,2,opt,name=contacts" json:"contacts,omitempty"` - Groups *SyncMessage_Groups `protobuf:"bytes,3,opt,name=groups" json:"groups,omitempty"` - Request *SyncMessage_Request `protobuf:"bytes,4,opt,name=request" json:"request,omitempty"` - Read []*SyncMessage_Read `protobuf:"bytes,5,rep,name=read" json:"read,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SyncMessage) Reset() { *m = SyncMessage{} } -func (m *SyncMessage) String() string { return proto.CompactTextString(m) } -func (*SyncMessage) ProtoMessage() {} - -func (m *SyncMessage) GetSent() *SyncMessage_Sent { - if m != nil { - return m.Sent - } - return nil -} - -func (m *SyncMessage) GetContacts() *SyncMessage_Contacts { - if m != nil { - return m.Contacts - } - return nil -} - -func (m *SyncMessage) GetGroups() *SyncMessage_Groups { - if m != nil { - return m.Groups - } - return nil -} - -func (m *SyncMessage) GetRequest() *SyncMessage_Request { - if m != nil { - return m.Request - } - return nil -} - -func (m *SyncMessage) GetRead() []*SyncMessage_Read { - if m != nil { - return m.Read - } - return nil -} - -type SyncMessage_Sent struct { - Destination *string `protobuf:"bytes,1,opt,name=destination" json:"destination,omitempty"` - Timestamp *uint64 `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"` - Message *DataMessage `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SyncMessage_Sent) Reset() { *m = SyncMessage_Sent{} } -func (m *SyncMessage_Sent) String() string { return proto.CompactTextString(m) } -func (*SyncMessage_Sent) ProtoMessage() {} - -func (m *SyncMessage_Sent) GetDestination() string { - if m != nil && m.Destination != nil { - return *m.Destination - } - return "" -} - -func (m *SyncMessage_Sent) GetTimestamp() uint64 { - if m != nil && m.Timestamp != nil { - return *m.Timestamp - } - return 0 -} - -func (m *SyncMessage_Sent) GetMessage() *DataMessage { - if m != nil { - return m.Message - } - return nil -} - -type SyncMessage_Contacts struct { - Blob *AttachmentPointer `protobuf:"bytes,1,opt,name=blob" json:"blob,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SyncMessage_Contacts) Reset() { *m = SyncMessage_Contacts{} } -func (m *SyncMessage_Contacts) String() string { return proto.CompactTextString(m) } -func (*SyncMessage_Contacts) ProtoMessage() {} - -func (m *SyncMessage_Contacts) GetBlob() *AttachmentPointer { - if m != nil { - return m.Blob - } - return nil -} - -type SyncMessage_Groups struct { - Blob *AttachmentPointer `protobuf:"bytes,1,opt,name=blob" json:"blob,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SyncMessage_Groups) Reset() { *m = SyncMessage_Groups{} } -func (m *SyncMessage_Groups) String() string { return proto.CompactTextString(m) } -func (*SyncMessage_Groups) ProtoMessage() {} - -func (m *SyncMessage_Groups) GetBlob() *AttachmentPointer { - if m != nil { - return m.Blob - } - return nil -} - -type SyncMessage_Request struct { - Type *SyncMessage_Request_Type `protobuf:"varint,1,opt,name=type,enum=textsecure.SyncMessage_Request_Type" json:"type,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SyncMessage_Request) Reset() { *m = SyncMessage_Request{} } -func (m *SyncMessage_Request) String() string { return proto.CompactTextString(m) } -func (*SyncMessage_Request) ProtoMessage() {} - -func (m *SyncMessage_Request) GetType() SyncMessage_Request_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return 0 -} - -type SyncMessage_Read struct { - Sender *string `protobuf:"bytes,1,opt,name=sender" json:"sender,omitempty"` - Timestamp *uint64 `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SyncMessage_Read) Reset() { *m = SyncMessage_Read{} } -func (m *SyncMessage_Read) String() string { return proto.CompactTextString(m) } -func (*SyncMessage_Read) ProtoMessage() {} - -func (m *SyncMessage_Read) GetSender() string { - if m != nil && m.Sender != nil { - return *m.Sender - } - return "" -} - -func (m *SyncMessage_Read) GetTimestamp() uint64 { - if m != nil && m.Timestamp != nil { - return *m.Timestamp - } - return 0 -} - -type AttachmentPointer struct { - Id *uint64 `protobuf:"fixed64,1,opt,name=id" json:"id,omitempty"` - ContentType *string `protobuf:"bytes,2,opt,name=contentType" json:"contentType,omitempty"` - Key []byte `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"` - Size *uint32 `protobuf:"varint,4,opt,name=size" json:"size,omitempty"` - Thumbnail []byte `protobuf:"bytes,5,opt,name=thumbnail" json:"thumbnail,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *AttachmentPointer) Reset() { *m = AttachmentPointer{} } -func (m *AttachmentPointer) String() string { return proto.CompactTextString(m) } -func (*AttachmentPointer) ProtoMessage() {} - -func (m *AttachmentPointer) GetId() uint64 { - if m != nil && m.Id != nil { - return *m.Id - } - return 0 -} - -func (m *AttachmentPointer) GetContentType() string { - if m != nil && m.ContentType != nil { - return *m.ContentType - } - return "" -} - -func (m *AttachmentPointer) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *AttachmentPointer) GetSize() uint32 { - if m != nil && m.Size != nil { - return *m.Size - } - return 0 -} - -func (m *AttachmentPointer) GetThumbnail() []byte { - if m != nil { - return m.Thumbnail - } - return nil -} - -type GroupContext struct { - Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Type *GroupContext_Type `protobuf:"varint,2,opt,name=type,enum=textsecure.GroupContext_Type" json:"type,omitempty"` - Name *string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` - Members []string `protobuf:"bytes,4,rep,name=members" json:"members,omitempty"` - Avatar *AttachmentPointer `protobuf:"bytes,5,opt,name=avatar" json:"avatar,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GroupContext) Reset() { *m = GroupContext{} } -func (m *GroupContext) String() string { return proto.CompactTextString(m) } -func (*GroupContext) ProtoMessage() {} - -func (m *GroupContext) GetId() []byte { - if m != nil { - return m.Id - } - return nil -} - -func (m *GroupContext) GetType() GroupContext_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return 0 -} - -func (m *GroupContext) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *GroupContext) GetMembers() []string { - if m != nil { - return m.Members - } - return nil -} - -func (m *GroupContext) GetAvatar() *AttachmentPointer { - if m != nil { - return m.Avatar - } - return nil -} - -type ContactDetails struct { - Number *string `protobuf:"bytes,1,opt,name=number" json:"number,omitempty"` - Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - Avatar *ContactDetails_Avatar `protobuf:"bytes,3,opt,name=avatar" json:"avatar,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ContactDetails) Reset() { *m = ContactDetails{} } -func (m *ContactDetails) String() string { return proto.CompactTextString(m) } -func (*ContactDetails) ProtoMessage() {} - -func (m *ContactDetails) GetNumber() string { - if m != nil && m.Number != nil { - return *m.Number - } - return "" -} - -func (m *ContactDetails) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *ContactDetails) GetAvatar() *ContactDetails_Avatar { - if m != nil { - return m.Avatar - } - return nil -} - -type ContactDetails_Avatar struct { - ContentType *string `protobuf:"bytes,1,opt,name=contentType" json:"contentType,omitempty"` - Length *uint32 `protobuf:"varint,2,opt,name=length" json:"length,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ContactDetails_Avatar) Reset() { *m = ContactDetails_Avatar{} } -func (m *ContactDetails_Avatar) String() string { return proto.CompactTextString(m) } -func (*ContactDetails_Avatar) ProtoMessage() {} - -func (m *ContactDetails_Avatar) GetContentType() string { - if m != nil && m.ContentType != nil { - return *m.ContentType - } - return "" -} - -func (m *ContactDetails_Avatar) GetLength() uint32 { - if m != nil && m.Length != nil { - return *m.Length - } - return 0 -} - -type GroupDetails struct { - Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - Members []string `protobuf:"bytes,3,rep,name=members" json:"members,omitempty"` - Avatar *GroupDetails_Avatar `protobuf:"bytes,4,opt,name=avatar" json:"avatar,omitempty"` - Active *bool `protobuf:"varint,5,opt,name=active,def=1" json:"active,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GroupDetails) Reset() { *m = GroupDetails{} } -func (m *GroupDetails) String() string { return proto.CompactTextString(m) } -func (*GroupDetails) ProtoMessage() {} - -const Default_GroupDetails_Active bool = true - -func (m *GroupDetails) GetId() []byte { - if m != nil { - return m.Id - } - return nil -} - -func (m *GroupDetails) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *GroupDetails) GetMembers() []string { - if m != nil { - return m.Members - } - return nil -} - -func (m *GroupDetails) GetAvatar() *GroupDetails_Avatar { - if m != nil { - return m.Avatar - } - return nil -} - -func (m *GroupDetails) GetActive() bool { - if m != nil && m.Active != nil { - return *m.Active - } - return Default_GroupDetails_Active -} - -type GroupDetails_Avatar struct { - ContentType *string `protobuf:"bytes,1,opt,name=contentType" json:"contentType,omitempty"` - Length *uint32 `protobuf:"varint,2,opt,name=length" json:"length,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GroupDetails_Avatar) Reset() { *m = GroupDetails_Avatar{} } -func (m *GroupDetails_Avatar) String() string { return proto.CompactTextString(m) } -func (*GroupDetails_Avatar) ProtoMessage() {} - -func (m *GroupDetails_Avatar) GetContentType() string { - if m != nil && m.ContentType != nil { - return *m.ContentType - } - return "" -} - -func (m *GroupDetails_Avatar) GetLength() uint32 { - if m != nil && m.Length != nil { - return *m.Length - } - return 0 -} - -func init() { - proto.RegisterEnum("textsecure.Envelope_Type", Envelope_Type_name, Envelope_Type_value) - proto.RegisterEnum("textsecure.DataMessage_Flags", DataMessage_Flags_name, DataMessage_Flags_value) - proto.RegisterEnum("textsecure.SyncMessage_Request_Type", SyncMessage_Request_Type_name, SyncMessage_Request_Type_value) - proto.RegisterEnum("textsecure.GroupContext_Type", GroupContext_Type_name, GroupContext_Type_value) -} diff --git a/protobuf/TextSecure.proto b/protobuf/TextSecure.proto deleted file mode 100644 index 49f6ea9..0000000 --- a/protobuf/TextSecure.proto +++ /dev/null @@ -1,121 +0,0 @@ -package textsecure; - -option java_package = "org.whispersystems.textsecure.internal.push"; -option java_outer_classname = "TextSecureProtos"; - -message Envelope { - enum Type { - UNKNOWN = 0; - CIPHERTEXT = 1; - KEY_EXCHANGE = 2; - PREKEY_BUNDLE = 3; - RECEIPT = 5; - } - - optional Type type = 1; - optional string source = 2; - optional uint32 sourceDevice = 7; - optional string relay = 3; - optional uint64 timestamp = 5; - optional bytes legacyMessage = 6; // Contains an encrypted DataMessage - optional bytes content = 8; // Contains an encrypted Content -} - -message Content { - optional DataMessage dataMessage = 1; - optional SyncMessage syncMessage = 2; -} - -message DataMessage { - enum Flags { - END_SESSION = 1; - } - - optional string body = 1; - repeated AttachmentPointer attachments = 2; - optional GroupContext group = 3; - optional uint32 flags = 4; -} - -message SyncMessage { - message Sent { - optional string destination = 1; - optional uint64 timestamp = 2; - optional DataMessage message = 3; - } - - message Contacts { - optional AttachmentPointer blob = 1; - } - - message Groups { - optional AttachmentPointer blob = 1; - } - - message Request { - enum Type { - UNKNOWN = 0; - CONTACTS = 1; - GROUPS = 2; - } - - optional Type type = 1; - } - - message Read { - optional string sender = 1; - optional uint64 timestamp = 2; - } - - optional Sent sent = 1; - optional Contacts contacts = 2; - optional Groups groups = 3; - optional Request request = 4; - repeated Read read = 5; -} - -message AttachmentPointer { - optional fixed64 id = 1; - optional string contentType = 2; - optional bytes key = 3; - optional uint32 size = 4; - optional bytes thumbnail = 5; -} - -message GroupContext { - enum Type { - UNKNOWN = 0; - UPDATE = 1; - DELIVER = 2; - QUIT = 3; - } - optional bytes id = 1; - optional Type type = 2; - optional string name = 3; - repeated string members = 4; - optional AttachmentPointer avatar = 5; -} - -message ContactDetails { - message Avatar { - optional string contentType = 1; - optional uint32 length = 2; - } - - optional string number = 1; - optional string name = 2; - optional Avatar avatar = 3; -} - -message GroupDetails { - message Avatar { - optional string contentType = 1; - optional uint32 length = 2; - } - - optional bytes id = 1; - optional string name = 2; - repeated string members = 3; - optional Avatar avatar = 4; - optional bool active = 5 [default = true]; -} diff --git a/protobuf/WebSocketResources.pb.go b/protobuf/WebSocketResources.pb.go index a278e15..946d4ed 100644 --- a/protobuf/WebSocketResources.pb.go +++ b/protobuf/WebSocketResources.pb.go @@ -2,15 +2,15 @@ // source: WebSocketResources.proto // DO NOT EDIT! -package textsecure +package signalservice import proto "github.com/golang/protobuf/proto" -import json "encoding/json" +import fmt "fmt" import math "math" -// Reference proto, json, and math imports to suppress error if they are not otherwise used. +// Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal -var _ = &json.SyntaxError{} +var _ = fmt.Errorf var _ = math.Inf type WebSocketMessage_Type int32 @@ -40,9 +40,6 @@ func (x WebSocketMessage_Type) Enum() *WebSocketMessage_Type { func (x WebSocketMessage_Type) String() string { return proto.EnumName(WebSocketMessage_Type_name, int32(x)) } -func (x WebSocketMessage_Type) MarshalJSON() ([]byte, error) { - return json.Marshal(x.String()) -} func (x *WebSocketMessage_Type) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(WebSocketMessage_Type_value, data, "WebSocketMessage_Type") if err != nil { @@ -51,18 +48,21 @@ func (x *WebSocketMessage_Type) UnmarshalJSON(data []byte) error { *x = WebSocketMessage_Type(value) return nil } +func (WebSocketMessage_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor2, []int{2, 0} } type WebSocketRequestMessage struct { - Verb *string `protobuf:"bytes,1,opt,name=verb" json:"verb,omitempty"` - Path *string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"` - Body []byte `protobuf:"bytes,3,opt,name=body" json:"body,omitempty"` - Id *uint64 `protobuf:"varint,4,opt,name=id" json:"id,omitempty"` - XXX_unrecognized []byte `json:"-"` + Verb *string `protobuf:"bytes,1,opt,name=verb" json:"verb,omitempty"` + Path *string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"` + Body []byte `protobuf:"bytes,3,opt,name=body" json:"body,omitempty"` + Headers []string `protobuf:"bytes,5,rep,name=headers" json:"headers,omitempty"` + Id *uint64 `protobuf:"varint,4,opt,name=id" json:"id,omitempty"` + XXX_unrecognized []byte `json:"-"` } -func (m *WebSocketRequestMessage) Reset() { *m = WebSocketRequestMessage{} } -func (m *WebSocketRequestMessage) String() string { return proto.CompactTextString(m) } -func (*WebSocketRequestMessage) ProtoMessage() {} +func (m *WebSocketRequestMessage) Reset() { *m = WebSocketRequestMessage{} } +func (m *WebSocketRequestMessage) String() string { return proto.CompactTextString(m) } +func (*WebSocketRequestMessage) ProtoMessage() {} +func (*WebSocketRequestMessage) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } func (m *WebSocketRequestMessage) GetVerb() string { if m != nil && m.Verb != nil { @@ -85,6 +85,13 @@ func (m *WebSocketRequestMessage) GetBody() []byte { return nil } +func (m *WebSocketRequestMessage) GetHeaders() []string { + if m != nil { + return m.Headers + } + return nil +} + func (m *WebSocketRequestMessage) GetId() uint64 { if m != nil && m.Id != nil { return *m.Id @@ -93,16 +100,18 @@ func (m *WebSocketRequestMessage) GetId() uint64 { } type WebSocketResponseMessage struct { - Id *uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` - Status *uint32 `protobuf:"varint,2,opt,name=status" json:"status,omitempty"` - Message *string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` - Body []byte `protobuf:"bytes,4,opt,name=body" json:"body,omitempty"` - XXX_unrecognized []byte `json:"-"` + Id *uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + Status *uint32 `protobuf:"varint,2,opt,name=status" json:"status,omitempty"` + Message *string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` + Headers []string `protobuf:"bytes,5,rep,name=headers" json:"headers,omitempty"` + Body []byte `protobuf:"bytes,4,opt,name=body" json:"body,omitempty"` + XXX_unrecognized []byte `json:"-"` } -func (m *WebSocketResponseMessage) Reset() { *m = WebSocketResponseMessage{} } -func (m *WebSocketResponseMessage) String() string { return proto.CompactTextString(m) } -func (*WebSocketResponseMessage) ProtoMessage() {} +func (m *WebSocketResponseMessage) Reset() { *m = WebSocketResponseMessage{} } +func (m *WebSocketResponseMessage) String() string { return proto.CompactTextString(m) } +func (*WebSocketResponseMessage) ProtoMessage() {} +func (*WebSocketResponseMessage) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} } func (m *WebSocketResponseMessage) GetId() uint64 { if m != nil && m.Id != nil { @@ -125,6 +134,13 @@ func (m *WebSocketResponseMessage) GetMessage() string { return "" } +func (m *WebSocketResponseMessage) GetHeaders() []string { + if m != nil { + return m.Headers + } + return nil +} + func (m *WebSocketResponseMessage) GetBody() []byte { if m != nil { return m.Body @@ -133,21 +149,22 @@ func (m *WebSocketResponseMessage) GetBody() []byte { } type WebSocketMessage struct { - Type *WebSocketMessage_Type `protobuf:"varint,1,opt,name=type,enum=textsecure.WebSocketMessage_Type" json:"type,omitempty"` + Type *WebSocketMessage_Type `protobuf:"varint,1,opt,name=type,enum=signalservice.WebSocketMessage_Type" json:"type,omitempty"` Request *WebSocketRequestMessage `protobuf:"bytes,2,opt,name=request" json:"request,omitempty"` Response *WebSocketResponseMessage `protobuf:"bytes,3,opt,name=response" json:"response,omitempty"` XXX_unrecognized []byte `json:"-"` } -func (m *WebSocketMessage) Reset() { *m = WebSocketMessage{} } -func (m *WebSocketMessage) String() string { return proto.CompactTextString(m) } -func (*WebSocketMessage) ProtoMessage() {} +func (m *WebSocketMessage) Reset() { *m = WebSocketMessage{} } +func (m *WebSocketMessage) String() string { return proto.CompactTextString(m) } +func (*WebSocketMessage) ProtoMessage() {} +func (*WebSocketMessage) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} } func (m *WebSocketMessage) GetType() WebSocketMessage_Type { if m != nil && m.Type != nil { return *m.Type } - return 0 + return WebSocketMessage_UNKNOWN } func (m *WebSocketMessage) GetRequest() *WebSocketRequestMessage { @@ -165,5 +182,37 @@ func (m *WebSocketMessage) GetResponse() *WebSocketResponseMessage { } func init() { - proto.RegisterEnum("textsecure.WebSocketMessage_Type", WebSocketMessage_Type_name, WebSocketMessage_Type_value) + proto.RegisterType((*WebSocketRequestMessage)(nil), "signalservice.WebSocketRequestMessage") + proto.RegisterType((*WebSocketResponseMessage)(nil), "signalservice.WebSocketResponseMessage") + proto.RegisterType((*WebSocketMessage)(nil), "signalservice.WebSocketMessage") + proto.RegisterEnum("signalservice.WebSocketMessage_Type", WebSocketMessage_Type_name, WebSocketMessage_Type_value) +} + +func init() { proto.RegisterFile("WebSocketResources.proto", fileDescriptor2) } + +var fileDescriptor2 = []byte{ + // 357 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x3f, 0x4f, 0x83, 0x50, + 0x14, 0xc5, 0x85, 0xa2, 0x6d, 0x5f, 0xff, 0x48, 0xde, 0xa0, 0x8c, 0x84, 0x18, 0x65, 0x62, 0xa8, + 0x8b, 0xa3, 0xa9, 0xc1, 0xc5, 0x48, 0xeb, 0xa3, 0x4d, 0x67, 0x28, 0x37, 0x2d, 0xb1, 0x05, 0x7c, + 0xf7, 0xb5, 0x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, 0x33, 0xc9, 0x33, 0x60, 0x32, 0x41, 0x1f, + 0x49, 0x93, 0x97, 0x9d, 0x4a, 0xde, 0xce, 0xe0, 0xf6, 0x54, 0xb8, 0x5e, 0x3d, 0xab, 0x62, 0xf4, + 0x89, 0xb4, 0xf8, 0xbe, 0x13, 0xf9, 0x67, 0x9d, 0xc1, 0xdd, 0xe9, 0x4f, 0xd4, 0xba, 0x63, 0x87, + 0xa0, 0xe5, 0x10, 0xad, 0x80, 0xa2, 0x1d, 0xd2, 0x9c, 0x7a, 0x2f, 0xde, 0x68, 0xe6, 0xe9, 0x67, + 0x85, 0x60, 0xee, 0xdb, 0xd4, 0xf5, 0x27, 0xba, 0x42, 0xbb, 0xa4, 0xc5, 0x5c, 0x7f, 0x3c, 0xf2, + 0x7c, 0x57, 0x57, 0x87, 0xcf, 0xe4, 0x3e, 0xe5, 0x0b, 0x67, 0xb7, 0x8c, 0x31, 0x03, 0x8e, 0x39, + 0x0a, 0x58, 0xe3, 0xd1, 0xd9, 0x38, 0x11, 0xc0, 0x93, 0x60, 0xe5, 0xec, 0x20, 0x44, 0x79, 0x7f, + 0x78, 0x79, 0x40, 0x19, 0x17, 0x2f, 0x0d, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x1f, 0xd6, + 0x6e, 0x85, 0x02, 0x00, 0x00, } diff --git a/protobuf/WebSocketResources.proto b/protobuf/WebSocketResources.proto index 35943a7..f440001 100644 --- a/protobuf/WebSocketResources.proto +++ b/protobuf/WebSocketResources.proto @@ -1,35 +1,27 @@ /** - * Copyright (C) 2014-2015 Open WhisperSystems + * Copyright (C) 2014-2016 Open Whisper Systems * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * Licensed according to the LICENSE file in this repository. */ -package textsecure; -option java_package = "org.whispersystems.textsecure.internal.websocket"; +package signalservice; + +option java_package = "org.whispersystems.signalservice.internal.websocket"; option java_outer_classname = "WebSocketProtos"; message WebSocketRequestMessage { - optional string verb = 1; - optional string path = 2; - optional bytes body = 3; - optional uint64 id = 4; + optional string verb = 1; + optional string path = 2; + optional bytes body = 3; + repeated string headers = 5; + optional uint64 id = 4; } message WebSocketResponseMessage { optional uint64 id = 1; optional uint32 status = 2; optional string message = 3; + repeated string headers = 5; optional bytes body = 4; } diff --git a/server.go b/server.go index 44089d8..2d4d72c 100644 --- a/server.go +++ b/server.go @@ -13,9 +13,9 @@ import ( "strings" "time" + "github.com/aebruno/textsecure/axolotl" + "github.com/aebruno/textsecure/protobuf" "github.com/golang/protobuf/proto" - "github.com/janimo/textsecure/axolotl" - "github.com/janimo/textsecure/protobuf" log "github.com/Sirupsen/logrus" ) @@ -182,7 +182,7 @@ func addNewDevice(ephemeralId, publicKey, verificationCode string) error { theirPublicKey := axolotl.NewECPublicKey(decPk) - pm := &textsecure.ProvisionMessage{ + pm := &signalservice.ProvisionMessage{ IdentityKeyPublic: identityKey.PublicKey.Serialize(), IdentityKeyPrivate: identityKey.PrivateKey.Key()[:], Number: &config.Tel, @@ -325,27 +325,28 @@ type jsonMessage struct { Type int32 `json:"type"` DestDeviceID uint32 `json:"destinationDeviceId"` DestRegistrationID uint32 `json:"destinationRegistrationId"` - Body string `json:"body"` Content string `json:"content"` Relay string `json:"relay,omitempty"` } -func createMessage(msg *outgoingMessage) *textsecure.DataMessage { - dm := &textsecure.DataMessage{} +func createMessage(msg *outgoingMessage) *signalservice.DataMessage { + dm := &signalservice.DataMessage{} if msg.msg != "" { dm.Body = &msg.msg } if msg.attachment != nil { - dm.Attachments = []*textsecure.AttachmentPointer{ + dm.Attachments = []*signalservice.AttachmentPointer{ { Id: &msg.attachment.id, ContentType: &msg.attachment.ct, - Key: msg.attachment.keys, + Key: msg.attachment.keys[:], + Digest: msg.attachment.digest[:], + Size: &msg.attachment.size, }, } } if msg.group != nil { - dm.Group = &textsecure.GroupContext{ + dm.Group = &signalservice.GroupContext{ Id: msg.group.id, Type: &msg.group.typ, Name: &msg.group.name, @@ -460,13 +461,7 @@ func buildMessage(tel string, paddedMessage []byte, devices []uint32, isSync boo DestRegistrationID: rrID, } - if isSync { - jmsg.Content = base64.StdEncoding.EncodeToString(encryptedMessage) - } else { - // Use legacy Body for data messages. It seems that iOS devices do - // not support Content yet? - jmsg.Body = base64.StdEncoding.EncodeToString(encryptedMessage) - } + jmsg.Content = base64.StdEncoding.EncodeToString(encryptedMessage) messages = append(messages, jmsg) } @@ -568,7 +563,11 @@ func sendMessage(msg *outgoingMessage) (uint64, error) { dm := createMessage(msg) - b, err := proto.Marshal(dm) + content := &signalservice.Content{ + DataMessage: dm, + } + + b, err := proto.Marshal(content) if err != nil { return 0, err } @@ -580,8 +579,8 @@ func sendMessage(msg *outgoingMessage) (uint64, error) { if resp.NeedsSync { log.Debugf("Needs sync. destination: %s", msg.tel) - sm := &textsecure.SyncMessage{ - Sent: &textsecure.SyncMessage_Sent{ + sm := &signalservice.SyncMessage{ + Sent: &signalservice.SyncMessage_Sent{ Destination: &msg.tel, Timestamp: &resp.Timestamp, Message: dm, @@ -601,12 +600,12 @@ func sendMessage(msg *outgoingMessage) (uint64, error) { return resp.Timestamp, err } -func sendSyncMessage(sm *textsecure.SyncMessage) (uint64, error) { +func sendSyncMessage(sm *signalservice.SyncMessage) (uint64, error) { if _, ok := deviceLists[config.Tel]; !ok { deviceLists[config.Tel] = []uint32{1} } - content := &textsecure.Content{ + content := &signalservice.Content{ SyncMessage: sm, } diff --git a/store.go b/store.go index bce749e..41b16be 100644 --- a/store.go +++ b/store.go @@ -15,7 +15,7 @@ import ( "strings" "sync" - "github.com/janimo/textsecure/axolotl" + "github.com/aebruno/textsecure/axolotl" "golang.org/x/crypto/pbkdf2" log "github.com/Sirupsen/logrus" diff --git a/sync.go b/sync.go index 5112ce6..810719e 100644 --- a/sync.go +++ b/sync.go @@ -6,12 +6,12 @@ import ( "fmt" log "github.com/Sirupsen/logrus" + "github.com/aebruno/textsecure/protobuf" "github.com/golang/protobuf/proto" - "github.com/janimo/textsecure/protobuf" ) // handleSyncMessage handles an incoming SyncMessage. -func handleSyncMessage(src string, timestamp uint64, sm *textsecure.SyncMessage) error { +func handleSyncMessage(src string, timestamp uint64, sm *signalservice.SyncMessage) error { log.Debugf("SyncMessage recieved at %d", timestamp) if sm.GetSent() != nil { @@ -28,7 +28,7 @@ func handleSyncMessage(src string, timestamp uint64, sm *textsecure.SyncMessage) } // handleSyncSent handles sync sent messages -func handleSyncSent(s *textsecure.SyncMessage_Sent, ts uint64) error { +func handleSyncSent(s *signalservice.SyncMessage_Sent, ts uint64) error { dm := s.GetMessage() dest := s.GetDestination() timestamp := s.GetTimestamp() @@ -69,10 +69,10 @@ func handleSyncSent(s *textsecure.SyncMessage_Sent, ts uint64) error { } // handleSyncRequestMessage -func handleSyncRequest(request *textsecure.SyncMessage_Request) error { - if request.GetType() == textsecure.SyncMessage_Request_CONTACTS { +func handleSyncRequest(request *signalservice.SyncMessage_Request) error { + if request.GetType() == signalservice.SyncMessage_Request_CONTACTS { return sendContactUpdate() - } else if request.GetType() == textsecure.SyncMessage_Request_GROUPS { + } else if request.GetType() == signalservice.SyncMessage_Request_GROUPS { return sendGroupUpdate() } @@ -91,7 +91,7 @@ func sendContactUpdate() error { var buf bytes.Buffer for _, c := range lc { - cd := &textsecure.ContactDetails{ + cd := &signalservice.ContactDetails{ Number: &c.Tel, Name: &c.Name, // TODO: handle avatars @@ -112,9 +112,9 @@ func sendContactUpdate() error { return err } - sm := &textsecure.SyncMessage{ - Contacts: &textsecure.SyncMessage_Contacts{ - Blob: &textsecure.AttachmentPointer{ + sm := &signalservice.SyncMessage{ + Contacts: &signalservice.SyncMessage_Contacts{ + Blob: &signalservice.AttachmentPointer{ Id: &a.id, ContentType: &a.ct, Key: a.keys, @@ -133,7 +133,7 @@ func sendGroupUpdate() error { var buf bytes.Buffer for _, g := range groups { - gd := &textsecure.GroupDetails{ + gd := &signalservice.GroupDetails{ Id: g.ID, Name: &g.Name, Members: g.Members, @@ -156,9 +156,9 @@ func sendGroupUpdate() error { return err } - sm := &textsecure.SyncMessage{ - Groups: &textsecure.SyncMessage_Groups{ - Blob: &textsecure.AttachmentPointer{ + sm := &signalservice.SyncMessage{ + Groups: &signalservice.SyncMessage_Groups{ + Blob: &signalservice.AttachmentPointer{ Id: &a.id, ContentType: &a.ct, Key: a.keys, @@ -170,7 +170,7 @@ func sendGroupUpdate() error { return err } -func handleSyncRead(readMessages []*textsecure.SyncMessage_Read) error { +func handleSyncRead(readMessages []*signalservice.SyncMessage_Read) error { if client.SyncReadHandler != nil { for _, s := range readMessages { client.SyncReadHandler(s.GetSender(), s.GetTimestamp()) diff --git a/textsecure.go b/textsecure.go index d79847f..0083bf3 100644 --- a/textsecure.go +++ b/textsecure.go @@ -19,8 +19,8 @@ import ( "github.com/golang/protobuf/proto" log "github.com/Sirupsen/logrus" - "github.com/janimo/textsecure/axolotl" - "github.com/janimo/textsecure/protobuf" + "github.com/aebruno/textsecure/axolotl" + "github.com/aebruno/textsecure/protobuf" ) // Generate a random 16 byte string used for HTTP Basic Authentication to the server @@ -94,9 +94,11 @@ func needsRegistration() bool { var identityKey *axolotl.IdentityKeyPair type att struct { - id uint64 - ct string - keys []byte + id uint64 + ct string + keys []byte + digest []byte + size uint32 } type outgoingMessage struct { @@ -164,7 +166,7 @@ func EndSession(tel string, msg string) (uint64, error) { omsg := &outgoingMessage{ tel: tel, msg: msg, - flags: uint32(textsecure.DataMessage_END_SESSION), + flags: uint32(signalservice.DataMessage_END_SESSION), } ts, err := sendMessage(omsg) if err != nil { @@ -356,7 +358,7 @@ func registerDevice() error { return nil } -func handleReceipt(env *textsecure.Envelope) { +func handleReceipt(env *signalservice.Envelope) { if client.ReceiptHandler != nil { client.ReceiptHandler(env.GetSource(), env.GetSourceDevice(), env.GetTimestamp()) } @@ -366,23 +368,15 @@ func recID(source string) string { return source[1:] } -func handleMessage(src string, timestamp uint64, b []byte, legacy bool) error { +func handleMessage(src string, timestamp uint64, b []byte) error { b = stripPadding(b) - if legacy { - dm := &textsecure.DataMessage{} - err := proto.Unmarshal(b, dm) - if err != nil { - return err - } - return handleDataMessage(src, timestamp, dm) - } - - content := &textsecure.Content{} + content := &signalservice.Content{} err := proto.Unmarshal(b, content) if err != nil { return err } + if dm := content.GetDataMessage(); dm != nil { return handleDataMessage(src, timestamp, dm) } else if sm := content.GetSyncMessage(); sm != nil && config.Tel == src { @@ -396,9 +390,9 @@ func handleMessage(src string, timestamp uint64, b []byte, legacy bool) error { // EndSessionFlag signals that this message resets the session var EndSessionFlag uint32 = 1 -func handleFlags(src string, dm *textsecure.DataMessage) (uint32, error) { +func handleFlags(src string, dm *signalservice.DataMessage) (uint32, error) { flags := uint32(0) - if dm.GetFlags() == uint32(textsecure.DataMessage_END_SESSION) { + if dm.GetFlags() == uint32(signalservice.DataMessage_END_SESSION) { flags = EndSessionFlag textSecureStore.DeleteAllSessions(recID(src)) } @@ -406,7 +400,7 @@ func handleFlags(src string, dm *textsecure.DataMessage) (uint32, error) { } // handleDataMessage handles an incoming DataMessage and calls client callbacks -func handleDataMessage(src string, timestamp uint64, dm *textsecure.DataMessage) error { +func handleDataMessage(src string, timestamp uint64, dm *signalservice.DataMessage) error { flags, err := handleFlags(src, dm) if err != nil { return err @@ -437,13 +431,6 @@ func handleDataMessage(src string, timestamp uint64, dm *textsecure.DataMessage) return nil } -func getMessage(env *textsecure.Envelope) ([]byte, bool) { - if msg := env.GetContent(); msg != nil { - return msg, false - } - return env.GetLegacyMessage(), true -} - // MessageTypeNotImplementedError is raised in the unlikely event that an unhandled protocol message type is received. type MessageTypeNotImplementedError struct { typ uint32 @@ -471,7 +458,7 @@ func handleReceivedMessage(msg []byte) error { if err != nil { return err } - env := &textsecure.Envelope{} + env := &signalservice.Envelope{} err = proto.Unmarshal(plaintext, env) if err != nil { return err @@ -480,11 +467,11 @@ func handleReceivedMessage(msg []byte) error { recid := recID(env.GetSource()) sc := axolotl.NewSessionCipher(textSecureStore, textSecureStore, textSecureStore, textSecureStore, recid, env.GetSourceDevice()) switch *env.Type { - case textsecure.Envelope_RECEIPT: + case signalservice.Envelope_RECEIPT: handleReceipt(env) return nil - case textsecure.Envelope_CIPHERTEXT: - msg, legacy := getMessage(env) + case signalservice.Envelope_CIPHERTEXT: + msg := env.GetContent() wm, err := axolotl.LoadWhisperMessage(msg) if err != nil { return err @@ -501,13 +488,13 @@ func handleReceivedMessage(msg []byte) error { if err != nil { return err } - err = handleMessage(env.GetSource(), env.GetTimestamp(), b, legacy) + err = handleMessage(env.GetSource(), env.GetTimestamp(), b) if err != nil { return err } - case textsecure.Envelope_PREKEY_BUNDLE: - msg, legacy := getMessage(env) + case signalservice.Envelope_PREKEY_BUNDLE: + msg := env.GetContent() pkwm, err := axolotl.LoadPreKeyWhisperMessage(msg) if err != nil { return err @@ -528,7 +515,7 @@ func handleReceivedMessage(msg []byte) error { if err != nil { return err } - err = handleMessage(env.GetSource(), env.GetTimestamp(), b, legacy) + err = handleMessage(env.GetSource(), env.GetTimestamp(), b) if err != nil { return err } diff --git a/transport.go b/transport.go index 6af0f3c..d880db2 100644 --- a/transport.go +++ b/transport.go @@ -75,7 +75,7 @@ func (ht *httpTransporter) get(url string) (*response, error) { return nil, err } if config.UserAgent != "" { - req.Header.Set("User-Agent", config.UserAgent) + req.Header.Set("X-Signal-Agent", config.UserAgent) } req.SetBasicAuth(ht.user, ht.pass) resp, err := ht.client.Do(req) @@ -99,7 +99,7 @@ func (ht *httpTransporter) del(url string) (*response, error) { return nil, err } if config.UserAgent != "" { - req.Header.Set("User-Agent", config.UserAgent) + req.Header.Set("X-Signal-Agent", config.UserAgent) } req.SetBasicAuth(ht.user, ht.pass) resp, err := ht.client.Do(req) @@ -124,9 +124,9 @@ func (ht *httpTransporter) put(url string, body []byte, ct string) (*response, e return nil, err } if config.UserAgent != "" { - req.Header.Set("User-Agent", config.UserAgent) + req.Header.Set("X-Signal-Agent", config.UserAgent) } - req.Header.Add("Content-type", ct) + req.Header.Add("Content-Type", ct) req.SetBasicAuth(ht.user, ht.pass) resp, err := ht.client.Do(req) if err != nil { diff --git a/websocket.go b/websocket.go index bb56cb4..8caf2be 100644 --- a/websocket.go +++ b/websocket.go @@ -9,9 +9,9 @@ import ( "strings" "time" + "github.com/aebruno/textsecure/protobuf" "github.com/golang/protobuf/proto" "github.com/gorilla/websocket" - "github.com/janimo/textsecure/protobuf" log "github.com/Sirupsen/logrus" ) @@ -72,13 +72,13 @@ func (c *Conn) connect(originURL, user, pass string) error { // Send ack response message func (c *Conn) sendAck(id uint64) error { - typ := textsecure.WebSocketMessage_RESPONSE + typ := signalservice.WebSocketMessage_RESPONSE message := "OK" status := uint32(200) - wsm := &textsecure.WebSocketMessage{ + wsm := &signalservice.WebSocketMessage{ Type: &typ, - Response: &textsecure.WebSocketResponseMessage{ + Response: &signalservice.WebSocketResponseMessage{ Id: &id, Status: &status, Message: &message, @@ -168,7 +168,7 @@ func StartListening() error { return err } - wsm := &textsecure.WebSocketMessage{} + wsm := &signalservice.WebSocketMessage{} err = proto.Unmarshal(bmsg, wsm) if err != nil { log.WithFields(log.Fields{