caren-api 0.9.2 → 0.9.3
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.
- data/VERSION +1 -1
- data/caren-api.gemspec +1 -1
- data/lib/caren/caren.rb +7 -4
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.3
|
data/caren-api.gemspec
CHANGED
data/lib/caren/caren.rb
CHANGED
@@ -192,8 +192,12 @@ module Caren
|
|
192
192
|
# Verify the signature using the caren public key
|
193
193
|
def verify_signature signature, timestamp, path, string=nil, public_key=self.caren_public_key
|
194
194
|
return false unless public_key
|
195
|
-
signature
|
196
|
-
|
195
|
+
verify_string(signature, "#{path}#{string}#{timestamp}", public_key)
|
196
|
+
end
|
197
|
+
|
198
|
+
def verify_string provided_string, expected_string, public_key=self.caren_public_key
|
199
|
+
provided_string = Base64.decode64(CGI.unescape(provided_string.to_s))
|
200
|
+
DIGEST_ALGORITHMS.map{ |algorithm| public_key.verify( algorithm, provided_string, expected_string.strip ) }.any?
|
197
201
|
end
|
198
202
|
|
199
203
|
def create_photo_signature url_shortcut, external_or_caren_id, private_key=self.private_key
|
@@ -204,8 +208,7 @@ module Caren
|
|
204
208
|
# Verify photo url signature using the caren public key
|
205
209
|
def verify_photo_signature signature, url_shortcut, external_id, public_key=self.caren_public_key
|
206
210
|
return false unless public_key
|
207
|
-
signature
|
208
|
-
DIGEST_ALGORITHMS.map{ |algorithm| public_key.verify( algorithm, signature, url_shortcut.to_s + external_id.to_s ) }.any?
|
211
|
+
verify_string(signature, url_shortcut.to_s + external_id.to_s, public_key)
|
209
212
|
end
|
210
213
|
|
211
214
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caren-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -269,7 +269,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
269
269
|
version: '0'
|
270
270
|
segments:
|
271
271
|
- 0
|
272
|
-
hash:
|
272
|
+
hash: 2880785186653608564
|
273
273
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
274
274
|
none: false
|
275
275
|
requirements:
|