ruby_home 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +13 -14
- data/README.md +1 -1
- data/bin/rubyhome +1 -1
- data/lib/ruby_home/accessory_info.rb +33 -72
- data/lib/ruby_home/device_id.rb +0 -2
- data/lib/ruby_home/dns/service.rb +1 -6
- data/lib/ruby_home/dns/text_record.rb +0 -2
- data/lib/ruby_home/factories/accessory_factory.rb +0 -5
- data/lib/ruby_home/factories/characteristic_factory.rb +0 -3
- data/lib/ruby_home/factories/templates/characteristic_template.rb +0 -1
- data/lib/ruby_home/factories/templates/service_template.rb +0 -2
- data/lib/ruby_home/hap/accessory.rb +2 -2
- data/lib/ruby_home/hap/characteristic.rb +2 -2
- data/lib/ruby_home/hap/crypto/chacha20poly1305.rb +0 -4
- data/lib/ruby_home/hap/crypto/hkdf.rb +0 -2
- data/lib/ruby_home/hap/http_decryption.rb +5 -6
- data/lib/ruby_home/hap/http_encryption.rb +21 -11
- data/lib/ruby_home/hap/service.rb +0 -3
- data/lib/ruby_home/hap/tlv.rb +28 -21
- data/lib/ruby_home/hex_helper.rb +15 -0
- data/lib/ruby_home/http/application.rb +24 -19
- data/lib/ruby_home/http/controllers/accessories_controller.rb +1 -2
- data/lib/ruby_home/http/controllers/application_controller.rb +60 -13
- data/lib/ruby_home/http/controllers/characteristics_controller.rb +2 -3
- data/lib/ruby_home/http/controllers/pair_setups_controller.rb +41 -78
- data/lib/ruby_home/http/controllers/pair_verifies_controller.rb +22 -24
- data/lib/ruby_home/http/controllers/pairings_controller.rb +8 -8
- data/lib/ruby_home/http/hap_request.rb +2 -6
- data/lib/ruby_home/http/hap_response.rb +2 -8
- data/lib/ruby_home/http/hap_server.rb +7 -12
- data/lib/ruby_home/http/serializers/object_serializer.rb +0 -2
- data/lib/ruby_home/http/services/start_srp_service.rb +46 -0
- data/lib/ruby_home/http/services/verify_srp_service.rb +55 -0
- data/lib/ruby_home/rack/handler/hap_server.rb +2 -7
- data/lib/ruby_home/version.rb +1 -1
- data/lib/ruby_home/yaml_record.rb +440 -0
- data/lib/ruby_home.rb +45 -6
- data/rubyhome.gemspec +4 -4
- metadata +44 -49
- data/lib/ruby_home/broadcast.rb +0 -31
- data/lib/ruby_home/hap/hex_pad.rb +0 -13
- data/lib/ruby_home/http/cache.rb +0 -30
@@ -0,0 +1,440 @@
|
|
1
|
+
# Original code https://github.com/nicotaing/yaml_record
|
2
|
+
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/callbacks'
|
5
|
+
require 'active_support/core_ext/hash'
|
6
|
+
require 'securerandom'
|
7
|
+
require 'yaml'
|
8
|
+
|
9
|
+
module YamlRecord
|
10
|
+
module Adapters
|
11
|
+
class LocalStore
|
12
|
+
|
13
|
+
# Returns YAML File as ruby collection
|
14
|
+
#
|
15
|
+
# === Example:
|
16
|
+
#
|
17
|
+
# @adapter.read("foo") => [{...}, {...}]
|
18
|
+
#
|
19
|
+
def read(source)
|
20
|
+
return false unless File.exists?(source)
|
21
|
+
|
22
|
+
YAML.load_file(source)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Writes ruby collection as YAML File
|
26
|
+
#
|
27
|
+
# === Example:
|
28
|
+
#
|
29
|
+
# @adapter.write("foo", [{...}, {...}]) => "<yaml data>"
|
30
|
+
#
|
31
|
+
def write(source, collection)
|
32
|
+
File.open(source, 'w') {|f| f.write(collection.to_yaml) }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Base
|
38
|
+
attr_accessor :attributes, :is_created, :is_destroyed
|
39
|
+
|
40
|
+
include ActiveSupport::Callbacks
|
41
|
+
define_callbacks :before_save, :after_save, :before_destroy, :after_destroy, :before_validation, :before_create, :after_create
|
42
|
+
|
43
|
+
set_callback :before_create, :before, :set_id!
|
44
|
+
|
45
|
+
# Constructs a new YamlRecord instance based on specified attribute hash
|
46
|
+
#
|
47
|
+
# === Example:
|
48
|
+
#
|
49
|
+
# class Post < YamlRecord::Base; properties :foo; end
|
50
|
+
#
|
51
|
+
# Post.new(:foo => "bar")
|
52
|
+
#
|
53
|
+
def initialize(attr_hash={})
|
54
|
+
attr_hash.symbolize_keys!
|
55
|
+
attr_hash.reverse_merge!(self.class.properties.inject({}) { |result, key| result[key] = nil; result })
|
56
|
+
|
57
|
+
self.attributes ||= {}
|
58
|
+
self.is_created = attr_hash.delete(:persisted) || false
|
59
|
+
attr_hash.each do |k,v|
|
60
|
+
self.send("#{k}=", v) # self.attributes[:media] = "foo"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Accesses given attribute from YamlRecord instance
|
65
|
+
#
|
66
|
+
# === Example:
|
67
|
+
#
|
68
|
+
# @post[:foo] => "bar"
|
69
|
+
#
|
70
|
+
def [](attribute)
|
71
|
+
self.attributes[attribute]
|
72
|
+
end
|
73
|
+
|
74
|
+
# Assign given attribute from YamlRecord instance with specified value
|
75
|
+
#
|
76
|
+
# === Example:
|
77
|
+
#
|
78
|
+
# @post[:foo] = "baz"
|
79
|
+
#
|
80
|
+
def []=(attribute, value)
|
81
|
+
self.attributes[attribute] = value
|
82
|
+
end
|
83
|
+
|
84
|
+
# Saved YamlRecord instance to file
|
85
|
+
# Executes save and create callbacks
|
86
|
+
# Returns true if record saved; false otherwise
|
87
|
+
#
|
88
|
+
# === Example:
|
89
|
+
#
|
90
|
+
# @post.save => true
|
91
|
+
#
|
92
|
+
def save
|
93
|
+
run_callbacks(:before_save)
|
94
|
+
run_callbacks(:before_create) unless self.is_created
|
95
|
+
|
96
|
+
existing_items = self.class.all
|
97
|
+
if self.new_record?
|
98
|
+
existing_items << self
|
99
|
+
else # update existing record
|
100
|
+
updated_item = existing_items.find { |item| item.id == self.id }
|
101
|
+
return false unless updated_item
|
102
|
+
updated_item.attributes = self.attributes
|
103
|
+
end
|
104
|
+
|
105
|
+
raw_data = existing_items ? existing_items.map { |item| item.persisted_attributes } : []
|
106
|
+
self.class.write_contents(raw_data) if self.valid?
|
107
|
+
|
108
|
+
run_callbacks(:after_create) unless self.is_created
|
109
|
+
run_callbacks(:after_save)
|
110
|
+
true
|
111
|
+
rescue IOError
|
112
|
+
false
|
113
|
+
end
|
114
|
+
|
115
|
+
# Update YamlRecord instance with specified attributes
|
116
|
+
# Returns true if record updated; false otherwise
|
117
|
+
#
|
118
|
+
# === Example:
|
119
|
+
#
|
120
|
+
# @post.update_attributes(:foo => "baz", :miso => "awesome") => true
|
121
|
+
#
|
122
|
+
def update_attributes(updated_attrs={})
|
123
|
+
updated_attrs.each { |k,v| self.send("#{k}=", v) }
|
124
|
+
self.save
|
125
|
+
end
|
126
|
+
|
127
|
+
# Returns array of instance attributes names; An attribute is a value stored for this record (persisted or not)
|
128
|
+
#
|
129
|
+
# === Example:
|
130
|
+
#
|
131
|
+
# @post.column_names => ["foo", "miso"]
|
132
|
+
#
|
133
|
+
def column_names
|
134
|
+
self.attributes.keys.map(&:to_s)
|
135
|
+
end
|
136
|
+
|
137
|
+
# Returns hash of attributes to be persisted to file.
|
138
|
+
# A persisted attribute is a value stored in the file (specified with the properties declaration)
|
139
|
+
#
|
140
|
+
# === Example:
|
141
|
+
#
|
142
|
+
# class Post < YamlRecord::Base; properties :foo, :miso; end
|
143
|
+
# @post = Post.create(:foo => "bar", :miso => "great")
|
144
|
+
# @post.persisted_attributes => { :id => "a1b2c3", :foo => "bar", :miso => "great" }
|
145
|
+
#
|
146
|
+
def persisted_attributes
|
147
|
+
self.attributes.slice(*self.class.properties).reject { |k, v| v.nil? }
|
148
|
+
end
|
149
|
+
|
150
|
+
# Returns true if YamlRecord instance hasn't persisted; false otherwise
|
151
|
+
#
|
152
|
+
# === Example:
|
153
|
+
#
|
154
|
+
# @post = Post.new(:foo => "bar", :miso => "great")
|
155
|
+
# @post.new_record? => true
|
156
|
+
# @post.save => true
|
157
|
+
# @post.new_record? => false
|
158
|
+
#
|
159
|
+
def new_record?
|
160
|
+
!self.is_created
|
161
|
+
end
|
162
|
+
|
163
|
+
# Returns true if YamlRecord instance has been destroyed; false otherwise
|
164
|
+
#
|
165
|
+
# === Example:
|
166
|
+
#
|
167
|
+
# @post = Post.new(:foo => "bar", :miso => "great")
|
168
|
+
# @post.destroyed? => false
|
169
|
+
# @post.save
|
170
|
+
# @post.destroy => true
|
171
|
+
# @post.destroyed? => true
|
172
|
+
#
|
173
|
+
def destroyed?
|
174
|
+
self.is_destroyed
|
175
|
+
end
|
176
|
+
|
177
|
+
# Remove a persisted YamlRecord object
|
178
|
+
# Returns true if destroyed; false otherwise
|
179
|
+
#
|
180
|
+
# === Example:
|
181
|
+
#
|
182
|
+
# @post = Post.create(:foo => "bar", :miso => "great")
|
183
|
+
# Post.all.size => 1
|
184
|
+
# @post.destroy => true
|
185
|
+
# Post.all.size => 0
|
186
|
+
#
|
187
|
+
def destroy
|
188
|
+
run_callbacks(:before_destroy)
|
189
|
+
new_data = self.class.all.reject { |item| item.persisted_attributes == self.persisted_attributes }.map { |item| item.persisted_attributes }
|
190
|
+
self.class.write_contents(new_data)
|
191
|
+
self.is_destroyed = true
|
192
|
+
run_callbacks(:after_destroy)
|
193
|
+
true
|
194
|
+
rescue IOError
|
195
|
+
false
|
196
|
+
end
|
197
|
+
|
198
|
+
# Execute validations for instance
|
199
|
+
# Returns true if record is valid; false otherwise
|
200
|
+
# TODO Implement validation
|
201
|
+
#
|
202
|
+
# === Example:
|
203
|
+
#
|
204
|
+
# @post.valid? => true
|
205
|
+
#
|
206
|
+
def valid?
|
207
|
+
true
|
208
|
+
end
|
209
|
+
|
210
|
+
# Returns errors messages if record isn't valid; empty array otherwise
|
211
|
+
# TODO Implement validation
|
212
|
+
#
|
213
|
+
# === Example:
|
214
|
+
#
|
215
|
+
# @post.errors => ["Foo can't be blank"]
|
216
|
+
#
|
217
|
+
def errors
|
218
|
+
[]
|
219
|
+
end
|
220
|
+
|
221
|
+
# Returns YamlRecord Instance
|
222
|
+
# Complies with ActiveModel api
|
223
|
+
#
|
224
|
+
# === Example:
|
225
|
+
#
|
226
|
+
# @post.to_model => @post
|
227
|
+
#
|
228
|
+
def to_model
|
229
|
+
self
|
230
|
+
end
|
231
|
+
|
232
|
+
# Returns the instance of a record as a parameter
|
233
|
+
# By default return an id
|
234
|
+
#
|
235
|
+
# === Example:
|
236
|
+
#
|
237
|
+
# @post.to_param => <id>
|
238
|
+
#
|
239
|
+
def to_param
|
240
|
+
self.id
|
241
|
+
end
|
242
|
+
|
243
|
+
# Reload YamlRecord instance attributes from file
|
244
|
+
#
|
245
|
+
# === Example:
|
246
|
+
#
|
247
|
+
# @post = Post.create(:foo => "bar", :miso => "great")
|
248
|
+
# @post.foo = "bazz"
|
249
|
+
# @post.reload
|
250
|
+
# @post.foo => "bar"
|
251
|
+
#
|
252
|
+
def reload
|
253
|
+
record = self.class.find(self.id)
|
254
|
+
self.attributes = record.attributes
|
255
|
+
record
|
256
|
+
end
|
257
|
+
|
258
|
+
# Find YamlRecord instance given attribute name and expected value
|
259
|
+
# Supports checking inclusion for array based values
|
260
|
+
# Returns instance if found; false otherwise
|
261
|
+
#
|
262
|
+
# === Example:
|
263
|
+
#
|
264
|
+
# Post.find_by_attribute(:foo, "bar") => @post
|
265
|
+
# Post.find_by_attribute(:some_list, "item") => @post
|
266
|
+
#
|
267
|
+
def self.find_by_attribute(attribute, expected_value)
|
268
|
+
self.all.find do |record|
|
269
|
+
value = record.send(attribute) if record.respond_to?(attribute)
|
270
|
+
value.is_a?(Array) ?
|
271
|
+
value.include?(expected_value) :
|
272
|
+
value == expected_value
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
class << self;
|
277
|
+
|
278
|
+
# Find YamlRecord instance given id
|
279
|
+
# Returns instance if found; false otherwise
|
280
|
+
#
|
281
|
+
# === Example:
|
282
|
+
#
|
283
|
+
# Post.find_by_id("a1b2c3") => @post
|
284
|
+
#
|
285
|
+
def find_by_id(value)
|
286
|
+
self.find_by_attribute(:id, value)
|
287
|
+
end
|
288
|
+
alias :find :find_by_id
|
289
|
+
end
|
290
|
+
|
291
|
+
# Returns collection of all YamlRecord instances
|
292
|
+
# Caches results during request
|
293
|
+
#
|
294
|
+
# === Example:
|
295
|
+
#
|
296
|
+
# Post.all => [@post1, @post2, ...]
|
297
|
+
# Post.all(true) => (...force reload...)
|
298
|
+
#
|
299
|
+
def self.all
|
300
|
+
raw_items = self.adapter.read(self.source) || []
|
301
|
+
raw_items.map { |item| self.new(item.merge(:persisted => true)) }
|
302
|
+
end
|
303
|
+
|
304
|
+
# Find last YamlRecord instance given a limit
|
305
|
+
# Returns an array of instances if found; empty otherwise
|
306
|
+
#
|
307
|
+
# === Example:
|
308
|
+
#
|
309
|
+
# Post.last => @post6
|
310
|
+
# Post.last(3) => [@p4, @p5, @p6]
|
311
|
+
#
|
312
|
+
def self.last(limit=1)
|
313
|
+
limit == 1 ? self.all.last : self.all.last(limit)
|
314
|
+
end
|
315
|
+
|
316
|
+
# Find first YamlRecord instance given a limit
|
317
|
+
# Returns an array of instances if found; empty otherwise
|
318
|
+
#
|
319
|
+
# === Example:
|
320
|
+
#
|
321
|
+
# Post.first => @post
|
322
|
+
# Post.first(3) => [@p1, @p2, @p3]
|
323
|
+
#
|
324
|
+
def self.first(limit=1)
|
325
|
+
limit == 1 ? self.all.first : self.all.first(limit)
|
326
|
+
end
|
327
|
+
|
328
|
+
# Initializes YamlRecord instance given an attribute hash and saves afterwards
|
329
|
+
# Returns instance if successfully saved; false otherwise
|
330
|
+
#
|
331
|
+
# === Example:
|
332
|
+
#
|
333
|
+
# Post.create(:foo => "bar", :miso => "great") => @post
|
334
|
+
#
|
335
|
+
def self.create(attributes={})
|
336
|
+
@fs = self.new(attributes)
|
337
|
+
if @fs.save == true
|
338
|
+
@fs.is_created = true
|
339
|
+
@fs
|
340
|
+
else
|
341
|
+
false
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
# Declares persisted attributes for YamlRecord class
|
346
|
+
#
|
347
|
+
# === Example:
|
348
|
+
#
|
349
|
+
# class Post < YamlRecord::Base; properties :foo, :miso; end
|
350
|
+
# Post.create(:foo => "bar", :miso => "great") => @post
|
351
|
+
#
|
352
|
+
def self.properties(*names)
|
353
|
+
@_properties ||= []
|
354
|
+
if names.size == 0 # getter
|
355
|
+
@_properties
|
356
|
+
elsif names.size > 0 # setter
|
357
|
+
names = names | [:id]
|
358
|
+
setup_properties!(*names)
|
359
|
+
@_properties += names
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
# Declares or retrieves adapter for Yaml storage
|
364
|
+
# Returns an instance of an adapter
|
365
|
+
#
|
366
|
+
# === Example:
|
367
|
+
#
|
368
|
+
# class Post < YamlRecord::Base
|
369
|
+
# adapter :redis, @redis # => YamlRecord::Adapters::RedisAdapter
|
370
|
+
# end
|
371
|
+
#
|
372
|
+
def self.adapter(kind=nil, *options)
|
373
|
+
kind.nil? ? @_adapter_kind ||= :local : @_adapter_kind = kind
|
374
|
+
@_adapter ||= eval("YamlRecord::Adapters::#{@_adapter_kind.to_s.capitalize}Store").new(*options)
|
375
|
+
end
|
376
|
+
|
377
|
+
# Declares source file for YamlRecord class
|
378
|
+
#
|
379
|
+
# === Example:
|
380
|
+
#
|
381
|
+
# class Post < YamlRecord::Base
|
382
|
+
# source "path/to/yaml/file"
|
383
|
+
# end
|
384
|
+
#
|
385
|
+
def self.source(file=nil)
|
386
|
+
file ? @file = (file.to_s) : @file
|
387
|
+
end
|
388
|
+
|
389
|
+
# Overrides equality to match if matching ids
|
390
|
+
#
|
391
|
+
def ==(comparison_record)
|
392
|
+
self.id == comparison_record.id
|
393
|
+
end
|
394
|
+
|
395
|
+
protected
|
396
|
+
|
397
|
+
# Validates each persisted attributes
|
398
|
+
# TODO Implement validation
|
399
|
+
#
|
400
|
+
def self.validates_each(*args, &block)
|
401
|
+
true
|
402
|
+
end
|
403
|
+
|
404
|
+
# Write raw yaml data to file
|
405
|
+
# Protected method, not called during usage
|
406
|
+
#
|
407
|
+
# === Example:
|
408
|
+
#
|
409
|
+
# Post.write_content([{ :foo => "bar"}, { :foo => "baz"}, ...]) # writes to source file
|
410
|
+
#
|
411
|
+
def self.write_contents(raw_data)
|
412
|
+
self.adapter.write(self.source, raw_data)
|
413
|
+
@records = nil
|
414
|
+
end
|
415
|
+
|
416
|
+
# Creates reader and writer methods for each persisted attribute
|
417
|
+
# Protected method, not called during usage
|
418
|
+
#
|
419
|
+
# === Example:
|
420
|
+
#
|
421
|
+
# Post.setup_properties!(:foo)
|
422
|
+
# @post.foo = "baz"
|
423
|
+
# @post.foo => "baz"
|
424
|
+
#
|
425
|
+
def self.setup_properties!(*names)
|
426
|
+
names.each do |name|
|
427
|
+
define_method(name) { self[name.to_sym] }
|
428
|
+
define_method("#{name}=") { |val| self[name.to_sym] = val }
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
# Assign YamlRecord a unique id if not set
|
433
|
+
# Invoke before create of an instance
|
434
|
+
# Protected method, not called during usage
|
435
|
+
#
|
436
|
+
def set_id!
|
437
|
+
self.id = SecureRandom.hex(15)
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
data/lib/ruby_home.rb
CHANGED
@@ -1,7 +1,46 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
require 'bindata'
|
2
|
+
require 'dnssd'
|
3
|
+
require 'hkdf'
|
4
|
+
require 'oj'
|
5
|
+
require 'rack'
|
6
|
+
require 'rbnacl/libsodium'
|
7
|
+
require 'request_store'
|
8
|
+
require 'ruby_home-srp'
|
9
|
+
require 'sinatra/base'
|
10
|
+
require 'webrick'
|
11
|
+
require 'wisper'
|
6
12
|
|
7
|
-
module RubyHome
|
13
|
+
module RubyHome
|
14
|
+
Dir[File.dirname(__FILE__) + '/ruby_home/**/*.rb'].each { |file| require file }
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def run
|
18
|
+
trap 'INT' do shutdown end
|
19
|
+
trap 'TERM' do shutdown end
|
20
|
+
|
21
|
+
start
|
22
|
+
end
|
23
|
+
|
24
|
+
def start
|
25
|
+
threads << Thread.start { dns_service.register }
|
26
|
+
threads << Thread.start { http_server.run }
|
27
|
+
threads.each(&:join)
|
28
|
+
end
|
29
|
+
|
30
|
+
def threads
|
31
|
+
@@threads ||= []
|
32
|
+
end
|
33
|
+
|
34
|
+
def shutdown
|
35
|
+
threads.each(&:exit)
|
36
|
+
end
|
37
|
+
|
38
|
+
def dns_service
|
39
|
+
@_dns_service ||= RubyHome::DNS::Service.new(http_server.port)
|
40
|
+
end
|
41
|
+
|
42
|
+
def http_server
|
43
|
+
@_http_server ||= RubyHome::HTTP::Application.new
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/rubyhome.gemspec
CHANGED
@@ -24,21 +24,21 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
25
|
spec.require_paths = ['lib']
|
26
26
|
|
27
|
+
spec.add_dependency 'activesupport', '~> 5.0'
|
27
28
|
spec.add_dependency 'bindata', '~> 2.4', '>= 2.4.3'
|
28
29
|
spec.add_dependency 'dnssd', '~> 3.0'
|
29
|
-
spec.add_dependency 'ed25519', '~> 1.2', '>= 1.2.3'
|
30
30
|
spec.add_dependency 'hkdf', '~> 0.3.0'
|
31
31
|
spec.add_dependency 'oj', '~> 3.4'
|
32
32
|
spec.add_dependency 'rbnacl', '~> 5.0'
|
33
33
|
spec.add_dependency 'rbnacl-libsodium', '~> 1.0', '>= 1.0.16'
|
34
|
+
spec.add_dependency 'request_store', '~> 1.4', '>= 1.4.1'
|
34
35
|
spec.add_dependency 'ruby_home-srp', '~> 1.2'
|
35
|
-
spec.add_dependency 'sinatra', '2.0.
|
36
|
+
spec.add_dependency 'sinatra', '2.0.3'
|
36
37
|
spec.add_dependency 'wisper', '~> 1.6', '>= 1.6.1'
|
37
|
-
spec.add_dependency 'x25519', '~> 1.0', '>= 1.0.5'
|
38
38
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
39
39
|
spec.add_development_dependency 'byebug', '~> 10.0'
|
40
40
|
spec.add_development_dependency 'plist', '~> 3.4'
|
41
|
-
spec.add_development_dependency 'rack-test', '~> 1.
|
41
|
+
spec.add_development_dependency 'rack-test', '~> 1.1.0'
|
42
42
|
spec.add_development_dependency 'rake', '~> 12.3'
|
43
43
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
44
44
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_home
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Entwistle
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bindata
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,26 +58,6 @@ dependencies:
|
|
44
58
|
- - "~>"
|
45
59
|
- !ruby/object:Gem::Version
|
46
60
|
version: '3.0'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: ed25519
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - "~>"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '1.2'
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 1.2.3
|
57
|
-
type: :runtime
|
58
|
-
prerelease: false
|
59
|
-
version_requirements: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - "~>"
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '1.2'
|
64
|
-
- - ">="
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 1.2.3
|
67
61
|
- !ruby/object:Gem::Dependency
|
68
62
|
name: hkdf
|
69
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,6 +120,26 @@ dependencies:
|
|
126
120
|
- - ">="
|
127
121
|
- !ruby/object:Gem::Version
|
128
122
|
version: 1.0.16
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: request_store
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '1.4'
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 1.4.1
|
133
|
+
type: :runtime
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '1.4'
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 1.4.1
|
129
143
|
- !ruby/object:Gem::Dependency
|
130
144
|
name: ruby_home-srp
|
131
145
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,14 +160,14 @@ dependencies:
|
|
146
160
|
requirements:
|
147
161
|
- - '='
|
148
162
|
- !ruby/object:Gem::Version
|
149
|
-
version: 2.0.
|
163
|
+
version: 2.0.3
|
150
164
|
type: :runtime
|
151
165
|
prerelease: false
|
152
166
|
version_requirements: !ruby/object:Gem::Requirement
|
153
167
|
requirements:
|
154
168
|
- - '='
|
155
169
|
- !ruby/object:Gem::Version
|
156
|
-
version: 2.0.
|
170
|
+
version: 2.0.3
|
157
171
|
- !ruby/object:Gem::Dependency
|
158
172
|
name: wisper
|
159
173
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,26 +188,6 @@ dependencies:
|
|
174
188
|
- - ">="
|
175
189
|
- !ruby/object:Gem::Version
|
176
190
|
version: 1.6.1
|
177
|
-
- !ruby/object:Gem::Dependency
|
178
|
-
name: x25519
|
179
|
-
requirement: !ruby/object:Gem::Requirement
|
180
|
-
requirements:
|
181
|
-
- - "~>"
|
182
|
-
- !ruby/object:Gem::Version
|
183
|
-
version: '1.0'
|
184
|
-
- - ">="
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
version: 1.0.5
|
187
|
-
type: :runtime
|
188
|
-
prerelease: false
|
189
|
-
version_requirements: !ruby/object:Gem::Requirement
|
190
|
-
requirements:
|
191
|
-
- - "~>"
|
192
|
-
- !ruby/object:Gem::Version
|
193
|
-
version: '1.0'
|
194
|
-
- - ">="
|
195
|
-
- !ruby/object:Gem::Version
|
196
|
-
version: 1.0.5
|
197
191
|
- !ruby/object:Gem::Dependency
|
198
192
|
name: bundler
|
199
193
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,14 +236,14 @@ dependencies:
|
|
242
236
|
requirements:
|
243
237
|
- - "~>"
|
244
238
|
- !ruby/object:Gem::Version
|
245
|
-
version: 1.
|
239
|
+
version: 1.1.0
|
246
240
|
type: :development
|
247
241
|
prerelease: false
|
248
242
|
version_requirements: !ruby/object:Gem::Requirement
|
249
243
|
requirements:
|
250
244
|
- - "~>"
|
251
245
|
- !ruby/object:Gem::Version
|
252
|
-
version: 1.
|
246
|
+
version: 1.1.0
|
253
247
|
- !ruby/object:Gem::Dependency
|
254
248
|
name: rake
|
255
249
|
requirement: !ruby/object:Gem::Requirement
|
@@ -303,7 +297,6 @@ files:
|
|
303
297
|
- bin/setup
|
304
298
|
- lib/ruby_home.rb
|
305
299
|
- lib/ruby_home/accessory_info.rb
|
306
|
-
- lib/ruby_home/broadcast.rb
|
307
300
|
- lib/ruby_home/config/characteristics.yml
|
308
301
|
- lib/ruby_home/config/services.yml
|
309
302
|
- lib/ruby_home/device_id.rb
|
@@ -317,13 +310,12 @@ files:
|
|
317
310
|
- lib/ruby_home/hap/characteristic.rb
|
318
311
|
- lib/ruby_home/hap/crypto/chacha20poly1305.rb
|
319
312
|
- lib/ruby_home/hap/crypto/hkdf.rb
|
320
|
-
- lib/ruby_home/hap/hex_pad.rb
|
321
313
|
- lib/ruby_home/hap/http_decryption.rb
|
322
314
|
- lib/ruby_home/hap/http_encryption.rb
|
323
315
|
- lib/ruby_home/hap/service.rb
|
324
316
|
- lib/ruby_home/hap/tlv.rb
|
317
|
+
- lib/ruby_home/hex_helper.rb
|
325
318
|
- lib/ruby_home/http/application.rb
|
326
|
-
- lib/ruby_home/http/cache.rb
|
327
319
|
- lib/ruby_home/http/controllers/accessories_controller.rb
|
328
320
|
- lib/ruby_home/http/controllers/application_controller.rb
|
329
321
|
- lib/ruby_home/http/controllers/characteristics_controller.rb
|
@@ -338,9 +330,12 @@ files:
|
|
338
330
|
- lib/ruby_home/http/serializers/characteristic_value_serializer.rb
|
339
331
|
- lib/ruby_home/http/serializers/object_serializer.rb
|
340
332
|
- lib/ruby_home/http/serializers/service_serializer.rb
|
333
|
+
- lib/ruby_home/http/services/start_srp_service.rb
|
334
|
+
- lib/ruby_home/http/services/verify_srp_service.rb
|
341
335
|
- lib/ruby_home/identifier_cache.rb
|
342
336
|
- lib/ruby_home/rack/handler/hap_server.rb
|
343
337
|
- lib/ruby_home/version.rb
|
338
|
+
- lib/ruby_home/yaml_record.rb
|
344
339
|
- rubyhome.gemspec
|
345
340
|
- sbin/characteristic_generator.rb
|
346
341
|
- sbin/service_generator.rb
|