From b3c09e54099e12a6a5e9df7c3325bb6bafc7bb16 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Thu, 5 Jul 2018 16:47:37 -0500 Subject: [PATCH] ricochet protobuf files, for completeness --- .drone.yml | 4 +- LICENSE | 4 +- wire/auth/AuthHiddenService.proto | 25 ++++++++++++ wire/chat/ChatChannel.proto | 18 ++++++++ wire/contact/ContactRequestChannel.proto | 35 ++++++++++++++++ wire/control/ControlChannel.proto | 52 ++++++++++++++++++++++++ 6 files changed, 134 insertions(+), 4 deletions(-) create mode 100644 wire/auth/AuthHiddenService.proto create mode 100644 wire/chat/ChatChannel.proto create mode 100644 wire/contact/ContactRequestChannel.proto create mode 100644 wire/control/ControlChannel.proto diff --git a/.drone.yml b/.drone.yml index d81dab5..0728b9a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -39,8 +39,8 @@ pipeline: notify-gogs: image: golang when: - event: pull-request + event: pull_request secrets: [BUILDBOT] commands: - echo "Notifying" - - sh gogs-notify.sh \ No newline at end of file + - sh gogs-notify.sh diff --git a/LICENSE b/LICENSE index 53fed65..a861b65 100644 --- a/LICENSE +++ b/LICENSE @@ -25,7 +25,7 @@ SOFTWARE. -------------------------------------------------------------------------------- -Autogenerated protobuf code was generated using the proto file from Ricochet. +Autogenerated protobuf code was generated using the proto files from Ricochet. They are covered under the following license. Ricochet - https://ricochet.im/ @@ -61,4 +61,4 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- -go-ricochet is not affiliated with or endorsed by Ricochet.im or the Tor Project. +libricochet-go is not affiliated with or endorsed by Ricochet.im or the Tor Project. diff --git a/wire/auth/AuthHiddenService.proto b/wire/auth/AuthHiddenService.proto new file mode 100644 index 0000000..afbe209 --- /dev/null +++ b/wire/auth/AuthHiddenService.proto @@ -0,0 +1,25 @@ +package Protocol.Data.AuthHiddenService; +import "ControlChannel.proto"; + +extend Control.OpenChannel { + optional bytes client_cookie = 7200; // 16 random bytes +} + +extend Control.ChannelResult { + optional bytes server_cookie = 7200; // 16 random bytes +} + +message Packet { + optional Proof proof = 1; + optional Result result = 2; +} + +message Proof { + optional bytes public_key = 1; // DER encoded public key + optional bytes signature = 2; // RSA signature +} + +message Result { + required bool accepted = 1; + optional bool is_known_contact = 2; +} diff --git a/wire/chat/ChatChannel.proto b/wire/chat/ChatChannel.proto new file mode 100644 index 0000000..30adac4 --- /dev/null +++ b/wire/chat/ChatChannel.proto @@ -0,0 +1,18 @@ +package Protocol.Data.Chat; + +message Packet { + optional ChatMessage chat_message = 1; + optional ChatAcknowledge chat_acknowledge = 2; +} + +message ChatMessage { + required string message_text = 1; + optional uint32 message_id = 2; // Random ID for ack + optional int64 time_delta = 3; // Delta in seconds between now and when message was written +} + +message ChatAcknowledge { + optional uint32 message_id = 1; + optional bool accepted = 2 [default = true]; +} + diff --git a/wire/contact/ContactRequestChannel.proto b/wire/contact/ContactRequestChannel.proto new file mode 100644 index 0000000..75591d4 --- /dev/null +++ b/wire/contact/ContactRequestChannel.proto @@ -0,0 +1,35 @@ +package Protocol.Data.ContactRequest; +import "ControlChannel.proto"; + +enum Limits { + MessageMaxCharacters = 2000; + NicknameMaxCharacters = 30; +} + +extend Control.OpenChannel { + optional ContactRequest contact_request = 200; +} + +extend Control.ChannelResult { + optional Response response = 201; +} + +// Sent only as an attachment to OpenChannel +message ContactRequest { + optional string nickname = 1; + optional string message_text = 2; +} + +// Response is the only valid message to send on the channel +message Response { + enum Status { + Undefined = 0; // Not valid on the wire + Pending = 1; + Accepted = 2; + Rejected = 3; + Error = 4; + } + + required Status status = 1; +} + diff --git a/wire/control/ControlChannel.proto b/wire/control/ControlChannel.proto new file mode 100644 index 0000000..7d66516 --- /dev/null +++ b/wire/control/ControlChannel.proto @@ -0,0 +1,52 @@ +package Protocol.Data.Control; + +message Packet { + // Must contain exactly one field + optional OpenChannel open_channel = 1; + optional ChannelResult channel_result = 2; + optional KeepAlive keep_alive = 3; + optional EnableFeatures enable_features = 4; + optional FeaturesEnabled features_enabled = 5; +} + +message OpenChannel { + required int32 channel_identifier = 1; // Arbitrary unique identifier for this channel instance + required string channel_type = 2; // String identifying channel type; e.g. im.ricochet.chat + + // It is valid to extend the OpenChannel message to add fields specific + // to the requested channel_type. + extensions 100 to max; +} + +message ChannelResult { + required int32 channel_identifier = 1; // Matching the value from OpenChannel + required bool opened = 2; // If the channel is now open + + enum CommonError { + GenericError = 0; + UnknownTypeError = 1; + UnauthorizedError = 2; + BadUsageError = 3; + FailedError = 4; + } + + optional CommonError common_error = 3; + + // As with OpenChannel, it is valid to extend this message with fields specific + // to the channel type. + extensions 100 to max; +} + +message KeepAlive { + required bool response_requested = 1; +} + +message EnableFeatures { + repeated string feature = 1; + extensions 100 to max; +} + +message FeaturesEnabled { + repeated string feature = 1; + extensions 100 to max; +}