Module: Adyen::REST::Signature
Overview
The Signature module can sign and verify HMAC SHA-256 signatures for API
Instance Method Summary collapse
-
#sign(params) ⇒ String
Sign the parameters with the given shared secret.
-
#verify(params) ⇒ Boolean
Verify the parameters with the given shared secret Should include ‘sharedSecret` param to sign and the `hmacSignature` param to compare with the signature calculated.
Instance Method Details
#sign(params) ⇒ String
Sign the parameters with the given shared secret
12 13 14 |
# File 'lib/adyen/rest/signature.rb', line 12 def sign(params) Adyen::Signature.sign(params, :rest) end |
#verify(params) ⇒ Boolean
Verify the parameters with the given shared secret Should include ‘sharedSecret` param to sign and the `hmacSignature` param to compare with the signature calculated
20 21 22 23 24 |
# File 'lib/adyen/rest/signature.rb', line 20 def verify(params) their_sig = params.delete('hmacSignature') raise ArgumentError, "params must include 'hmacSignature' for verification" if their_sig.empty? Adyen::Signature.verify(params, their_sig, :rest) end |