Module: Cryptomus::WebhookValidator

Defined in:
lib/cryptomus/webhook_validator.rb

Class Method Summary collapse

Class Method Details

.validate(payload:, sign:) ⇒ Boolean

Parameters:

  • payload (Hash)
  • sign (String)

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/cryptomus/webhook_validator.rb', line 13

def validate(payload:, sign:)
  payload_json = JSON.generate(payload)
  generated_sign = Cryptomus::Signature.generate(payload_json)
  generated_sign == sign
end