Class: Hahamut::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/hahamut/signature.rb

Overview

Signature Verifier

Instance Method Summary collapse

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

Returns:

  • (Boolean)


11
12
13
# File 'lib/hahamut/signature.rb', line 11

def match?(verify_signature)
  signature == verify_signature
end

#signatureObject



15
16
17
# File 'lib/hahamut/signature.rb', line 15

def signature
  "sha1=#{OpenSSL::HMAC.hexdigest('SHA1', @secret, @body)}"
end