diff options
author | Wim <wim@42.be> | 2022-01-31 00:27:37 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2022-03-20 14:57:48 +0100 |
commit | e3cafeaf9292f67459ff1d186f68283bfaedf2ae (patch) | |
tree | b69c39620aa91dba695b3b935c6651c0fb37ce75 /vendor/go.mau.fi/libsignal/serialize | |
parent | e7b193788a56ee7cdb02a87a9db0ad6724ef66d5 (diff) | |
download | matterbridge-msglm-e3cafeaf9292f67459ff1d186f68283bfaedf2ae.tar.gz matterbridge-msglm-e3cafeaf9292f67459ff1d186f68283bfaedf2ae.tar.bz2 matterbridge-msglm-e3cafeaf9292f67459ff1d186f68283bfaedf2ae.zip |
Add dependencies/vendor (whatsapp)
Diffstat (limited to 'vendor/go.mau.fi/libsignal/serialize')
9 files changed, 3154 insertions, 0 deletions
diff --git a/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.pb.go b/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.pb.go new file mode 100644 index 00000000..1e90caac --- /dev/null +++ b/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.pb.go @@ -0,0 +1,245 @@ +// From https://github.com/signalapp/libsignal-protocol-c/blob/master/protobuf/FingerprintProtocol.proto + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.12.4 +// source: serialize/FingerprintProtocol.proto + +package serialize + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type LogicalFingerprint struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Content []byte `protobuf:"bytes,1,opt,name=content" json:"content,omitempty"` + Identifier []byte `protobuf:"bytes,2,opt,name=identifier" json:"identifier,omitempty"` // Version 0 +} + +func (x *LogicalFingerprint) Reset() { + *x = LogicalFingerprint{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_FingerprintProtocol_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LogicalFingerprint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogicalFingerprint) ProtoMessage() {} + +func (x *LogicalFingerprint) ProtoReflect() protoreflect.Message { + mi := &file_serialize_FingerprintProtocol_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LogicalFingerprint.ProtoReflect.Descriptor instead. +func (*LogicalFingerprint) Descriptor() ([]byte, []int) { + return file_serialize_FingerprintProtocol_proto_rawDescGZIP(), []int{0} +} + +func (x *LogicalFingerprint) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +func (x *LogicalFingerprint) GetIdentifier() []byte { + if x != nil { + return x.Identifier + } + return nil +} + +type CombinedFingerprints struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` +} + +func (x *CombinedFingerprints) Reset() { + *x = CombinedFingerprints{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_FingerprintProtocol_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CombinedFingerprints) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CombinedFingerprints) ProtoMessage() {} + +func (x *CombinedFingerprints) ProtoReflect() protoreflect.Message { + mi := &file_serialize_FingerprintProtocol_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CombinedFingerprints.ProtoReflect.Descriptor instead. +func (*CombinedFingerprints) Descriptor() ([]byte, []int) { + return file_serialize_FingerprintProtocol_proto_rawDescGZIP(), []int{1} +} + +func (x *CombinedFingerprints) GetVersion() uint32 { + if x != nil && x.Version != nil { + return *x.Version + } + return 0 +} + +func (x *CombinedFingerprints) GetLocalFingerprint() *LogicalFingerprint { + if x != nil { + return x.LocalFingerprint + } + return nil +} + +func (x *CombinedFingerprints) GetRemoteFingerprint() *LogicalFingerprint { + if x != nil { + return x.RemoteFingerprint + } + return nil +} + +var File_serialize_FingerprintProtocol_proto protoreflect.FileDescriptor + +var file_serialize_FingerprintProtocol_proto_rawDesc = []byte{ + 0x0a, 0x23, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x2f, 0x46, 0x69, 0x6e, 0x67, + 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, + 0x65, 0x22, 0x4e, 0x0a, 0x12, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x46, 0x69, 0x6e, 0x67, + 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x22, 0xca, 0x01, 0x0a, 0x14, 0x43, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x65, 0x64, 0x46, 0x69, + 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4a, 0x0a, 0x10, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x46, 0x69, 0x6e, + 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x69, + 0x63, 0x61, 0x6c, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x52, 0x10, + 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, + 0x12, 0x4c, 0x0a, 0x11, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, + 0x70, 0x72, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x65, + 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, + 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x52, 0x11, 0x72, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, +} + +var ( + file_serialize_FingerprintProtocol_proto_rawDescOnce sync.Once + file_serialize_FingerprintProtocol_proto_rawDescData = file_serialize_FingerprintProtocol_proto_rawDesc +) + +func file_serialize_FingerprintProtocol_proto_rawDescGZIP() []byte { + file_serialize_FingerprintProtocol_proto_rawDescOnce.Do(func() { + file_serialize_FingerprintProtocol_proto_rawDescData = protoimpl.X.CompressGZIP(file_serialize_FingerprintProtocol_proto_rawDescData) + }) + return file_serialize_FingerprintProtocol_proto_rawDescData +} + +var file_serialize_FingerprintProtocol_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_serialize_FingerprintProtocol_proto_goTypes = []interface{}{ + (*LogicalFingerprint)(nil), // 0: textsecure.LogicalFingerprint + (*CombinedFingerprints)(nil), // 1: textsecure.CombinedFingerprints +} +var file_serialize_FingerprintProtocol_proto_depIdxs = []int32{ + 0, // 0: textsecure.CombinedFingerprints.localFingerprint:type_name -> textsecure.LogicalFingerprint + 0, // 1: textsecure.CombinedFingerprints.remoteFingerprint:type_name -> textsecure.LogicalFingerprint + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_serialize_FingerprintProtocol_proto_init() } +func file_serialize_FingerprintProtocol_proto_init() { + if File_serialize_FingerprintProtocol_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_serialize_FingerprintProtocol_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LogicalFingerprint); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_FingerprintProtocol_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CombinedFingerprints); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_serialize_FingerprintProtocol_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_serialize_FingerprintProtocol_proto_goTypes, + DependencyIndexes: file_serialize_FingerprintProtocol_proto_depIdxs, + MessageInfos: file_serialize_FingerprintProtocol_proto_msgTypes, + }.Build() + File_serialize_FingerprintProtocol_proto = out.File + file_serialize_FingerprintProtocol_proto_rawDesc = nil + file_serialize_FingerprintProtocol_proto_goTypes = nil + file_serialize_FingerprintProtocol_proto_depIdxs = nil +} diff --git a/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.proto b/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.proto new file mode 100644 index 00000000..2003ec72 --- /dev/null +++ b/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.proto @@ -0,0 +1,14 @@ +// From https://github.com/signalapp/libsignal-protocol-c/blob/master/protobuf/FingerprintProtocol.proto +syntax = "proto2"; +package textsecure; + +message LogicalFingerprint { + optional bytes content = 1; + optional bytes identifier = 2; // Version 0 +} + +message CombinedFingerprints { + optional uint32 version = 1; + optional LogicalFingerprint localFingerprint = 2; + optional LogicalFingerprint remoteFingerprint = 3; +}
\ No newline at end of file diff --git a/vendor/go.mau.fi/libsignal/serialize/JSONSerializer.go b/vendor/go.mau.fi/libsignal/serialize/JSONSerializer.go new file mode 100644 index 00000000..1245fc42 --- /dev/null +++ b/vendor/go.mau.fi/libsignal/serialize/JSONSerializer.go @@ -0,0 +1,303 @@ +package serialize + +import ( + "encoding/json" + + groupRecord "go.mau.fi/libsignal/groups/state/record" + "go.mau.fi/libsignal/logger" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/state/record" +) + +// NewJSONSerializer will return a serializer for all Signal objects that will +// be responsible for converting objects to and from JSON bytes. +func NewJSONSerializer() *Serializer { + serializer := NewSerializer() + + serializer.SignalMessage = &JSONSignalMessageSerializer{} + serializer.PreKeySignalMessage = &JSONPreKeySignalMessageSerializer{} + serializer.SignedPreKeyRecord = &JSONSignedPreKeyRecordSerializer{} + serializer.PreKeyRecord = &JSONPreKeyRecordSerializer{} + serializer.State = &JSONStateSerializer{} + serializer.Session = &JSONSessionSerializer{} + serializer.SenderKeyMessage = &JSONSenderKeyMessageSerializer{} + serializer.SenderKeyDistributionMessage = &JSONSenderKeyDistributionMessageSerializer{} + serializer.SenderKeyRecord = &JSONSenderKeySessionSerializer{} + serializer.SenderKeyState = &JSONSenderKeyStateSerializer{} + + return serializer +} + +// JSONSignalMessageSerializer is a structure for serializing signal messages into +// and from JSON. +type JSONSignalMessageSerializer struct{} + +// Serialize will take a signal message structure and convert it to JSON bytes. +func (j *JSONSignalMessageSerializer) Serialize(signalMessage *protocol.SignalMessageStructure) []byte { + serialized, err := json.Marshal(*signalMessage) + if err != nil { + logger.Error("Error serializing signal message: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a signal message structure. +func (j *JSONSignalMessageSerializer) Deserialize(serialized []byte) (*protocol.SignalMessageStructure, error) { + var signalMessage protocol.SignalMessageStructure + err := json.Unmarshal(serialized, &signalMessage) + if err != nil { + logger.Error("Error deserializing signal message: ", err) + return nil, err + } + + return &signalMessage, nil +} + +// JSONPreKeySignalMessageSerializer is a structure for serializing prekey signal messages +// into and from JSON. +type JSONPreKeySignalMessageSerializer struct{} + +// Serialize will take a prekey signal message structure and convert it to JSON bytes. +func (j *JSONPreKeySignalMessageSerializer) Serialize(signalMessage *protocol.PreKeySignalMessageStructure) []byte { + serialized, err := json.Marshal(signalMessage) + if err != nil { + logger.Error("Error serializing prekey signal message: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a prekey signal message structure. +func (j *JSONPreKeySignalMessageSerializer) Deserialize(serialized []byte) (*protocol.PreKeySignalMessageStructure, error) { + var preKeySignalMessage protocol.PreKeySignalMessageStructure + err := json.Unmarshal(serialized, &preKeySignalMessage) + if err != nil { + logger.Error("Error deserializing prekey signal message: ", err) + return nil, err + } + + return &preKeySignalMessage, nil +} + +// JSONSignedPreKeyRecordSerializer is a structure for serializing signed prekey records +// into and from JSON. +type JSONSignedPreKeyRecordSerializer struct{} + +// Serialize will take a signed prekey record structure and convert it to JSON bytes. +func (j *JSONSignedPreKeyRecordSerializer) Serialize(signedPreKey *record.SignedPreKeyStructure) []byte { + serialized, err := json.Marshal(signedPreKey) + if err != nil { + logger.Error("Error serializing signed prekey record: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a signed prekey record structure. +func (j *JSONSignedPreKeyRecordSerializer) Deserialize(serialized []byte) (*record.SignedPreKeyStructure, error) { + var signedPreKeyStructure record.SignedPreKeyStructure + err := json.Unmarshal(serialized, &signedPreKeyStructure) + if err != nil { + logger.Error("Error deserializing signed prekey record: ", err) + return nil, err + } + + return &signedPreKeyStructure, nil +} + +// JSONPreKeyRecordSerializer is a structure for serializing prekey records +// into and from JSON. +type JSONPreKeyRecordSerializer struct{} + +// Serialize will take a prekey record structure and convert it to JSON bytes. +func (j *JSONPreKeyRecordSerializer) Serialize(preKey *record.PreKeyStructure) []byte { + serialized, err := json.Marshal(preKey) + if err != nil { + logger.Error("Error serializing prekey record: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a prekey record structure. +func (j *JSONPreKeyRecordSerializer) Deserialize(serialized []byte) (*record.PreKeyStructure, error) { + var preKeyStructure record.PreKeyStructure + err := json.Unmarshal(serialized, &preKeyStructure) + if err != nil { + logger.Error("Error deserializing prekey record: ", err) + return nil, err + } + + return &preKeyStructure, nil +} + +// JSONStateSerializer is a structure for serializing session states into +// and from JSON. +type JSONStateSerializer struct{} + +// Serialize will take a session state structure and convert it to JSON bytes. +func (j *JSONStateSerializer) Serialize(state *record.StateStructure) []byte { + serialized, err := json.Marshal(state) + if err != nil { + logger.Error("Error serializing session state: ", err) + } + logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a session state structure. +func (j *JSONStateSerializer) Deserialize(serialized []byte) (*record.StateStructure, error) { + var stateStructure record.StateStructure + err := json.Unmarshal(serialized, &stateStructure) + if err != nil { + logger.Error("Error deserializing session state: ", err) + return nil, err + } + + return &stateStructure, nil +} + +// JSONSessionSerializer is a structure for serializing session records into +// and from JSON. +type JSONSessionSerializer struct{} + +// Serialize will take a session structure and convert it to JSON bytes. +func (j *JSONSessionSerializer) Serialize(session *record.SessionStructure) []byte { + serialized, err := json.Marshal(session) + if err != nil { + logger.Error("Error serializing session: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a session structure, which can be +// used to create a new Session Record object. +func (j *JSONSessionSerializer) Deserialize(serialized []byte) (*record.SessionStructure, error) { + var sessionStructure record.SessionStructure + err := json.Unmarshal(serialized, &sessionStructure) + if err != nil { + logger.Error("Error deserializing session: ", err) + return nil, err + } + + return &sessionStructure, nil +} + +// JSONSenderKeyDistributionMessageSerializer is a structure for serializing senderkey +// distribution records to and from JSON. +type JSONSenderKeyDistributionMessageSerializer struct{} + +// Serialize will take a senderkey distribution message and convert it to JSON bytes. +func (j *JSONSenderKeyDistributionMessageSerializer) Serialize(message *protocol.SenderKeyDistributionMessageStructure) []byte { + serialized, err := json.Marshal(message) + if err != nil { + logger.Error("Error serializing senderkey distribution message: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a message structure, which can be +// used to create a new SenderKey Distribution object. +func (j *JSONSenderKeyDistributionMessageSerializer) Deserialize(serialized []byte) (*protocol.SenderKeyDistributionMessageStructure, error) { + var msgStructure protocol.SenderKeyDistributionMessageStructure + err := json.Unmarshal(serialized, &msgStructure) + if err != nil { + logger.Error("Error deserializing senderkey distribution message: ", err) + return nil, err + } + + return &msgStructure, nil +} + +// JSONSenderKeyMessageSerializer is a structure for serializing senderkey +// messages to and from JSON. +type JSONSenderKeyMessageSerializer struct{} + +// Serialize will take a senderkey message and convert it to JSON bytes. +func (j *JSONSenderKeyMessageSerializer) Serialize(message *protocol.SenderKeyMessageStructure) []byte { + serialized, err := json.Marshal(message) + if err != nil { + logger.Error("Error serializing senderkey distribution message: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a message structure, which can be +// used to create a new SenderKey message object. +func (j *JSONSenderKeyMessageSerializer) Deserialize(serialized []byte) (*protocol.SenderKeyMessageStructure, error) { + var msgStructure protocol.SenderKeyMessageStructure + err := json.Unmarshal(serialized, &msgStructure) + if err != nil { + logger.Error("Error deserializing senderkey message: ", err) + return nil, err + } + + return &msgStructure, nil +} + +// JSONSenderKeyStateSerializer is a structure for serializing group session states into +// and from JSON. +type JSONSenderKeyStateSerializer struct{} + +// Serialize will take a session state structure and convert it to JSON bytes. +func (j *JSONSenderKeyStateSerializer) Serialize(state *groupRecord.SenderKeyStateStructure) []byte { + serialized, err := json.Marshal(state) + if err != nil { + logger.Error("Error serializing session state: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a session state structure. +func (j *JSONSenderKeyStateSerializer) Deserialize(serialized []byte) (*groupRecord.SenderKeyStateStructure, error) { + var stateStructure groupRecord.SenderKeyStateStructure + err := json.Unmarshal(serialized, &stateStructure) + if err != nil { + logger.Error("Error deserializing session state: ", err) + return nil, err + } + + return &stateStructure, nil +} + +// JSONSenderKeySessionSerializer is a structure for serializing session records into +// and from JSON. +type JSONSenderKeySessionSerializer struct{} + +// Serialize will take a session structure and convert it to JSON bytes. +func (j *JSONSenderKeySessionSerializer) Serialize(session *groupRecord.SenderKeyStructure) []byte { + serialized, err := json.Marshal(session) + if err != nil { + logger.Error("Error serializing session: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a session structure, which can be +// used to create a new Session Record object. +func (j *JSONSenderKeySessionSerializer) Deserialize(serialized []byte) (*groupRecord.SenderKeyStructure, error) { + var sessionStructure groupRecord.SenderKeyStructure + err := json.Unmarshal(serialized, &sessionStructure) + if err != nil { + logger.Error("Error deserializing session: ", err) + return nil, err + } + + return &sessionStructure, nil +} diff --git a/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.pb.go b/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.pb.go new file mode 100644 index 00000000..e7097399 --- /dev/null +++ b/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.pb.go @@ -0,0 +1,1500 @@ +// From https://github.com/signalapp/libsignal-protocol-c/blob/master/protobuf/LocalStorageProtocol.proto + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.12.4 +// source: serialize/LocalStorageProtocol.proto + +package serialize + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SessionStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SessionVersion *uint32 `protobuf:"varint,1,opt,name=sessionVersion" json:"sessionVersion,omitempty"` + LocalIdentityPublic []byte `protobuf:"bytes,2,opt,name=localIdentityPublic" json:"localIdentityPublic,omitempty"` + RemoteIdentityPublic []byte `protobuf:"bytes,3,opt,name=remoteIdentityPublic" json:"remoteIdentityPublic,omitempty"` + RootKey []byte `protobuf:"bytes,4,opt,name=rootKey" json:"rootKey,omitempty"` + PreviousCounter *uint32 `protobuf:"varint,5,opt,name=previousCounter" json:"previousCounter,omitempty"` + SenderChain *SessionStructure_Chain `protobuf:"bytes,6,opt,name=senderChain" json:"senderChain,omitempty"` + ReceiverChains []*SessionStructure_Chain `protobuf:"bytes,7,rep,name=receiverChains" json:"receiverChains,omitempty"` + PendingKeyExchange *SessionStructure_PendingKeyExchange `protobuf:"bytes,8,opt,name=pendingKeyExchange" json:"pendingKeyExchange,omitempty"` + PendingPreKey *SessionStructure_PendingPreKey `protobuf:"bytes,9,opt,name=pendingPreKey" json:"pendingPreKey,omitempty"` + RemoteRegistrationId *uint32 `protobuf:"varint,10,opt,name=remoteRegistrationId" json:"remoteRegistrationId,omitempty"` + LocalRegistrationId *uint32 `protobuf:"varint,11,opt,name=localRegistrationId" json:"localRegistrationId,omitempty"` + NeedsRefresh *bool `protobuf:"varint,12,opt,name=needsRefresh" json:"needsRefresh,omitempty"` + AliceBaseKey []byte `protobuf:"bytes,13,opt,name=aliceBaseKey" json:"aliceBaseKey,omitempty"` +} + +func (x *SessionStructure) Reset() { + *x = SessionStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionStructure) ProtoMessage() {} + +func (x *SessionStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionStructure.ProtoReflect.Descriptor instead. +func (*SessionStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{0} +} + +func (x *SessionStructure) GetSessionVersion() uint32 { + if x != nil && x.SessionVersion != nil { + return *x.SessionVersion + } + return 0 +} + +func (x *SessionStructure) GetLocalIdentityPublic() []byte { + if x != nil { + return x.LocalIdentityPublic + } + return nil +} + +func (x *SessionStructure) GetRemoteIdentityPublic() []byte { + if x != nil { + return x.RemoteIdentityPublic + } + return nil +} + +func (x *SessionStructure) GetRootKey() []byte { + if x != nil { + return x.RootKey + } + return nil +} + +func (x *SessionStructure) GetPreviousCounter() uint32 { + if x != nil && x.PreviousCounter != nil { + return *x.PreviousCounter + } + return 0 +} + +func (x *SessionStructure) GetSenderChain() *SessionStructure_Chain { + if x != nil { + return x.SenderChain + } + return nil +} + +func (x *SessionStructure) GetReceiverChains() []*SessionStructure_Chain { + if x != nil { + return x.ReceiverChains + } + return nil +} + +func (x *SessionStructure) GetPendingKeyExchange() *SessionStructure_PendingKeyExchange { + if x != nil { + return x.PendingKeyExchange + } + return nil +} + +func (x *SessionStructure) GetPendingPreKey() *SessionStructure_PendingPreKey { + if x != nil { + return x.PendingPreKey + } + return nil +} + +func (x *SessionStructure) GetRemoteRegistrationId() uint32 { + if x != nil && x.RemoteRegistrationId != nil { + return *x.RemoteRegistrationId + } + return 0 +} + +func (x *SessionStructure) GetLocalRegistrationId() uint32 { + if x != nil && x.LocalRegistrationId != nil { + return *x.LocalRegistrationId + } + return 0 +} + +func (x *SessionStructure) GetNeedsRefresh() bool { + if x != nil && x.NeedsRefresh != nil { + return *x.NeedsRefresh + } + return false +} + +func (x *SessionStructure) GetAliceBaseKey() []byte { + if x != nil { + return x.AliceBaseKey + } + return nil +} + +type RecordStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CurrentSession *SessionStructure `protobuf:"bytes,1,opt,name=currentSession" json:"currentSession,omitempty"` + PreviousSessions []*SessionStructure `protobuf:"bytes,2,rep,name=previousSessions" json:"previousSessions,omitempty"` +} + +func (x *RecordStructure) Reset() { + *x = RecordStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RecordStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecordStructure) ProtoMessage() {} + +func (x *RecordStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecordStructure.ProtoReflect.Descriptor instead. +func (*RecordStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{1} +} + +func (x *RecordStructure) GetCurrentSession() *SessionStructure { + if x != nil { + return x.CurrentSession + } + return nil +} + +func (x *RecordStructure) GetPreviousSessions() []*SessionStructure { + if x != nil { + return x.PreviousSessions + } + return nil +} + +type PreKeyRecordStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + PublicKey []byte `protobuf:"bytes,2,opt,name=publicKey" json:"publicKey,omitempty"` + PrivateKey []byte `protobuf:"bytes,3,opt,name=privateKey" json:"privateKey,omitempty"` +} + +func (x *PreKeyRecordStructure) Reset() { + *x = PreKeyRecordStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PreKeyRecordStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PreKeyRecordStructure) ProtoMessage() {} + +func (x *PreKeyRecordStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PreKeyRecordStructure.ProtoReflect.Descriptor instead. +func (*PreKeyRecordStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{2} +} + +func (x *PreKeyRecordStructure) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *PreKeyRecordStructure) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + +func (x *PreKeyRecordStructure) GetPrivateKey() []byte { + if x != nil { + return x.PrivateKey + } + return nil +} + +type SignedPreKeyRecordStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + PublicKey []byte `protobuf:"bytes,2,opt,name=publicKey" json:"publicKey,omitempty"` + PrivateKey []byte `protobuf:"bytes,3,opt,name=privateKey" json:"privateKey,omitempty"` + Signature []byte `protobuf:"bytes,4,opt,name=signature" json:"signature,omitempty"` + Timestamp *uint64 `protobuf:"fixed64,5,opt,name=timestamp" json:"timestamp,omitempty"` +} + +func (x *SignedPreKeyRecordStructure) Reset() { + *x = SignedPreKeyRecordStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SignedPreKeyRecordStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignedPreKeyRecordStructure) ProtoMessage() {} + +func (x *SignedPreKeyRecordStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignedPreKeyRecordStructure.ProtoReflect.Descriptor instead. +func (*SignedPreKeyRecordStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{3} +} + +func (x *SignedPreKeyRecordStructure) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *SignedPreKeyRecordStructure) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + +func (x *SignedPreKeyRecordStructure) GetPrivateKey() []byte { + if x != nil { + return x.PrivateKey + } + return nil +} + +func (x *SignedPreKeyRecordStructure) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *SignedPreKeyRecordStructure) GetTimestamp() uint64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +type IdentityKeyPairStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PublicKey []byte `protobuf:"bytes,1,opt,name=publicKey" json:"publicKey,omitempty"` + PrivateKey []byte `protobuf:"bytes,2,opt,name=privateKey" json:"privateKey,omitempty"` +} + +func (x *IdentityKeyPairStructure) Reset() { + *x = IdentityKeyPairStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityKeyPairStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityKeyPairStructure) ProtoMessage() {} + +func (x *IdentityKeyPairStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityKeyPairStructure.ProtoReflect.Descriptor instead. +func (*IdentityKeyPairStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{4} +} + +func (x *IdentityKeyPairStructure) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + +func (x *IdentityKeyPairStructure) GetPrivateKey() []byte { + if x != nil { + return x.PrivateKey + } + return nil +} + +type SenderKeyStateStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SenderKeyId *uint32 `protobuf:"varint,1,opt,name=senderKeyId" json:"senderKeyId,omitempty"` + SenderChainKey *SenderKeyStateStructure_SenderChainKey `protobuf:"bytes,2,opt,name=senderChainKey" json:"senderChainKey,omitempty"` + SenderSigningKey *SenderKeyStateStructure_SenderSigningKey `protobuf:"bytes,3,opt,name=senderSigningKey" json:"senderSigningKey,omitempty"` + SenderMessageKeys []*SenderKeyStateStructure_SenderMessageKey `protobuf:"bytes,4,rep,name=senderMessageKeys" json:"senderMessageKeys,omitempty"` +} + +func (x *SenderKeyStateStructure) Reset() { + *x = SenderKeyStateStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyStateStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyStateStructure) ProtoMessage() {} + +func (x *SenderKeyStateStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyStateStructure.ProtoReflect.Descriptor instead. +func (*SenderKeyStateStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{5} +} + +func (x *SenderKeyStateStructure) GetSenderKeyId() uint32 { + if x != nil && x.SenderKeyId != nil { + return *x.SenderKeyId + } + return 0 +} + +func (x *SenderKeyStateStructure) GetSenderChainKey() *SenderKeyStateStructure_SenderChainKey { + if x != nil { + return x.SenderChainKey + } + return nil +} + +func (x *SenderKeyStateStructure) GetSenderSigningKey() *SenderKeyStateStructure_SenderSigningKey { + if x != nil { + return x.SenderSigningKey + } + return nil +} + +func (x *SenderKeyStateStructure) GetSenderMessageKeys() []*SenderKeyStateStructure_SenderMessageKey { + if x != nil { + return x.SenderMessageKeys + } + return nil +} + +type SenderKeyRecordStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SenderKeyStates []*SenderKeyStateStructure `protobuf:"bytes,1,rep,name=senderKeyStates" json:"senderKeyStates,omitempty"` +} + +func (x *SenderKeyRecordStructure) Reset() { + *x = SenderKeyRecordStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyRecordStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyRecordStructure) ProtoMessage() {} + +func (x *SenderKeyRecordStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyRecordStructure.ProtoReflect.Descriptor instead. +func (*SenderKeyRecordStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{6} +} + +func (x *SenderKeyRecordStructure) GetSenderKeyStates() []*SenderKeyStateStructure { + if x != nil { + return x.SenderKeyStates + } + return nil +} + +type SessionStructure_Chain struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SenderRatchetKey []byte `protobuf:"bytes,1,opt,name=senderRatchetKey" json:"senderRatchetKey,omitempty"` + SenderRatchetKeyPrivate []byte `protobuf:"bytes,2,opt,name=senderRatchetKeyPrivate" json:"senderRatchetKeyPrivate,omitempty"` + ChainKey *SessionStructure_Chain_ChainKey `protobuf:"bytes,3,opt,name=chainKey" json:"chainKey,omitempty"` + MessageKeys []*SessionStructure_Chain_MessageKey `protobuf:"bytes,4,rep,name=messageKeys" json:"messageKeys,omitempty"` +} + +func (x *SessionStructure_Chain) Reset() { + *x = SessionStructure_Chain{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionStructure_Chain) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionStructure_Chain) ProtoMessage() {} + +func (x *SessionStructure_Chain) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionStructure_Chain.ProtoReflect.Descriptor instead. +func (*SessionStructure_Chain) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *SessionStructure_Chain) GetSenderRatchetKey() []byte { + if x != nil { + return x.SenderRatchetKey + } + return nil +} + +func (x *SessionStructure_Chain) GetSenderRatchetKeyPrivate() []byte { + if x != nil { + return x.SenderRatchetKeyPrivate + } + return nil +} + +func (x *SessionStructure_Chain) GetChainKey() *SessionStructure_Chain_ChainKey { + if x != nil { + return x.ChainKey + } + return nil +} + +func (x *SessionStructure_Chain) GetMessageKeys() []*SessionStructure_Chain_MessageKey { + if x != nil { + return x.MessageKeys + } + return nil +} + +type SessionStructure_PendingKeyExchange struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Sequence *uint32 `protobuf:"varint,1,opt,name=sequence" json:"sequence,omitempty"` + LocalBaseKey []byte `protobuf:"bytes,2,opt,name=localBaseKey" json:"localBaseKey,omitempty"` + LocalBaseKeyPrivate []byte `protobuf:"bytes,3,opt,name=localBaseKeyPrivate" json:"localBaseKeyPrivate,omitempty"` + LocalRatchetKey []byte `protobuf:"bytes,4,opt,name=localRatchetKey" json:"localRatchetKey,omitempty"` + LocalRatchetKeyPrivate []byte `protobuf:"bytes,5,opt,name=localRatchetKeyPrivate" json:"localRatchetKeyPrivate,omitempty"` + LocalIdentityKey []byte `protobuf:"bytes,7,opt,name=localIdentityKey" json:"localIdentityKey,omitempty"` + LocalIdentityKeyPrivate []byte `protobuf:"bytes,8,opt,name=localIdentityKeyPrivate" json:"localIdentityKeyPrivate,omitempty"` +} + +func (x *SessionStructure_PendingKeyExchange) Reset() { + *x = SessionStructure_PendingKeyExchange{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionStructure_PendingKeyExchange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionStructure_PendingKeyExchange) ProtoMessage() {} + +func (x *SessionStructure_PendingKeyExchange) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionStructure_PendingKeyExchange.ProtoReflect.Descriptor instead. +func (*SessionStructure_PendingKeyExchange) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *SessionStructure_PendingKeyExchange) GetSequence() uint32 { + if x != nil && x.Sequence != nil { + return *x.Sequence + } + return 0 +} + +func (x *SessionStructure_PendingKeyExchange) GetLocalBaseKey() []byte { + if x != nil { + return x.LocalBaseKey + } + return nil +} + +func (x *SessionStructure_PendingKeyExchange) GetLocalBaseKeyPrivate() []byte { + if x != nil { + return x.LocalBaseKeyPrivate + } + return nil +} + +func (x *SessionStructure_PendingKeyExchange) GetLocalRatchetKey() []byte { + if x != nil { + return x.LocalRatchetKey + } + return nil +} + +func (x *SessionStructure_PendingKeyExchange) GetLocalRatchetKeyPrivate() []byte { + if x != nil { + return x.LocalRatchetKeyPrivate + } + return nil +} + +func (x *SessionStructure_PendingKeyExchange) GetLocalIdentityKey() []byte { + if x != nil { + return x.LocalIdentityKey + } + return nil +} + +func (x *SessionStructure_PendingKeyExchange) GetLocalIdentityKeyPrivate() []byte { + if x != nil { + return x.LocalIdentityKeyPrivate + } + return nil +} + +type SessionStructure_PendingPreKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PreKeyId *uint32 `protobuf:"varint,1,opt,name=preKeyId" json:"preKeyId,omitempty"` + SignedPreKeyId *int32 `protobuf:"varint,3,opt,name=signedPreKeyId" json:"signedPreKeyId,omitempty"` + BaseKey []byte `protobuf:"bytes,2,opt,name=baseKey" json:"baseKey,omitempty"` +} + +func (x *SessionStructure_PendingPreKey) Reset() { + *x = SessionStructure_PendingPreKey{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionStructure_PendingPreKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionStructure_PendingPreKey) ProtoMessage() {} + +func (x *SessionStructure_PendingPreKey) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionStructure_PendingPreKey.ProtoReflect.Descriptor instead. +func (*SessionStructure_PendingPreKey) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{0, 2} +} + +func (x *SessionStructure_PendingPreKey) GetPreKeyId() uint32 { + if x != nil && x.PreKeyId != nil { + return *x.PreKeyId + } + return 0 +} + +func (x *SessionStructure_PendingPreKey) GetSignedPreKeyId() int32 { + if x != nil && x.SignedPreKeyId != nil { + return *x.SignedPreKeyId + } + return 0 +} + +func (x *SessionStructure_PendingPreKey) GetBaseKey() []byte { + if x != nil { + return x.BaseKey + } + return nil +} + +type SessionStructure_Chain_ChainKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index *uint32 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` +} + +func (x *SessionStructure_Chain_ChainKey) Reset() { + *x = SessionStructure_Chain_ChainKey{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionStructure_Chain_ChainKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionStructure_Chain_ChainKey) ProtoMessage() {} + +func (x *SessionStructure_Chain_ChainKey) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionStructure_Chain_ChainKey.ProtoReflect.Descriptor instead. +func (*SessionStructure_Chain_ChainKey) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{0, 0, 0} +} + +func (x *SessionStructure_Chain_ChainKey) GetIndex() uint32 { + if x != nil && x.Index != nil { + return *x.Index + } + return 0 +} + +func (x *SessionStructure_Chain_ChainKey) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +type SessionStructure_Chain_MessageKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index *uint32 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"` + CipherKey []byte `protobuf:"bytes,2,opt,name=cipherKey" json:"cipherKey,omitempty"` + MacKey []byte `protobuf:"bytes,3,opt,name=macKey" json:"macKey,omitempty"` + Iv []byte `protobuf:"bytes,4,opt,name=iv" json:"iv,omitempty"` +} + +func (x *SessionStructure_Chain_MessageKey) Reset() { + *x = SessionStructure_Chain_MessageKey{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionStructure_Chain_MessageKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionStructure_Chain_MessageKey) ProtoMessage() {} + +func (x *SessionStructure_Chain_MessageKey) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionStructure_Chain_MessageKey.ProtoReflect.Descriptor instead. +func (*SessionStructure_Chain_MessageKey) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{0, 0, 1} +} + +func (x *SessionStructure_Chain_MessageKey) GetIndex() uint32 { + if x != nil && x.Index != nil { + return *x.Index + } + return 0 +} + +func (x *SessionStructure_Chain_MessageKey) GetCipherKey() []byte { + if x != nil { + return x.CipherKey + } + return nil +} + +func (x *SessionStructure_Chain_MessageKey) GetMacKey() []byte { + if x != nil { + return x.MacKey + } + return nil +} + +func (x *SessionStructure_Chain_MessageKey) GetIv() []byte { + if x != nil { + return x.Iv + } + return nil +} + +type SenderKeyStateStructure_SenderChainKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Iteration *uint32 `protobuf:"varint,1,opt,name=iteration" json:"iteration,omitempty"` + Seed []byte `protobuf:"bytes,2,opt,name=seed" json:"seed,omitempty"` +} + +func (x *SenderKeyStateStructure_SenderChainKey) Reset() { + *x = SenderKeyStateStructure_SenderChainKey{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyStateStructure_SenderChainKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyStateStructure_SenderChainKey) ProtoMessage() {} + +func (x *SenderKeyStateStructure_SenderChainKey) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyStateStructure_SenderChainKey.ProtoReflect.Descriptor instead. +func (*SenderKeyStateStructure_SenderChainKey) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{5, 0} +} + +func (x *SenderKeyStateStructure_SenderChainKey) GetIteration() uint32 { + if x != nil && x.Iteration != nil { + return *x.Iteration + } + return 0 +} + +func (x *SenderKeyStateStructure_SenderChainKey) GetSeed() []byte { + if x != nil { + return x.Seed + } + return nil +} + +type SenderKeyStateStructure_SenderMessageKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Iteration *uint32 `protobuf:"varint,1,opt,name=iteration" json:"iteration,omitempty"` + Seed []byte `protobuf:"bytes,2,opt,name=seed" json:"seed,omitempty"` +} + +func (x *SenderKeyStateStructure_SenderMessageKey) Reset() { + *x = SenderKeyStateStructure_SenderMessageKey{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyStateStructure_SenderMessageKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyStateStructure_SenderMessageKey) ProtoMessage() {} + +func (x *SenderKeyStateStructure_SenderMessageKey) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyStateStructure_SenderMessageKey.ProtoReflect.Descriptor instead. +func (*SenderKeyStateStructure_SenderMessageKey) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{5, 1} +} + +func (x *SenderKeyStateStructure_SenderMessageKey) GetIteration() uint32 { + if x != nil && x.Iteration != nil { + return *x.Iteration + } + return 0 +} + +func (x *SenderKeyStateStructure_SenderMessageKey) GetSeed() []byte { + if x != nil { + return x.Seed + } + return nil +} + +type SenderKeyStateStructure_SenderSigningKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Public []byte `protobuf:"bytes,1,opt,name=public" json:"public,omitempty"` + Private []byte `protobuf:"bytes,2,opt,name=private" json:"private,omitempty"` +} + +func (x *SenderKeyStateStructure_SenderSigningKey) Reset() { + *x = SenderKeyStateStructure_SenderSigningKey{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyStateStructure_SenderSigningKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyStateStructure_SenderSigningKey) ProtoMessage() {} + +func (x *SenderKeyStateStructure_SenderSigningKey) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyStateStructure_SenderSigningKey.ProtoReflect.Descriptor instead. +func (*SenderKeyStateStructure_SenderSigningKey) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{5, 2} +} + +func (x *SenderKeyStateStructure_SenderSigningKey) GetPublic() []byte { + if x != nil { + return x.Public + } + return nil +} + +func (x *SenderKeyStateStructure_SenderSigningKey) GetPrivate() []byte { + if x != nil { + return x.Private + } + return nil +} + +var File_serialize_LocalStorageProtocol_proto protoreflect.FileDescriptor + +var file_serialize_LocalStorageProtocol_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x2f, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, + 0x72, 0x65, 0x22, 0xbf, 0x0c, 0x0a, 0x10, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, + 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x30, 0x0a, 0x13, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x13, 0x6c, 0x6f, + 0x63, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x75, 0x62, 0x6c, 0x69, + 0x63, 0x12, 0x32, 0x0a, 0x14, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x14, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x6f, 0x6f, 0x74, 0x4b, 0x65, 0x79, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x6f, 0x6f, 0x74, 0x4b, 0x65, 0x79, 0x12, + 0x28, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, + 0x75, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x44, 0x0a, 0x0b, 0x73, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x52, 0x0b, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, + 0x4a, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x0e, 0x72, 0x65, 0x63, + 0x65, 0x69, 0x76, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x5f, 0x0a, 0x12, 0x70, + 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, + 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x12, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, + 0x67, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x50, 0x0a, 0x0d, + 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, + 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, + 0x65, 0x2e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, 0x52, + 0x0d, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x32, + 0x0a, 0x14, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x72, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x12, 0x30, 0x0a, 0x13, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x13, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x6e, 0x65, 0x65, 0x64, 0x73, 0x52, 0x65, 0x66, + 0x72, 0x65, 0x73, 0x68, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6e, 0x65, 0x65, 0x64, + 0x73, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x6c, 0x69, 0x63, + 0x65, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, + 0x61, 0x6c, 0x69, 0x63, 0x65, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x1a, 0xa5, 0x03, 0x0a, + 0x05, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x2a, 0x0a, 0x10, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x52, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x10, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, + 0x65, 0x79, 0x12, 0x38, 0x0a, 0x17, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x61, 0x74, 0x63, + 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x17, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x61, 0x74, 0x63, 0x68, + 0x65, 0x74, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x08, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, + 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x08, 0x63, 0x68, 0x61, + 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x4f, 0x0a, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x4b, 0x65, 0x79, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x74, 0x65, 0x78, + 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x1a, 0x32, 0x0a, 0x08, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x68, 0x0a, 0x0a, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1c, + 0x0a, 0x09, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x09, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, + 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6d, 0x61, + 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x02, 0x69, 0x76, 0x1a, 0xce, 0x02, 0x0a, 0x12, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x4b, 0x65, 0x79, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, + 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x73, + 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x6c, + 0x6f, 0x63, 0x61, 0x6c, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x30, 0x0a, 0x13, 0x6c, + 0x6f, 0x63, 0x61, 0x6c, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x13, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x42, + 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x28, 0x0a, + 0x0f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x61, 0x74, + 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x36, 0x0a, 0x16, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x52, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x16, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x61, + 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, + 0x2a, 0x0a, 0x10, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x4b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x12, 0x38, 0x0a, 0x17, 0x6c, + 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x17, 0x6c, 0x6f, + 0x63, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x50, 0x72, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x1a, 0x6d, 0x0a, 0x0d, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x4b, 0x65, 0x79, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x72, 0x65, 0x4b, 0x65, 0x79, + 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x72, 0x65, 0x4b, + 0x65, 0x79, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x73, 0x69, 0x67, 0x6e, + 0x65, 0x64, 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, + 0x73, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x62, 0x61, 0x73, + 0x65, 0x4b, 0x65, 0x79, 0x22, 0xa1, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, + 0x65, 0x6e, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0e, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x48, + 0x0a, 0x10, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, + 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x52, 0x10, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x65, 0x0a, 0x15, 0x50, 0x72, 0x65, 0x4b, + 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, + 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, + 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x22, + 0xa7, 0x01, 0x0a, 0x1b, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, + 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x1c, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, + 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x06, 0x52, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x58, 0x0a, 0x18, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x50, 0x61, 0x69, 0x72, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x4b, 0x65, 0x79, 0x22, 0xad, 0x04, 0x0a, 0x17, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, + 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x49, + 0x64, 0x12, 0x5a, 0x0a, 0x0e, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x74, 0x65, 0x78, 0x74, + 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x53, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x0e, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x60, 0x0a, + 0x10, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, 0x10, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, + 0x62, 0x0a, 0x11, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x4b, 0x65, 0x79, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x74, 0x65, 0x78, + 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, + 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, + 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, + 0x52, 0x11, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, + 0x65, 0x79, 0x73, 0x1a, 0x42, 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x04, 0x73, 0x65, 0x65, 0x64, 0x1a, 0x44, 0x0a, 0x10, 0x53, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, + 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, + 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x65, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x65, 0x65, 0x64, 0x1a, 0x44, 0x0a, + 0x10, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, + 0x79, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x69, + 0x76, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x72, 0x69, 0x76, + 0x61, 0x74, 0x65, 0x22, 0x69, 0x0a, 0x18, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, + 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x4d, 0x0a, 0x0f, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, + 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x42, 0x33, + 0x0a, 0x22, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x68, 0x69, 0x73, 0x70, 0x65, 0x72, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x73, 0x2e, 0x6c, 0x69, 0x62, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x2e, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x42, 0x0d, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x73, +} + +var ( + file_serialize_LocalStorageProtocol_proto_rawDescOnce sync.Once + file_serialize_LocalStorageProtocol_proto_rawDescData = file_serialize_LocalStorageProtocol_proto_rawDesc +) + +func file_serialize_LocalStorageProtocol_proto_rawDescGZIP() []byte { + file_serialize_LocalStorageProtocol_proto_rawDescOnce.Do(func() { + file_serialize_LocalStorageProtocol_proto_rawDescData = protoimpl.X.CompressGZIP(file_serialize_LocalStorageProtocol_proto_rawDescData) + }) + return file_serialize_LocalStorageProtocol_proto_rawDescData +} + +var file_serialize_LocalStorageProtocol_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_serialize_LocalStorageProtocol_proto_goTypes = []interface{}{ + (*SessionStructure)(nil), // 0: textsecure.SessionStructure + (*RecordStructure)(nil), // 1: textsecure.RecordStructure + (*PreKeyRecordStructure)(nil), // 2: textsecure.PreKeyRecordStructure + (*SignedPreKeyRecordStructure)(nil), // 3: textsecure.SignedPreKeyRecordStructure + (*IdentityKeyPairStructure)(nil), // 4: textsecure.IdentityKeyPairStructure + (*SenderKeyStateStructure)(nil), // 5: textsecure.SenderKeyStateStructure + (*SenderKeyRecordStructure)(nil), // 6: textsecure.SenderKeyRecordStructure + (*SessionStructure_Chain)(nil), // 7: textsecure.SessionStructure.Chain + (*SessionStructure_PendingKeyExchange)(nil), // 8: textsecure.SessionStructure.PendingKeyExchange + (*SessionStructure_PendingPreKey)(nil), // 9: textsecure.SessionStructure.PendingPreKey + (*SessionStructure_Chain_ChainKey)(nil), // 10: textsecure.SessionStructure.Chain.ChainKey + (*SessionStructure_Chain_MessageKey)(nil), // 11: textsecure.SessionStructure.Chain.MessageKey + (*SenderKeyStateStructure_SenderChainKey)(nil), // 12: textsecure.SenderKeyStateStructure.SenderChainKey + (*SenderKeyStateStructure_SenderMessageKey)(nil), // 13: textsecure.SenderKeyStateStructure.SenderMessageKey + (*SenderKeyStateStructure_SenderSigningKey)(nil), // 14: textsecure.SenderKeyStateStructure.SenderSigningKey +} +var file_serialize_LocalStorageProtocol_proto_depIdxs = []int32{ + 7, // 0: textsecure.SessionStructure.senderChain:type_name -> textsecure.SessionStructure.Chain + 7, // 1: textsecure.SessionStructure.receiverChains:type_name -> textsecure.SessionStructure.Chain + 8, // 2: textsecure.SessionStructure.pendingKeyExchange:type_name -> textsecure.SessionStructure.PendingKeyExchange + 9, // 3: textsecure.SessionStructure.pendingPreKey:type_name -> textsecure.SessionStructure.PendingPreKey + 0, // 4: textsecure.RecordStructure.currentSession:type_name -> textsecure.SessionStructure + 0, // 5: textsecure.RecordStructure.previousSessions:type_name -> textsecure.SessionStructure + 12, // 6: textsecure.SenderKeyStateStructure.senderChainKey:type_name -> textsecure.SenderKeyStateStructure.SenderChainKey + 14, // 7: textsecure.SenderKeyStateStructure.senderSigningKey:type_name -> textsecure.SenderKeyStateStructure.SenderSigningKey + 13, // 8: textsecure.SenderKeyStateStructure.senderMessageKeys:type_name -> textsecure.SenderKeyStateStructure.SenderMessageKey + 5, // 9: textsecure.SenderKeyRecordStructure.senderKeyStates:type_name -> textsecure.SenderKeyStateStructure + 10, // 10: textsecure.SessionStructure.Chain.chainKey:type_name -> textsecure.SessionStructure.Chain.ChainKey + 11, // 11: textsecure.SessionStructure.Chain.messageKeys:type_name -> textsecure.SessionStructure.Chain.MessageKey + 12, // [12:12] is the sub-list for method output_type + 12, // [12:12] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name +} + +func init() { file_serialize_LocalStorageProtocol_proto_init() } +func file_serialize_LocalStorageProtocol_proto_init() { + if File_serialize_LocalStorageProtocol_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_serialize_LocalStorageProtocol_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RecordStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PreKeyRecordStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SignedPreKeyRecordStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityKeyPairStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyStateStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyRecordStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionStructure_Chain); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionStructure_PendingKeyExchange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionStructure_PendingPreKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionStructure_Chain_ChainKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionStructure_Chain_MessageKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyStateStructure_SenderChainKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyStateStructure_SenderMessageKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyStateStructure_SenderSigningKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_serialize_LocalStorageProtocol_proto_rawDesc, + NumEnums: 0, + NumMessages: 15, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_serialize_LocalStorageProtocol_proto_goTypes, + DependencyIndexes: file_serialize_LocalStorageProtocol_proto_depIdxs, + MessageInfos: file_serialize_LocalStorageProtocol_proto_msgTypes, + }.Build() + File_serialize_LocalStorageProtocol_proto = out.File + file_serialize_LocalStorageProtocol_proto_rawDesc = nil + file_serialize_LocalStorageProtocol_proto_goTypes = nil + file_serialize_LocalStorageProtocol_proto_depIdxs = nil +} diff --git a/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.proto b/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.proto new file mode 100644 index 00000000..8ae9c01a --- /dev/null +++ b/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.proto @@ -0,0 +1,114 @@ +// From https://github.com/signalapp/libsignal-protocol-c/blob/master/protobuf/LocalStorageProtocol.proto +syntax = "proto2"; +package textsecure; + +option java_package = "org.whispersystems.libsignal.state"; +option java_outer_classname = "StorageProtos"; + +message SessionStructure { + message Chain { + optional bytes senderRatchetKey = 1; + optional bytes senderRatchetKeyPrivate = 2; + + message ChainKey { + optional uint32 index = 1; + optional bytes key = 2; + } + + optional ChainKey chainKey = 3; + + message MessageKey { + optional uint32 index = 1; + optional bytes cipherKey = 2; + optional bytes macKey = 3; + optional bytes iv = 4; + } + + repeated MessageKey messageKeys = 4; + } + + message PendingKeyExchange { + optional uint32 sequence = 1; + optional bytes localBaseKey = 2; + optional bytes localBaseKeyPrivate = 3; + optional bytes localRatchetKey = 4; + optional bytes localRatchetKeyPrivate = 5; + optional bytes localIdentityKey = 7; + optional bytes localIdentityKeyPrivate = 8; + } + + message PendingPreKey { + optional uint32 preKeyId = 1; + optional int32 signedPreKeyId = 3; + optional bytes baseKey = 2; + } + + optional uint32 sessionVersion = 1; + optional bytes localIdentityPublic = 2; + optional bytes remoteIdentityPublic = 3; + + optional bytes rootKey = 4; + optional uint32 previousCounter = 5; + + optional Chain senderChain = 6; + repeated Chain receiverChains = 7; + + optional PendingKeyExchange pendingKeyExchange = 8; + optional PendingPreKey pendingPreKey = 9; + + optional uint32 remoteRegistrationId = 10; + optional uint32 localRegistrationId = 11; + + optional bool needsRefresh = 12; + optional bytes aliceBaseKey = 13; +} + +message RecordStructure { + optional SessionStructure currentSession = 1; + repeated SessionStructure previousSessions = 2; +} + +message PreKeyRecordStructure { + optional uint32 id = 1; + optional bytes publicKey = 2; + optional bytes privateKey = 3; +} + +message SignedPreKeyRecordStructure { + optional uint32 id = 1; + optional bytes publicKey = 2; + optional bytes privateKey = 3; + optional bytes signature = 4; + optional fixed64 timestamp = 5; +} + +message IdentityKeyPairStructure { + optional bytes publicKey = 1; + optional bytes privateKey = 2; +} + +message SenderKeyStateStructure { + message SenderChainKey { + optional uint32 iteration = 1; + optional bytes seed = 2; + } + + message SenderMessageKey { + optional uint32 iteration = 1; + optional bytes seed = 2; + } + + message SenderSigningKey { + optional bytes public = 1; + optional bytes private = 2; + } + + optional uint32 senderKeyId = 1; + optional SenderChainKey senderChainKey = 2; + optional SenderSigningKey senderSigningKey = 3; + repeated SenderMessageKey senderMessageKeys = 4; +} + +message SenderKeyRecordStructure { + repeated SenderKeyStateStructure senderKeyStates = 1; +}
\ No newline at end of file diff --git a/vendor/go.mau.fi/libsignal/serialize/ProtoBufferSerializer.go b/vendor/go.mau.fi/libsignal/serialize/ProtoBufferSerializer.go new file mode 100644 index 00000000..81482d31 --- /dev/null +++ b/vendor/go.mau.fi/libsignal/serialize/ProtoBufferSerializer.go @@ -0,0 +1,262 @@ +package serialize + +import ( + "fmt" + "strconv" + + "go.mau.fi/libsignal/logger" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/util/bytehelper" + "go.mau.fi/libsignal/util/optional" + proto "google.golang.org/protobuf/proto" +) + +// NewProtoBufSerializer will return a serializer for all Signal objects that will +// be responsible for converting objects to and from ProtoBuf bytes. +func NewProtoBufSerializer() *Serializer { + serializer := NewSerializer() + + serializer.SignalMessage = &ProtoBufSignalMessageSerializer{} + serializer.PreKeySignalMessage = &ProtoBufPreKeySignalMessageSerializer{} + serializer.SenderKeyMessage = &ProtoBufSenderKeyMessageSerializer{} + serializer.SenderKeyDistributionMessage = &ProtoBufSenderKeyDistributionMessageSerializer{} + serializer.SignedPreKeyRecord = &JSONSignedPreKeyRecordSerializer{} + serializer.PreKeyRecord = &JSONPreKeyRecordSerializer{} + serializer.State = &JSONStateSerializer{} + serializer.Session = &JSONSessionSerializer{} + serializer.SenderKeyRecord = &JSONSenderKeySessionSerializer{} + serializer.SenderKeyState = &JSONSenderKeyStateSerializer{} + + return serializer +} + +func highBitsToInt(value byte) int { + return int((value & 0xFF) >> 4) +} + +func intsToByteHighAndLow(highValue, lowValue int) byte { + return byte((highValue<<4 | lowValue) & 0xFF) +} + +// ProtoBufSignalMessageSerializer is a structure for serializing signal messages into +// and from ProtoBuf. +type ProtoBufSignalMessageSerializer struct{} + +// Serialize will take a signal message structure and convert it to ProtoBuf bytes. +func (j *ProtoBufSignalMessageSerializer) Serialize(signalMessage *protocol.SignalMessageStructure) []byte { + sm := &SignalMessage{ + RatchetKey: signalMessage.RatchetKey, + Counter: &signalMessage.Counter, + PreviousCounter: &signalMessage.PreviousCounter, + Ciphertext: signalMessage.CipherText, + } + var serialized []byte + message, err := proto.Marshal(sm) + if err != nil { + logger.Error("Error serializing signal message: ", err) + } + + if signalMessage.Version != 0 { + serialized = append(serialized, []byte(strconv.Itoa(signalMessage.Version))...) + } + serialized = append(serialized, message...) + + if signalMessage.Mac != nil { + serialized = append(serialized, signalMessage.Mac...) + } + + return serialized +} + +// Deserialize will take in ProtoBuf bytes and return a signal message structure. +func (j *ProtoBufSignalMessageSerializer) Deserialize(serialized []byte) (*protocol.SignalMessageStructure, error) { + parts, err := bytehelper.SplitThree(serialized, 1, len(serialized)-1-protocol.MacLength, protocol.MacLength) + if err != nil { + logger.Error("Error split signal message: ", err) + return nil, err + } + version := highBitsToInt(parts[0][0]) + message := parts[1] + mac := parts[2] + + var sm SignalMessage + err = proto.Unmarshal(message, &sm) + if err != nil { + logger.Error("Error deserializing signal message: ", err) + return nil, err + } + + signalMessage := protocol.SignalMessageStructure{ + Version: version, + RatchetKey: sm.GetRatchetKey(), + Counter: sm.GetCounter(), + PreviousCounter: sm.GetPreviousCounter(), + CipherText: sm.GetCiphertext(), + Mac: mac, + } + + return &signalMessage, nil +} + +// ProtoBufPreKeySignalMessageSerializer is a structure for serializing prekey signal messages +// into and from ProtoBuf. +type ProtoBufPreKeySignalMessageSerializer struct{} + +// Serialize will take a prekey signal message structure and convert it to ProtoBuf bytes. +func (j *ProtoBufPreKeySignalMessageSerializer) Serialize(signalMessage *protocol.PreKeySignalMessageStructure) []byte { + preKeyMessage := &PreKeySignalMessage{ + RegistrationId: &signalMessage.RegistrationID, + SignedPreKeyId: &signalMessage.SignedPreKeyID, + BaseKey: signalMessage.BaseKey, + IdentityKey: signalMessage.IdentityKey, + Message: signalMessage.Message, + } + + if !signalMessage.PreKeyID.IsEmpty { + preKeyMessage.PreKeyId = &signalMessage.PreKeyID.Value + } + + message, err := proto.Marshal(preKeyMessage) + if err != nil { + logger.Error("Error serializing prekey signal message: ", err) + } + + serialized := append([]byte(strconv.Itoa(signalMessage.Version)), message...) + logger.Debug("Serialize PreKeySignalMessage result: ", serialized) + return serialized +} + +// Deserialize will take in ProtoBuf bytes and return a prekey signal message structure. +func (j *ProtoBufPreKeySignalMessageSerializer) Deserialize(serialized []byte) (*protocol.PreKeySignalMessageStructure, error) { + version := highBitsToInt(serialized[0]) + message := serialized[1:] + var sm PreKeySignalMessage + err := proto.Unmarshal(message, &sm) + if err != nil { + logger.Error("Error deserializing prekey signal message: ", err) + return nil, err + } + + preKeyId := optional.NewEmptyUint32() + if sm.GetPreKeyId() != 0 { + preKeyId = optional.NewOptionalUint32(sm.GetPreKeyId()) + } + + preKeySignalMessage := protocol.PreKeySignalMessageStructure{ + Version: version, + RegistrationID: sm.GetRegistrationId(), + BaseKey: sm.GetBaseKey(), + IdentityKey: sm.GetIdentityKey(), + SignedPreKeyID: sm.GetSignedPreKeyId(), + Message: sm.GetMessage(), + PreKeyID: preKeyId, + } + + return &preKeySignalMessage, nil +} + +// ProtoBufSenderKeyDistributionMessageSerializer is a structure for serializing senderkey +// distribution records to and from ProtoBuf. +type ProtoBufSenderKeyDistributionMessageSerializer struct{} + +// Serialize will take a senderkey distribution message and convert it to ProtoBuf bytes. +func (j *ProtoBufSenderKeyDistributionMessageSerializer) Serialize(message *protocol.SenderKeyDistributionMessageStructure) []byte { + senderDis := SenderKeyDistributionMessage{ + Id: &message.ID, + Iteration: &message.Iteration, + ChainKey: message.ChainKey, + SigningKey: message.SigningKey, + } + + serialized, err := proto.Marshal(&senderDis) + if err != nil { + logger.Error("Error serializing senderkey distribution message: ", err) + } + + version := strconv.Itoa(int(message.Version)) + serialized = append([]byte(version), serialized...) + logger.Debug("Serialize result: ", serialized) + return serialized +} + +// Deserialize will take in ProtoBuf bytes and return a message structure, which can be +// used to create a new SenderKey Distribution object. +func (j *ProtoBufSenderKeyDistributionMessageSerializer) Deserialize(serialized []byte) (*protocol.SenderKeyDistributionMessageStructure, error) { + version := uint32(highBitsToInt(serialized[0])) + message := serialized[1:] + + var senderKeyDis SenderKeyDistributionMessage + err := proto.Unmarshal(message, &senderKeyDis) + if err != nil { + logger.Error("Error deserializing senderkey distribution message: ", err) + return nil, err + } + + msgStructure := protocol.SenderKeyDistributionMessageStructure{ + ID: senderKeyDis.GetId(), + Iteration: senderKeyDis.GetIteration(), + ChainKey: senderKeyDis.GetChainKey(), + SigningKey: senderKeyDis.GetSigningKey(), + Version: version, + } + return &msgStructure, nil +} + +// ProtoBufSenderKeyMessageSerializer is a structure for serializing senderkey +// messages to and from ProtoBuf. +type ProtoBufSenderKeyMessageSerializer struct{} + +// Serialize will take a senderkey message and convert it to ProtoBuf bytes. +func (j *ProtoBufSenderKeyMessageSerializer) Serialize(message *protocol.SenderKeyMessageStructure) []byte { + senderMessage := &SenderKeyMessage{ + Id: &message.ID, + Iteration: &message.Iteration, + Ciphertext: message.CipherText, + } + + var serialized []byte + m, err := proto.Marshal(senderMessage) + if err != nil { + logger.Error("Error serializing signal message: ", err) + } + + if message.Version != 0 { + serialized = append([]byte(fmt.Sprint(message.Version)), m...) + } + + if message.Signature != nil { + serialized = append(serialized, message.Signature...) + } + logger.Debug("Serialize result: ", serialized) + return serialized +} + +// Deserialize will take in ProtoBuf bytes and return a message structure, which can be +// used to create a new SenderKey message object. +func (j *ProtoBufSenderKeyMessageSerializer) Deserialize(serialized []byte) (*protocol.SenderKeyMessageStructure, error) { + parts, err := bytehelper.SplitThree(serialized, 1, len(serialized)-1-64, 64) + if err != nil { + logger.Error("Error split signal message: ", err) + return nil, err + } + version := uint32(highBitsToInt(parts[0][0])) + message := parts[1] + signature := parts[2] + + var senderKey SenderKeyMessage + err = proto.Unmarshal(message, &senderKey) + if err != nil { + logger.Error("Error deserializing senderkey message: ", err) + return nil, err + } + + msgStructure := protocol.SenderKeyMessageStructure{ + Version: version, + ID: senderKey.GetId(), + Iteration: senderKey.GetIteration(), + CipherText: senderKey.GetCiphertext(), + Signature: signature, + } + + return &msgStructure, nil +} diff --git a/vendor/go.mau.fi/libsignal/serialize/Serializer.go b/vendor/go.mau.fi/libsignal/serialize/Serializer.go new file mode 100644 index 00000000..fe7dd433 --- /dev/null +++ b/vendor/go.mau.fi/libsignal/serialize/Serializer.go @@ -0,0 +1,31 @@ +// Package serialize provides a serialization structure to serialize and +// deserialize Signal objects into storeable and transportable bytes. +package serialize + +import ( + groupRecord "go.mau.fi/libsignal/groups/state/record" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/state/record" +) + +// NewSerializer will return a new serializer object that will be used +// to encode/decode Signal objects into bytes. +func NewSerializer() *Serializer { + return &Serializer{} +} + +// Serializer is a structure to serialize Signal objects +// into bytes. This allows you to use any serialization format +// to store or send Signal objects. +type Serializer struct { + SenderKeyRecord groupRecord.SenderKeySerializer + SenderKeyState groupRecord.SenderKeyStateSerializer + SignalMessage protocol.SignalMessageSerializer + PreKeySignalMessage protocol.PreKeySignalMessageSerializer + SenderKeyMessage protocol.SenderKeyMessageSerializer + SenderKeyDistributionMessage protocol.SenderKeyDistributionMessageSerializer + SignedPreKeyRecord record.SignedPreKeySerializer + PreKeyRecord record.PreKeySerializer + State record.StateSerializer + Session record.SessionSerializer +} diff --git a/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.pb.go b/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.pb.go new file mode 100644 index 00000000..18143be5 --- /dev/null +++ b/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.pb.go @@ -0,0 +1,640 @@ +// From https://github.com/signalapp/libsignal-protocol-c/blob/master/protobuf/WhisperTextProtocol.proto + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.12.4 +// source: serialize/WhisperTextProtocol.proto + +package serialize + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SignalMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + Ciphertext []byte `protobuf:"bytes,4,opt,name=ciphertext" json:"ciphertext,omitempty"` +} + +func (x *SignalMessage) Reset() { + *x = SignalMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SignalMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignalMessage) ProtoMessage() {} + +func (x *SignalMessage) ProtoReflect() protoreflect.Message { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignalMessage.ProtoReflect.Descriptor instead. +func (*SignalMessage) Descriptor() ([]byte, []int) { + return file_serialize_WhisperTextProtocol_proto_rawDescGZIP(), []int{0} +} + +func (x *SignalMessage) GetRatchetKey() []byte { + if x != nil { + return x.RatchetKey + } + return nil +} + +func (x *SignalMessage) GetCounter() uint32 { + if x != nil && x.Counter != nil { + return *x.Counter + } + return 0 +} + +func (x *SignalMessage) GetPreviousCounter() uint32 { + if x != nil && x.PreviousCounter != nil { + return *x.PreviousCounter + } + return 0 +} + +func (x *SignalMessage) GetCiphertext() []byte { + if x != nil { + return x.Ciphertext + } + return nil +} + +type PreKeySignalMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + BaseKey []byte `protobuf:"bytes,2,opt,name=baseKey" json:"baseKey,omitempty"` + IdentityKey []byte `protobuf:"bytes,3,opt,name=identityKey" json:"identityKey,omitempty"` + Message []byte `protobuf:"bytes,4,opt,name=message" json:"message,omitempty"` // SignalMessage +} + +func (x *PreKeySignalMessage) Reset() { + *x = PreKeySignalMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PreKeySignalMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PreKeySignalMessage) ProtoMessage() {} + +func (x *PreKeySignalMessage) ProtoReflect() protoreflect.Message { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PreKeySignalMessage.ProtoReflect.Descriptor instead. +func (*PreKeySignalMessage) Descriptor() ([]byte, []int) { + return file_serialize_WhisperTextProtocol_proto_rawDescGZIP(), []int{1} +} + +func (x *PreKeySignalMessage) GetRegistrationId() uint32 { + if x != nil && x.RegistrationId != nil { + return *x.RegistrationId + } + return 0 +} + +func (x *PreKeySignalMessage) GetPreKeyId() uint32 { + if x != nil && x.PreKeyId != nil { + return *x.PreKeyId + } + return 0 +} + +func (x *PreKeySignalMessage) GetSignedPreKeyId() uint32 { + if x != nil && x.SignedPreKeyId != nil { + return *x.SignedPreKeyId + } + return 0 +} + +func (x *PreKeySignalMessage) GetBaseKey() []byte { + if x != nil { + return x.BaseKey + } + return nil +} + +func (x *PreKeySignalMessage) GetIdentityKey() []byte { + if x != nil { + return x.IdentityKey + } + return nil +} + +func (x *PreKeySignalMessage) GetMessage() []byte { + if x != nil { + return x.Message + } + return nil +} + +type KeyExchangeMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + BaseKey []byte `protobuf:"bytes,2,opt,name=baseKey" json:"baseKey,omitempty"` + RatchetKey []byte `protobuf:"bytes,3,opt,name=ratchetKey" json:"ratchetKey,omitempty"` + IdentityKey []byte `protobuf:"bytes,4,opt,name=identityKey" json:"identityKey,omitempty"` + BaseKeySignature []byte `protobuf:"bytes,5,opt,name=baseKeySignature" json:"baseKeySignature,omitempty"` +} + +func (x *KeyExchangeMessage) Reset() { + *x = KeyExchangeMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeyExchangeMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyExchangeMessage) ProtoMessage() {} + +func (x *KeyExchangeMessage) ProtoReflect() protoreflect.Message { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyExchangeMessage.ProtoReflect.Descriptor instead. +func (*KeyExchangeMessage) Descriptor() ([]byte, []int) { + return file_serialize_WhisperTextProtocol_proto_rawDescGZIP(), []int{2} +} + +func (x *KeyExchangeMessage) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *KeyExchangeMessage) GetBaseKey() []byte { + if x != nil { + return x.BaseKey + } + return nil +} + +func (x *KeyExchangeMessage) GetRatchetKey() []byte { + if x != nil { + return x.RatchetKey + } + return nil +} + +func (x *KeyExchangeMessage) GetIdentityKey() []byte { + if x != nil { + return x.IdentityKey + } + return nil +} + +func (x *KeyExchangeMessage) GetBaseKeySignature() []byte { + if x != nil { + return x.BaseKeySignature + } + return nil +} + +type SenderKeyMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + Iteration *uint32 `protobuf:"varint,2,opt,name=iteration" json:"iteration,omitempty"` + Ciphertext []byte `protobuf:"bytes,3,opt,name=ciphertext" json:"ciphertext,omitempty"` +} + +func (x *SenderKeyMessage) Reset() { + *x = SenderKeyMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyMessage) ProtoMessage() {} + +func (x *SenderKeyMessage) ProtoReflect() protoreflect.Message { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyMessage.ProtoReflect.Descriptor instead. +func (*SenderKeyMessage) Descriptor() ([]byte, []int) { + return file_serialize_WhisperTextProtocol_proto_rawDescGZIP(), []int{3} +} + +func (x *SenderKeyMessage) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *SenderKeyMessage) GetIteration() uint32 { + if x != nil && x.Iteration != nil { + return *x.Iteration + } + return 0 +} + +func (x *SenderKeyMessage) GetCiphertext() []byte { + if x != nil { + return x.Ciphertext + } + return nil +} + +type SenderKeyDistributionMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + Iteration *uint32 `protobuf:"varint,2,opt,name=iteration" json:"iteration,omitempty"` + ChainKey []byte `protobuf:"bytes,3,opt,name=chainKey" json:"chainKey,omitempty"` + SigningKey []byte `protobuf:"bytes,4,opt,name=signingKey" json:"signingKey,omitempty"` +} + +func (x *SenderKeyDistributionMessage) Reset() { + *x = SenderKeyDistributionMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyDistributionMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyDistributionMessage) ProtoMessage() {} + +func (x *SenderKeyDistributionMessage) ProtoReflect() protoreflect.Message { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyDistributionMessage.ProtoReflect.Descriptor instead. +func (*SenderKeyDistributionMessage) Descriptor() ([]byte, []int) { + return file_serialize_WhisperTextProtocol_proto_rawDescGZIP(), []int{4} +} + +func (x *SenderKeyDistributionMessage) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *SenderKeyDistributionMessage) GetIteration() uint32 { + if x != nil && x.Iteration != nil { + return *x.Iteration + } + return 0 +} + +func (x *SenderKeyDistributionMessage) GetChainKey() []byte { + if x != nil { + return x.ChainKey + } + return nil +} + +func (x *SenderKeyDistributionMessage) GetSigningKey() []byte { + if x != nil { + return x.SigningKey + } + return nil +} + +type DeviceConsistencyCodeMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Generation *uint32 `protobuf:"varint,1,opt,name=generation" json:"generation,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` +} + +func (x *DeviceConsistencyCodeMessage) Reset() { + *x = DeviceConsistencyCodeMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceConsistencyCodeMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceConsistencyCodeMessage) ProtoMessage() {} + +func (x *DeviceConsistencyCodeMessage) ProtoReflect() protoreflect.Message { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceConsistencyCodeMessage.ProtoReflect.Descriptor instead. +func (*DeviceConsistencyCodeMessage) Descriptor() ([]byte, []int) { + return file_serialize_WhisperTextProtocol_proto_rawDescGZIP(), []int{5} +} + +func (x *DeviceConsistencyCodeMessage) GetGeneration() uint32 { + if x != nil && x.Generation != nil { + return *x.Generation + } + return 0 +} + +func (x *DeviceConsistencyCodeMessage) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +var File_serialize_WhisperTextProtocol_proto protoreflect.FileDescriptor + +var file_serialize_WhisperTextProtocol_proto_rawDesc = []byte{ + 0x0a, 0x23, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x2f, 0x57, 0x68, 0x69, 0x73, + 0x70, 0x65, 0x72, 0x54, 0x65, 0x78, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, + 0x65, 0x22, 0x93, 0x01, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x72, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, + 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x28, 0x0a, + 0x0f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, + 0x72, 0x74, 0x65, 0x78, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x69, 0x70, + 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x22, 0xd7, 0x01, 0x0a, 0x13, 0x50, 0x72, 0x65, 0x4b, + 0x65, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x26, 0x0a, 0x0e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x4b, 0x65, + 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x72, 0x65, 0x4b, 0x65, + 0x79, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x72, 0x65, + 0x4b, 0x65, 0x79, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x73, 0x69, 0x67, + 0x6e, 0x65, 0x64, 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, + 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x62, 0x61, + 0x73, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x22, 0xac, 0x01, 0x0a, 0x12, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x73, 0x65, + 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x62, 0x61, 0x73, 0x65, 0x4b, + 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x72, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, + 0x65, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, + 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x4b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x10, 0x62, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, + 0x62, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x22, 0x60, 0x0a, 0x10, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, + 0x78, 0x74, 0x22, 0x88, 0x01, 0x0a, 0x1c, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, + 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, + 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x22, 0x5c, 0x0a, + 0x1c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, + 0x63, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, + 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, +} + +var ( + file_serialize_WhisperTextProtocol_proto_rawDescOnce sync.Once + file_serialize_WhisperTextProtocol_proto_rawDescData = file_serialize_WhisperTextProtocol_proto_rawDesc +) + +func file_serialize_WhisperTextProtocol_proto_rawDescGZIP() []byte { + file_serialize_WhisperTextProtocol_proto_rawDescOnce.Do(func() { + file_serialize_WhisperTextProtocol_proto_rawDescData = protoimpl.X.CompressGZIP(file_serialize_WhisperTextProtocol_proto_rawDescData) + }) + return file_serialize_WhisperTextProtocol_proto_rawDescData +} + +var file_serialize_WhisperTextProtocol_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_serialize_WhisperTextProtocol_proto_goTypes = []interface{}{ + (*SignalMessage)(nil), // 0: textsecure.SignalMessage + (*PreKeySignalMessage)(nil), // 1: textsecure.PreKeySignalMessage + (*KeyExchangeMessage)(nil), // 2: textsecure.KeyExchangeMessage + (*SenderKeyMessage)(nil), // 3: textsecure.SenderKeyMessage + (*SenderKeyDistributionMessage)(nil), // 4: textsecure.SenderKeyDistributionMessage + (*DeviceConsistencyCodeMessage)(nil), // 5: textsecure.DeviceConsistencyCodeMessage +} +var file_serialize_WhisperTextProtocol_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_serialize_WhisperTextProtocol_proto_init() } +func file_serialize_WhisperTextProtocol_proto_init() { + if File_serialize_WhisperTextProtocol_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_serialize_WhisperTextProtocol_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SignalMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_WhisperTextProtocol_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PreKeySignalMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_WhisperTextProtocol_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyExchangeMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_WhisperTextProtocol_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_WhisperTextProtocol_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyDistributionMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_WhisperTextProtocol_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeviceConsistencyCodeMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_serialize_WhisperTextProtocol_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_serialize_WhisperTextProtocol_proto_goTypes, + DependencyIndexes: file_serialize_WhisperTextProtocol_proto_depIdxs, + MessageInfos: file_serialize_WhisperTextProtocol_proto_msgTypes, + }.Build() + File_serialize_WhisperTextProtocol_proto = out.File + file_serialize_WhisperTextProtocol_proto_rawDesc = nil + file_serialize_WhisperTextProtocol_proto_goTypes = nil + file_serialize_WhisperTextProtocol_proto_depIdxs = nil +} diff --git a/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.proto b/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.proto new file mode 100644 index 00000000..def080b4 --- /dev/null +++ b/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.proto @@ -0,0 +1,45 @@ +// From https://github.com/signalapp/libsignal-protocol-c/blob/master/protobuf/WhisperTextProtocol.proto +syntax = "proto2"; +package textsecure; + +message SignalMessage { + optional bytes ratchetKey = 1; + optional uint32 counter = 2; + optional uint32 previousCounter = 3; + optional bytes ciphertext = 4; +} + +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; // SignalMessage +} + +message KeyExchangeMessage { + optional uint32 id = 1; + optional bytes baseKey = 2; + optional bytes ratchetKey = 3; + optional bytes identityKey = 4; + optional bytes baseKeySignature = 5; +} + +message SenderKeyMessage { + optional uint32 id = 1; + optional uint32 iteration = 2; + optional bytes ciphertext = 3; +} + +message SenderKeyDistributionMessage { + optional uint32 id = 1; + optional uint32 iteration = 2; + optional bytes chainKey = 3; + optional bytes signingKey = 4; +} + +message DeviceConsistencyCodeMessage { + optional uint32 generation = 1; + optional bytes signature = 2; +}
\ No newline at end of file |