Sha256: daa9276140f1cdead6f2f7b58e2571f1d8ad6443e3f5a6160e8fb1cff2cbe816
Contents?: true
Size: 554 Bytes
Versions: 1
Compression:
Stored size: 554 Bytes
Contents
require 'digest' module SecretKey class SecretKey def initialize(key, secret, options={}) @key = key @secret = secret @options = options extract_options! end def token raise ArgumentError, 'Time Stamp is not a valid integer.' unless @timestamp.is_a? Integer Digest::SHA1.hexdigest("#{@key}:#{@secret}:#{@timestamp}") end def timestamp @timestamp ||= Time.now.to_i end private def extract_options! @timestamp = @options.fetch(:timestamp, timestamp) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
secretkey-1.1.0 | lib/secretkey.rb |