Class: Vonage::Signature
- Inherits:
-
Object
- Object
- Vonage::Signature
- Defined in:
- lib/vonage/signature.rb
Instance Method Summary collapse
-
#check(params, signature_secret: @config.signature_secret, signature_method: @config.signature_method) ⇒ Object
Check webhook request signature.
-
#initialize(config) ⇒ Signature
constructor
A new instance of Signature.
Constructor Details
#initialize(config) ⇒ Signature
Returns a new instance of Signature.
9 10 11 |
# File 'lib/vonage/signature.rb', line 9 def initialize(config) @config = config end |
Instance Method Details
#check(params, signature_secret: @config.signature_secret, signature_method: @config.signature_method) ⇒ Object
Check webhook request signature.
30 31 32 33 34 35 36 |
# File 'lib/vonage/signature.rb', line 30 def check(params, signature_secret: @config.signature_secret, signature_method: @config.signature_method) params = params.dup signature = params.delete('sig') ::JWT::JWA::Hmac::SecurityUtils.secure_compare(signature, digest(params, signature_secret, signature_method)) end |