config.filestack_rails.security = { 'expiry' => 4663446066, 'call' => %w[pick read stat write writeUrl store convert remove exif] }
[62, 71] in /home/taylor/code/ceremony/vendor/ruby/2.4.0/gems/filestack-2.1.0/lib/filestack/models/filestack_security.rb
62: #
63: # Manage options and convert hash to json string
64: #
65: def create_policy_string(options)
66: debugger
=> 67: options[:expiry] = expiry_timestamp(options)
68: options.to_json
69: end
70:
71: #
(byebug) options
{"expiry"=>1514764799, "call"=>["pick", "read", "stat", "write", "writeUrl", "store", "convert", "remove", "exif"]}
(byebug) n
[63, 72] in /home/taylor/code/ceremony/vendor/ruby/2.4.0/gems/filestack-2.1.0/lib/filestack/models/filestack_security.rb
63: # Manage options and convert hash to json string
64: #
65: def create_policy_string(options)
66: debugger
67: options[:expiry] = expiry_timestamp(options)
=> 68: options.to_json
69: end
70:
71: #
72: # Get expiration timestamp by adding seconds in option or using default
(byebug) options
{"expiry"=>1514764799, "call"=>["pick", "read", "stat", "write", "writeUrl", "store", "convert", "remove", "exif"], :expiry=>1509490768}
(byebug) n
[42, 51] in /home/taylor/code/ceremony/vendor/ruby/2.4.0/gems/filestack-2.1.0/lib/filestack/models/filestack_security.rb
42: #
43: # @param [String] secret Your filestack security secret
44: # @param [Hash] options Hash of options - see constructor
45: def generate(secret, options)
46: policy_json = create_policy_string(options)
=> 47: @policy = Base64.urlsafe_encode64(policy_json)
48: @signature = OpenSSL::HMAC.hexdigest('sha256', secret, policy)
49: end
50:
51: # Sign the URL by appending policy and signature URL parameters
(byebug) policy_json
"{\"expiry\":1509490768,\"call\":[\"pick\",\"read\",\"stat\",\"write\",\"writeUrl\",\"store\",\"convert\",\"remove\",\"exif\"]}"
(byebug)
All that said, I don't normally do pull requests or dig through gem source, so I'm not really sure what the process is for getting this change made in the filestack
gem and then getting filestack-rails
to accept the new version as a dependency - currently it requires 2.2.0
. I'll submit a pull request. If i've done anything incorrectly, sorry!