Sha256: 02b7d6464d6d270c515a80011edc3df0c93faeedde3f395cfbfc7ce76dc4c5b5
Contents?: true
Size: 586 Bytes
Versions: 3
Compression:
Stored size: 586 Bytes
Contents
# frozen_string_literal: true module BitsService module SignatureUtil def sign_signature(method, resource_path, key_secret, key_id) expires = seconds_since_the_unix_epoch_with_offset(3600) "#{resource_path}?" \ "signature=#{OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA256.new, key_secret, "#{method.upcase} #{resource_path} #{key_secret} #{expires}")}&" \ "expires=#{expires}&" \ "AccessKeyId=#{key_id}" end def seconds_since_the_unix_epoch_with_offset(offset) t = Time.now.utc + offset t.strftime('%s') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bits_service_client-4.0.0 | lib/util/signature_util.rb |
bits_service_client-4.0.0.pre.4 | lib/util/signature_util.rb |
bits_service_client-4.0.0.pre.3 | lib/util/signature_util.rb |