lib/filestack/models/filestack_security.rb in filestack-2.3.0 vs lib/filestack/models/filestack_security.rb in filestack-2.4.0
- old
+ new
@@ -41,11 +41,11 @@
# Generate the security policy and signature given a string and options
#
# @param [String] secret Your filestack security secret
# @param [Hash] options Hash of options - see constructor
def generate(secret, options)
- policy_json = create_policy_string(options)
+ policy_json = create_policy_string(Filestack::Hash.symbolize_keys(options))
@policy = Base64.urlsafe_encode64(policy_json)
@signature = OpenSSL::HMAC.hexdigest('sha256', secret, policy)
end
# Sign the URL by appending policy and signature URL parameters
@@ -60,9 +60,10 @@
private
#
# Manage options and convert hash to json string
#
+
def create_policy_string(options)
options[:expiry] = expiry_timestamp(options)
options.to_json
end