Sha256: a61b716a5f9f7214b3396cabd9c845caf25109c4b2d116a32cf6853939e406bc

Contents?: true

Size: 349 Bytes

Versions: 3

Compression:

Stored size: 349 Bytes

Contents

# frozen_string_literal: true

module Hahamut
  # Signature Verifier
  class Signature
    def initialize(secret, body)
      @secret = secret
      @body = body
    end

    def match?(verify_signature)
      signature == verify_signature
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hahamut-0.1.2 lib/hahamut/signature.rb
hahamut-0.1.1 lib/hahamut/signature.rb
hahamut-0.1.0 lib/hahamut/signature.rb