keen 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 59fa0dd54e4200a1adfae054d2720f25a5153113
4
- data.tar.gz: 1700087db79e25937d840ee0de8b7a57d3769db5
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MmM2M2JiNDY0NWU3NDBkYTI4N2QzNDEwNzYwNjkyMmZkYzI5NjQ2Yw==
5
+ data.tar.gz: !binary |-
6
+ MGY5ZTNiZWUwNGY4ZTE2Y2JmZTdiNGU4MjdiMDBlOTU5NmI2NWFiYw==
5
7
  SHA512:
6
- metadata.gz: 3c8f0064da21debd51c315b2319f7f95e9e2bc10510f9c02bc38b53efb017229dea11dad6b73472d0e74fafd283bb450cad5b11e3619e9f79c587be9b6fccb41
7
- data.tar.gz: 957775acf03e4e4d4bcea48bd889492cb813d4c629f4f4e29ba722acee5787a1fafd381ccc73e706ac04faa68a077da7d7be6e9ec0a3d31a8c526cd14666799a
8
+ metadata.gz: !binary |-
9
+ Y2UwMzI3NjRjMDgyMWJlNjI2M2JiMTZkOWQyM2RjYmEyYTAzYjkzMDk2N2Q2
10
+ ZWJlZTc0NTA1YzUzNGIwOTg0MWQ5NGMwNWQyMTQxODQxZDM4OTRhNWIyN2I4
11
+ MDBmNWRhYWMzODE3ZGU2NDQxMDY3Mjk1MTJmZTEyNTg1ZmNlNGM=
12
+ data.tar.gz: !binary |-
13
+ M2I3MDNlZTQzYTY0OWJiMjAzZTA4M2FmMjUxOTBjNmZiYzY2YWM3NjczYzE1
14
+ MWI5NDlmMzA2ZDNhNTA3NWU1NDIxOGRiM2NhY2Y4NGY3NWZjZWY0MDMwZTc5
15
+ NjExYzkyZmZjYzI3YWFjMmU2MWFmMTc4OTYwMjFhYTI3YzMxNjE=
@@ -5,7 +5,7 @@ rvm:
5
5
  - 1.9.3
6
6
  - 2.0.0
7
7
  - 2.2.2
8
- - jruby-19mode
8
+ - 2.4.0
9
9
 
10
10
  env:
11
11
  - PATTERN=keen
@@ -18,10 +18,5 @@ before_install:
18
18
  - gem update --system
19
19
  - gem --version
20
20
 
21
- matrix:
22
- exclude:
23
- - rvm: jruby-19mode
24
- env: PATTERN=synchrony
25
-
26
21
  script:
27
22
  - bundle exec rake pattern
@@ -20,19 +20,19 @@ Gem::Specification.new do |s|
20
20
 
21
21
  # guard
22
22
  unless RUBY_VERSION.start_with? '1.8'
23
- s.add_development_dependency 'guard'
24
- s.add_development_dependency 'guard-rspec'
23
+ s.add_development_dependency 'guard', '~> 2.14'
24
+ s.add_development_dependency 'guard-rspec', '~> 4.7'
25
25
 
26
26
  # guard cross-platform listener trick
27
- s.add_development_dependency 'rb-inotify'
28
- s.add_development_dependency 'rb-fsevent'
29
- s.add_development_dependency 'rb-fchange'
27
+ s.add_development_dependency 'rb-inotify', '~> 0.9'
28
+ s.add_development_dependency 'rb-fsevent', '~> 0.9'
29
+ s.add_development_dependency 'rb-fchange', '~> 0.0.6'
30
30
 
31
31
  # guard notifications
32
- s.add_development_dependency 'ruby_gntp'
32
+ s.add_development_dependency 'ruby_gntp', '~> 0.3'
33
33
 
34
34
  # fix guard prompt
35
- s.add_development_dependency 'rb-readline' # or compile ruby w/ readline
35
+ s.add_development_dependency 'rb-readline', '~> 0.5' # or compile ruby w/ readline
36
36
  end
37
37
 
38
38
  # debuggers
@@ -17,6 +17,7 @@ module Keen
17
17
  end
18
18
 
19
19
  def aes256_encrypt(key, plaintext, iv = nil)
20
+ raise OpenSSL::Cipher::CipherError.new("iv must be 16 bytes") if !iv.nil? && iv.length != 16
20
21
  aes = OpenSSL::Cipher::AES.new(256, :CBC)
21
22
  aes.encrypt
22
23
  aes.key = unhexlify(key)
@@ -21,6 +21,7 @@ module Keen
21
21
  end
22
22
 
23
23
  def aes256_encrypt(key, plaintext, iv = nil)
24
+ raise OpenSSL::Cipher::CipherError.new("iv must be 16 bytes") if !iv.nil? && iv.length != 16
24
25
  padded_key = pad(key)
25
26
  aes = OpenSSL::Cipher::AES.new(256, :CBC)
26
27
  aes.encrypt
@@ -40,11 +41,15 @@ module Keen
40
41
  end
41
42
 
42
43
  def pad(msg)
43
- pad_len = BLOCK_SIZE - (msg.length % BLOCK_SIZE)
44
+ missing_chars = msg.length % BLOCK_SIZE
45
+ return msg if missing_chars == 0
46
+
47
+ pad_len = BLOCK_SIZE - missing_chars
48
+
44
49
  padding = pad_len.chr * pad_len
