Class: Hahamut::Signature
- Inherits:
-
Object
- Object
- Hahamut::Signature
- Defined in:
- lib/hahamut/signature.rb
Overview
Signature Verifier
Instance Method Summary collapse
-
#initialize(secret, body) ⇒ Signature
constructor
A new instance of Signature.
- #match?(verify_signature) ⇒ Boolean
- #signature ⇒ Object
Constructor Details
#initialize(secret, body) ⇒ Signature
Returns a new instance of Signature.
6 7 8 9 |
# File 'lib/hahamut/signature.rb', line 6 def initialize(secret, body) @secret = secret @body = body end |
Instance Method Details
#match?(verify_signature) ⇒ Boolean
11 12 13 |
# File 'lib/hahamut/signature.rb', line 11 def match?(verify_signature) signature == verify_signature end |
#signature ⇒ Object
15 16 17 |
# File 'lib/hahamut/signature.rb', line 15 def signature "sha1=#{OpenSSL::HMAC.hexdigest('SHA1', @secret, @body)}" end |