selfsdk 0.0.173 → 0.0.177
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/acl.rb +5 -1
- data/lib/messages/authentication_req.rb +7 -5
- data/lib/messages/fact_request.rb +7 -6
- data/lib/messaging.rb +74 -72
- data/lib/selfsdk.rb +2 -2
- metadata +15 -10
- data/lib/proto/acl_pb.rb +0 -21
- data/lib/proto/aclcommand_pb.rb +0 -18
- data/lib/proto/auth_pb.rb +0 -21
- data/lib/proto/errtype_pb.rb +0 -21
- data/lib/proto/header_pb.rb +0 -18
- data/lib/proto/message_pb.rb +0 -24
- data/lib/proto/msgtype_pb.rb +0 -20
- data/lib/proto/notification_pb.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee70547489ad1f10f9f007fa94720d325a91bd5ea877737280a52915dafc90e9
|
4
|
+
data.tar.gz: c64c1a8f78210943dc6d8ac179b86a2375af9c71e7a6c5f76ab07f19c0fec264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f562adb112bd870e6d92f28cce8acffcfe03a825dbd97a26c87d9e6fa219dc3460b008589d03b24b597222051760ec84e60be0ff4d46be7d9445e1da767ed32c
|
7
|
+
data.tar.gz: 3dcb56852c5473c336e73ec31b5c681a6e25f16974a06bf120d11b308a5e211559fb3fbb5cedf9d282416a9d31f8c4f1ab71be1a5faf11e628dc2fd03d3ee6bb
|
data/lib/acl.rb
CHANGED
@@ -11,16 +11,19 @@ module SelfSDK
|
|
11
11
|
def initialize(messaging)
|
12
12
|
@messaging = messaging
|
13
13
|
@jwt = @messaging.jwt
|
14
|
+
@acl_rules = []
|
14
15
|
end
|
15
16
|
|
16
17
|
# Lists allowed connections.
|
17
18
|
def list
|
18
19
|
SelfSDK.logger.info "Listing allowed connections"
|
19
|
-
@messaging.list_acl_rules
|
20
|
+
@acl_rules = @messaging.list_acl_rules if @acl_rules.empty?
|
21
|
+
@acl_rules
|
20
22
|
end
|
21
23
|
|
22
24
|
# Allows incomming messages from the given identity.
|
23
25
|
def allow(id)
|
26
|
+
@acl_rules << id
|
24
27
|
SelfSDK.logger.info "Allowing connections from #{id}"
|
25
28
|
@messaging.add_acl_rule(@jwt.prepare(jti: SecureRandom.uuid,
|
26
29
|
cid: SecureRandom.uuid,
|
@@ -35,6 +38,7 @@ module SelfSDK
|
|
35
38
|
|
36
39
|
# Deny incomming messages from the given identity.
|
37
40
|
def deny(id)
|
41
|
+
@acl_rules.delete(id)
|
38
42
|
SelfSDK.logger.info "Denying connections from #{id}"
|
39
43
|
@messaging.remove_acl_rule(@jwt.prepare(jti: SecureRandom.uuid,
|
40
44
|
cid: SecureRandom.uuid,
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
|
+
require 'self_msgproto'
|
5
6
|
require_relative 'base'
|
6
7
|
require_relative '../ntptime'
|
7
8
|
require_relative 'authentication_message'
|
@@ -41,11 +42,12 @@ module SelfSDK
|
|
41
42
|
protected
|
42
43
|
|
43
44
|
def proto(to_device)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
m = SelfMsg::Message.new
|
46
|
+
m.id = SecureRandom.uuid
|
47
|
+
m.sender = "#{@jwt.id}:#{@messaging.device_id}"
|
48
|
+
m.recipient = "#{@to}:#{to_device}"
|
49
|
+
m.ciphertext = encrypt_message(@jwt.prepare(body), @to, to_device)
|
50
|
+
m
|
49
51
|
end
|
50
52
|
|
51
53
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
|
+
require 'self_msgproto'
|
5
6
|
require_relative 'base'
|
6
7
|
require_relative '../ntptime'
|
7
8
|
|
@@ -103,12 +104,12 @@ module SelfSDK
|
|
103
104
|
ciphertext = encrypt_message(@jwt.prepare(body), @intermediary, @to_device)
|
104
105
|
end
|
105
106
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
107
|
+
m = SelfMsg::Message.new
|
108
|
+
m.id = SecureRandom.uuid
|
109
|
+
m.sender = "#{@jwt.id}:#{@messaging.device_id}"
|
110
|
+
m.recipient = recipient
|
111
|
+
m.ciphertext = ciphertext
|
112
|
+
m
|
112
113
|
end
|
113
114
|
end
|
114
115
|
end
|
data/lib/messaging.rb
CHANGED
@@ -6,13 +6,9 @@ require 'json'
|
|
6
6
|
require 'monitor'
|
7
7
|
require 'faye/websocket'
|
8
8
|
require 'fileutils'
|
9
|
+
require 'self_msgproto'
|
9
10
|
require_relative 'crypto'
|
10
11
|
require_relative 'messages/message'
|
11
|
-
require_relative 'proto/auth_pb'
|
12
|
-
require_relative 'proto/message_pb'
|
13
|
-
require_relative 'proto/msgtype_pb'
|
14
|
-
require_relative 'proto/acl_pb'
|
15
|
-
require_relative 'proto/aclcommand_pb'
|
16
12
|
|
17
13
|
module SelfSDK
|
18
14
|
class MessagingClient
|
@@ -86,13 +82,13 @@ module SelfSDK
|
|
86
82
|
# @param recipient_device [string] device id for the selfID to be requested
|
87
83
|
# @param request [string] original message requesing information
|
88
84
|
def share_information(recipient, recipient_device, request)
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
85
|
+
m = SelfMsg::Message.new
|
86
|
+
m.id = SecureRandom.uuid
|
87
|
+
m.sender = "#{@jwt.id}:#{@device_id}"
|
88
|
+
m.recipient = "#{recipient}:#{recipient_device}"
|
89
|
+
m.ciphertext = @jwt.prepare(request)
|
90
|
+
|
91
|
+
send_message m
|
96
92
|
end
|
97
93
|
|
98
94
|
# Send custom mmessage
|
@@ -102,24 +98,24 @@ module SelfSDK
|
|
102
98
|
# @param request [hash] original message requesing information
|
103
99
|
def send_custom(recipient, request_body)
|
104
100
|
@client.devices(recipient).each do |to_device|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
101
|
+
m = SelfMsg::Message.new
|
102
|
+
m.id = SecureRandom.uuid
|
103
|
+
m.sender = "#{@jwt.id}:#{@device_id}"
|
104
|
+
m.recipient = "#{recipient}:#{to_device}"
|
105
|
+
m.ciphertext = @jwt.prepare(request_body)
|
106
|
+
|
107
|
+
send_message m
|
112
108
|
end
|
113
109
|
|
114
110
|
@client.devices(@jwt.id).each do |to_device|
|
115
|
-
if
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
111
|
+
if to_device != @device_id
|
112
|
+
m = SelfMsg::Message.new
|
113
|
+
m.id = SecureRandom.uuid
|
114
|
+
m.sender = "#{@jwt.id}:#{@device_id}"
|
115
|
+
m.recipient = "#{recipient}:#{to_device}"
|
116
|
+
m.ciphertext = @jwt.prepare(request_body)
|
117
|
+
|
118
|
+
send_message m
|
123
119
|
end
|
124
120
|
end
|
125
121
|
end
|
@@ -128,40 +124,40 @@ module SelfSDK
|
|
128
124
|
#
|
129
125
|
# @params payload [string] base64 encoded payload to be sent
|
130
126
|
def add_acl_rule(payload)
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
127
|
+
a = SelfMsg::Acl.new
|
128
|
+
a.id = SecureRandom.uuid
|
129
|
+
a.command = SelfMsg::AclCommandPERMIT
|
130
|
+
a.payload = payload
|
131
|
+
|
132
|
+
send_message a
|
137
133
|
end
|
138
134
|
|
139
135
|
# Blocks incoming messages from specified identities
|
140
136
|
#
|
141
137
|
# @params payload [string] base64 encoded payload to be sent
|
142
138
|
def remove_acl_rule(payload)
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
139
|
+
a = SelfMsg::Acl.new
|
140
|
+
a.id = SecureRandom.uuid
|
141
|
+
a.command = SelfMsg::AclCommandREVOKE
|
142
|
+
a.payload = payload
|
143
|
+
|
144
|
+
send_message a
|
149
145
|
end
|
150
146
|
|
151
147
|
# Lists acl rules
|
152
148
|
def list_acl_rules
|
153
149
|
wait_for 'acl_list' do
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
150
|
+
a = SelfMsg::Acl.new
|
151
|
+
a.id = SecureRandom.uuid
|
152
|
+
a.command = SelfMsg::AclCommandLIST
|
153
|
+
|
154
|
+
send_raw a
|
159
155
|
end
|
160
156
|
end
|
161
157
|
|
162
158
|
# Sends a message and waits for the response
|
163
159
|
#
|
164
|
-
# @params msg [
|
160
|
+
# @params msg [SelfMsg::Message] message object to be sent
|
165
161
|
def send_and_wait_for_response(msgs, original)
|
166
162
|
wait_for msgs.first.id, original do
|
167
163
|
msgs.each do |msg|
|
@@ -202,7 +198,7 @@ module SelfSDK
|
|
202
198
|
|
203
199
|
# Send a message through self network
|
204
200
|
#
|
205
|
-
# @params msg [
|
201
|
+
# @params msg [SelfMsg::Message] message object to be sent
|
206
202
|
def send_message(msg)
|
207
203
|
uuid = msg.id
|
208
204
|
@mon.synchronize do
|
@@ -362,34 +358,39 @@ module SelfSDK
|
|
362
358
|
|
363
359
|
# Process an event when it arrives through the websocket connection.
|
364
360
|
def on_message(event)
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
361
|
+
data = event.data.pack('c*')
|
362
|
+
hdr = SelfMsg::Header.new(data: data)
|
363
|
+
|
364
|
+
SelfSDK.logger.info " - received #{hdr.id} (#{hdr.type})"
|
365
|
+
case hdr.type
|
366
|
+
when SelfMsg::MsgTypeMSG
|
367
|
+
SelfSDK.logger.info "Message #{hdr.id} received"
|
368
|
+
m = SelfMsg::Message.new(data: data)
|
369
|
+
process_incomming_message m
|
370
|
+
when SelfMsg::MsgTypeACK
|
371
|
+
SelfSDK.logger.info "#{hdr.id} acknowledged"
|
372
|
+
mark_as_acknowledged hdr.id
|
373
|
+
when SelfMsg::MsgTypeERR
|
374
|
+
SelfSDK.logger.warn "error on #{hdr.id}"
|
375
|
+
e = SelfMsg::Notification.new(data: data)
|
376
|
+
SelfSDK.logger.warn "#{e.error}"
|
377
|
+
mark_as_arrived(hdr.id)
|
378
|
+
when SelfMsg::MsgTypeACL
|
376
379
|
SelfSDK.logger.info "ACL received"
|
377
|
-
|
378
|
-
|
379
|
-
SelfSDK.logger.info "Message #{input.id} received"
|
380
|
-
process_incomming_message input
|
380
|
+
a = SelfMsg::Acl.new(data: data)
|
381
|
+
process_incomming_acl a
|
381
382
|
end
|
382
383
|
rescue TypeError
|
383
384
|
SelfSDK.logger.info "invalid array message"
|
384
385
|
end
|
385
386
|
|
386
387
|
def process_incomming_acl(input)
|
387
|
-
list = JSON.parse(input.
|
388
|
+
list = JSON.parse(input.payload)
|
388
389
|
|
389
390
|
@messages['acl_list'][:response] = list
|
390
391
|
mark_as_arrived 'acl_list'
|
391
392
|
rescue StandardError => e
|
392
|
-
p "Error processing incoming ACL #{input.
|
393
|
+
p "Error processing incoming ACL #{input.id} #{input.payload}"
|
393
394
|
SelfSDK.logger.info e
|
394
395
|
SelfSDK.logger.info e.backtrace
|
395
396
|
nil
|
@@ -422,19 +423,20 @@ module SelfSDK
|
|
422
423
|
@auth_id = SecureRandom.uuid if @auth_id.nil?
|
423
424
|
|
424
425
|
SelfSDK.logger.info "authenticating"
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
426
|
+
|
427
|
+
a = SelfMsg::Auth.new
|
428
|
+
a.id = @auth_id
|
429
|
+
a.token = @jwt.auth_token
|
430
|
+
a.device = @device_id
|
431
|
+
a.offset = @offset
|
432
|
+
|
433
|
+
send_raw a
|
434
|
+
|
433
435
|
@auth_id = nil
|
434
436
|
end
|
435
437
|
|
436
438
|
def send_raw(msg)
|
437
|
-
@ws.send(msg.
|
439
|
+
@ws.send(msg.to_fb.bytes)
|
438
440
|
end
|
439
441
|
|
440
442
|
# Marks a message as arrived.
|
data/lib/selfsdk.rb
CHANGED
@@ -30,7 +30,7 @@ module SelfSDK
|
|
30
30
|
# @attr_reader [Types] app_key the api key for the current app.
|
31
31
|
class App
|
32
32
|
BASE_URL = "https://api.joinself.com".freeze
|
33
|
-
MESSAGING_URL = "wss://messaging.joinself.com/
|
33
|
+
MESSAGING_URL = "wss://messaging.joinself.com/v2/messaging".freeze
|
34
34
|
|
35
35
|
attr_reader :client
|
36
36
|
attr_accessor :messaging_client
|
@@ -105,7 +105,7 @@ module SelfSDK
|
|
105
105
|
|
106
106
|
def messaging_url(opts)
|
107
107
|
return opts[:messaging_url] if opts.key? :messaging_url
|
108
|
-
return "wss://messaging.#{opts[:env].to_s}.joinself.com/
|
108
|
+
return "wss://messaging.#{opts[:env].to_s}.joinself.com/v2/messaging" if opts.key? :env
|
109
109
|
MESSAGING_URL
|
110
110
|
end
|
111
111
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selfsdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.177
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aldgate Ventures
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: self_msgproto
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: async
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -327,14 +341,6 @@ files:
|
|
327
341
|
- lib/messages/message.rb
|
328
342
|
- lib/messaging.rb
|
329
343
|
- lib/ntptime.rb
|
330
|
-
- lib/proto/acl_pb.rb
|
331
|
-
- lib/proto/aclcommand_pb.rb
|
332
|
-
- lib/proto/auth_pb.rb
|
333
|
-
- lib/proto/errtype_pb.rb
|
334
|
-
- lib/proto/header_pb.rb
|
335
|
-
- lib/proto/message_pb.rb
|
336
|
-
- lib/proto/msgtype_pb.rb
|
337
|
-
- lib/proto/notification_pb.rb
|
338
344
|
- lib/selfsdk.rb
|
339
345
|
- lib/services/auth.rb
|
340
346
|
- lib/services/facts.rb
|
@@ -350,7 +356,6 @@ post_install_message:
|
|
350
356
|
rdoc_options: []
|
351
357
|
require_paths:
|
352
358
|
- lib
|
353
|
-
- lib/proto
|
354
359
|
- lib/messages
|
355
360
|
- lib/services
|
356
361
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/lib/proto/acl_pb.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# Copyright 2020 Self Group Ltd. All Rights Reserved.
|
2
|
-
|
3
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
-
# source: acl.proto
|
5
|
-
|
6
|
-
require 'google/protobuf'
|
7
|
-
|
8
|
-
require_relative 'msgtype_pb'
|
9
|
-
require_relative 'aclcommand_pb'
|
10
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
11
|
-
add_message "msgproto.AccessControlList" do
|
12
|
-
optional :type, :enum, 1, "msgproto.MsgType"
|
13
|
-
optional :id, :string, 2
|
14
|
-
optional :command, :enum, 3, "msgproto.ACLCommand"
|
15
|
-
optional :payload, :bytes, 4
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
module Msgproto
|
20
|
-
AccessControlList = Google::Protobuf::DescriptorPool.generated_pool.lookup("msgproto.AccessControlList").msgclass
|
21
|
-
end
|
data/lib/proto/aclcommand_pb.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# Copyright 2020 Self Group Ltd. All Rights Reserved.
|
2
|
-
|
3
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
-
# source: aclcommand.proto
|
5
|
-
|
6
|
-
require 'google/protobuf'
|
7
|
-
|
8
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
-
add_enum "msgproto.ACLCommand" do
|
10
|
-
value :LIST, 0
|
11
|
-
value :PERMIT, 1
|
12
|
-
value :REVOKE, 2
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
module Msgproto
|
17
|
-
ACLCommand = Google::Protobuf::DescriptorPool.generated_pool.lookup("msgproto.ACLCommand").enummodule
|
18
|
-
end
|
data/lib/proto/auth_pb.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# Copyright 2020 Self Group Ltd. All Rights Reserved.
|
2
|
-
|
3
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
-
# source: auth.proto
|
5
|
-
|
6
|
-
require 'google/protobuf'
|
7
|
-
|
8
|
-
require_relative 'msgtype_pb'
|
9
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
10
|
-
add_message "msgproto.Auth" do
|
11
|
-
optional :type, :enum, 1, "msgproto.MsgType"
|
12
|
-
optional :id, :string, 2
|
13
|
-
optional :token, :string, 3
|
14
|
-
optional :device, :string, 4
|
15
|
-
optional :offset, :int64, 5
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
module Msgproto
|
20
|
-
Auth = Google::Protobuf::DescriptorPool.generated_pool.lookup("msgproto.Auth").msgclass
|
21
|
-
end
|
data/lib/proto/errtype_pb.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# Copyright 2020 Self Group Ltd. All Rights Reserved.
|
2
|
-
|
3
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
-
# source: errtype.proto
|
5
|
-
|
6
|
-
require 'google/protobuf'
|
7
|
-
|
8
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
-
add_enum "msgproto.ErrType" do
|
10
|
-
value :ErrConnection, 0
|
11
|
-
value :ErrBadRequest, 1
|
12
|
-
value :ErrInternal, 2
|
13
|
-
value :ErrMessage, 3
|
14
|
-
value :ErrAuth, 4
|
15
|
-
value :ErrACL, 5
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
module Msgproto
|
20
|
-
ErrType = Google::Protobuf::DescriptorPool.generated_pool.lookup("msgproto.ErrType").enummodule
|
21
|
-
end
|
data/lib/proto/header_pb.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# Copyright 2020 Self Group Ltd. All Rights Reserved.
|
2
|
-
|
3
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
-
# source: header.proto
|
5
|
-
|
6
|
-
require 'google/protobuf'
|
7
|
-
|
8
|
-
require_relative 'msgtype_pb'
|
9
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
10
|
-
add_message "msgproto.Header" do
|
11
|
-
optional :type, :enum, 1, "msgproto.MsgType"
|
12
|
-
optional :id, :string, 2
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
module Msgproto
|
17
|
-
Header = Google::Protobuf::DescriptorPool.generated_pool.lookup("msgproto.Header").msgclass
|
18
|
-
end
|
data/lib/proto/message_pb.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# Copyright 2020 Self Group Ltd. All Rights Reserved.
|
2
|
-
|
3
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
-
# source: message.proto
|
5
|
-
|
6
|
-
require 'google/protobuf'
|
7
|
-
|
8
|
-
require_relative 'msgtype_pb'
|
9
|
-
require 'google/protobuf/timestamp_pb'
|
10
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
11
|
-
add_message "msgproto.Message" do
|
12
|
-
optional :type, :enum, 1, "msgproto.MsgType"
|
13
|
-
optional :id, :string, 2
|
14
|
-
optional :sender, :string, 3
|
15
|
-
optional :recipient, :string, 4
|
16
|
-
optional :ciphertext, :bytes, 5
|
17
|
-
optional :timestamp, :message, 6, "google.protobuf.Timestamp"
|
18
|
-
optional :offset, :int64, 7
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
module Msgproto
|
23
|
-
Message = Google::Protobuf::DescriptorPool.generated_pool.lookup("msgproto.Message").msgclass
|
24
|
-
end
|
data/lib/proto/msgtype_pb.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# Copyright 2020 Self Group Ltd. All Rights Reserved.
|
2
|
-
|
3
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
-
# source: msgtype.proto
|
5
|
-
|
6
|
-
require 'google/protobuf'
|
7
|
-
|
8
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
-
add_enum "msgproto.MsgType" do
|
10
|
-
value :MSG, 0
|
11
|
-
value :ACK, 1
|
12
|
-
value :ERR, 2
|
13
|
-
value :AUTH, 3
|
14
|
-
value :ACL, 4
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
module Msgproto
|
19
|
-
MsgType = Google::Protobuf::DescriptorPool.generated_pool.lookup("msgproto.MsgType").enummodule
|
20
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# Copyright 2020 Self Group Ltd. All Rights Reserved.
|
2
|
-
|
3
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
-
# source: notification.proto
|
5
|
-
|
6
|
-
require 'google/protobuf'
|
7
|
-
|
8
|
-
require_relative 'msgtype_pb'
|
9
|
-
require_relative 'errtype_pb'
|
10
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
11
|
-
add_message "msgproto.Notification" do
|
12
|
-
optional :type, :enum, 1, "msgproto.MsgType"
|
13
|
-
optional :id, :string, 2
|
14
|
-
optional :error, :string, 3
|
15
|
-
optional :errtype, :enum, 4, "msgproto.ErrType"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
module Msgproto
|
20
|
-
Notification = Google::Protobuf::DescriptorPool.generated_pool.lookup("msgproto.Notification").msgclass
|
21
|
-
end
|