45
50
  padded = msg + padding
46
51
  padded
47
52
  end
48
53
  end
49
54
  end
50
- end
55
+ end
@@ -1,3 +1,3 @@
1
1
  module Keen
2
- VERSION = "0.9.7"
2
+ VERSION = "0.9.8"
3
3
  end
@@ -59,7 +59,7 @@ describe Keen::Client do
59
59
  end
60
60
 
61
61
  it "should return empty for bad json on a 200/201" do
62
- process_response.call(200, "invalid json").should == {}
62
+ expect(process_response.call(200, "invalid json")).to eq({})
63
63
  end
64
64
 
65
65
  it "should raise a bad request error for a 400" do
@@ -37,7 +37,7 @@ describe Keen::ScopedKey do
37
37
 
38
38
  describe "when an IV is provided" do
39
39
  it "should produce the same encrypted key text for a " do
40
- iv = "\0" * 32
40
+ iv = "\0" * 16
41
41
  new_scoped_key.encrypt!(iv).should == (new_scoped_key.encrypt!(iv))
42
42
  end
43
43
 
@@ -53,5 +53,11 @@ describe Keen::ScopedKey do
53
53
  other_api_key = Keen::ScopedKey.decrypt!(bad_api_key, encrypted_str)
54
54
  }.to raise_error(OpenSSL::Cipher::CipherError)
55
55
  end
56
+
57
+ it "should properly encrypt with master keys that are 32 characters long" do
58
+ master_key = "\0" * 32
59
+ scoped_key = Keen::ScopedKey.new(master_key, data).encrypt!
60
+ Keen::ScopedKey.decrypt!(master_key, scoped_key).data.should == data
61
+ end
56
62
  end
57
63
  end
@@ -37,7 +37,7 @@ describe Keen::ScopedKey do
37
37
 
38
38
  describe "when an IV is provided" do
39
39
  it "should produce the same encrypted key text for a " do
40
- iv = "\0" * 32
40
+ iv = "\0" * 16
41
41
  new_scoped_key.encrypt!(iv).should == (new_scoped_key.encrypt!(iv))
42
42
  end
43
43
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Kleissner
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-02-22 00:00:00.000000000 Z
12
+ date: 2017-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -43,98 +43,112 @@ dependencies:
43
43
  name: guard
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ~>
47
47
  - !ruby/object:Gem::Version
48
- version: '0'
48
+ version: '2.14'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
55
+ version: '2.14'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: guard-rspec
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ~>
61
61
  - !ruby/object:Gem::Version
62
- version: '0'
62
+ version: '4.7'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: '4.7'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rb-inotify
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ~>
75
75
  - !ruby/object:Gem::Version
76
- version: '0'
76
+ version: '0.9'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ~>
82
82
  - !ruby/object:Gem::Version
83
- version: '0'
83
+ version: '0.9'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rb-fsevent
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ~>
89
89
  - !ruby/object:Gem::Version
90
- version: '0'
90
+ version: '0.9'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ~>
96
96
  - !ruby/object:Gem::Version
97
- version: '0'
97
+ version: '0.9'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rb-fchange
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - '>='
102
+ - - ~>
103
103
  - !ruby/object:Gem::Version
104
- version: '0'
104
+ version: 0.0.6
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - '>='
109
+ - - ~>
110
110
  - !ruby/object:Gem::Version
111
- version: '0'
111
+ version: 0.0.6
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: ruby_gntp
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ~>
117
117
  - !ruby/object:Gem::Version
118
- version: '0'
118
+ version: '0.3'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - '>='
123
+ - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: '0'
125
+ version: '0.3'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rb-readline
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '>='
130
+ - - ~>
131
+ - !ruby/object:Gem::Version
132
+ version: '0.5'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ~>
138
+ - !ruby/object:Gem::Version
139
+ version: '0.5'
140
+ - !ruby/object:Gem::Dependency
141
+ name: debugger
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ! '>='
131
145
  - !ruby/object:Gem::Version
132
146
  version: '0'
133
147
  type: :development
134
148
  prerelease: false
135
149
  version_requirements: !ruby/object:Gem::Requirement
136
150
  requirements:
137
- - - '>='
151
+ - - ! '>='
138
152
  - !ruby/object:Gem::Version
139
153
  version: '0'
140
154
  description: Send events and build analytics features into your Ruby applications.
@@ -189,17 +203,17 @@ require_paths:
189
203
  - lib
190
204
  required_ruby_version: !ruby/object:Gem::Requirement
191
205
  requirements:
192
- - - '>='
206
+ - - ! '>='
193
207
  - !ruby/object:Gem::Version
194
208
  version: '0'
195
209
  required_rubygems_version: !ruby/object:Gem::Requirement
196
210
  requirements:
197
- - - '>='
211
+ - - ! '>='
198
212
  - !ruby/object:Gem::Version
199
213
  version: '0'
200
214
  requirements: []
201
215
  rubyforge_project:
202
- rubygems_version: 2.0.14
216
+ rubygems_version: 2.6.8
203
217
  signing_key:
204
218
  specification_version: 4
205
219
  summary: Keen IO API Client
@@ -219,4 +233,3 @@ test_files:
219
233
  - spec/spec_helper.rb
220
234
  - spec/synchrony/spec_helper.rb
221
235
  - spec/synchrony/synchrony_spec.rb
222
- has_rdoc: