Skip to content

Commit 47a2d7c

Browse files
authored
auth parameter generation bug fix for when called without expire and token
1 parent bc79f2d commit 47a2d7c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/imagekitio/sdk/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module ImageKitIo
22
module Sdk
3-
VERSION = '2.2.1'
3+
VERSION = '2.2.2'
44
end
55
end

lib/imagekitio/utils/calculation.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def get_authenticated_params(token, expire, private_key)
2727
# return authenticated param
2828
default_expire = DateTime.now.strftime("%s").to_i + DEFAULT_TIME_DIFF
2929
token ||= SecureRandom.uuid
30+
expire ||= default_expire
3031

3132
auth_params = {'token': token, 'expire': expire, 'signature': ""}
3233
unless private_key
@@ -35,7 +36,7 @@ def get_authenticated_params(token, expire, private_key)
3536

3637
signature = OpenSSL::HMAC.hexdigest("SHA1", private_key, token.to_s + expire.to_s)
3738
auth_params[:token] = token
38-
auth_params[:expire] = expire || default_expire
39+
auth_params[:expire] = expire
3940
auth_params[:signature] = signature
4041
auth_params
4142
end

0 commit comments

Comments
 (0)