Class: Hawk::Crypto::TSMac
- Inherits:
-
Base
- Object
- Base
- Hawk::Crypto::TSMac
show all
- Defined in:
- lib/hawk/crypto.rb
Instance Method Summary
collapse
Methods inherited from Base
#==, #encode64, #eql?, #to_s
Constructor Details
#initialize(key, ts, algorithm = 'sha256') ⇒ TSMac
Returns a new instance of TSMac.
131
132
133
|
# File 'lib/hawk/crypto.rb', line 131
def initialize(key, ts, algorithm = 'sha256')
@key, @ts, @algorithm = key, ts, algorithm
end
|
Instance Method Details
#digest ⇒ Object
139
140
141
|
# File 'lib/hawk/crypto.rb', line 139
def digest
@digest ||= OpenSSL::HMAC.digest(openssl_digest(@algorithm).new, @key, normalized_string)
end
|
#normalized_string ⇒ Object
135
136
137
|
# File 'lib/hawk/crypto.rb', line 135
def normalized_string
@normalized_string ||= "hawk.1.ts\n#{@ts}\n"
end
|