Sha256: e9a632fb22235951048233a6cff207b636969009099baf1a452bf70ca830b5aa

Contents?: true

Size: 431 Bytes

Versions: 4

Compression:

Stored size: 431 Bytes

Contents

# frozen_string_literal: true

require 'json'

module Cryptomus
  module WebhookValidator
    module_function

    # https://doc.cryptomus.com/payments/webhook
    # @param payload [Hash]
    # @param sign [String]
    # @return [Boolean]
    def validate(payload:, sign:)
      payload_json = JSON.generate(payload)
      generated_sign = Cryptomus::Signature.generate(payload_json)
      generated_sign == sign
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cryptomus-0.2.1 lib/cryptomus/webhook_validator.rb
cryptomus-0.2.0 lib/cryptomus/webhook_validator.rb
cryptomus-0.1.1 lib/cryptomus/webhook_validator.rb
cryptomus-0.1.0 lib/cryptomus/webhook_validator.rb