Class: Uploadcare::Param::Upload::SignatureGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/uploadcare/param/upload/signature_generator.rb

Overview

This class generates signatures for protected uploads

Class Method Summary collapse

Class Method Details

.callHash

Returns signature and its expiration time.

Returns:

  • (Hash)

    signature and its expiration time

See Also:



12
13
14
15
16
17
18
19
20
# File 'lib/uploadcare/param/upload/signature_generator.rb', line 12

def self.call
  expires_at = Time.now.to_i + Uploadcare.config.upload_signature_lifetime
  to_sign = Uploadcare.config.secret_key + expires_at.to_s
  signature = Digest::MD5.hexdigest(to_sign)
  {
    signature: signature,
    expire: expires_at
  }
end