Sha256: 9833fecd7d83f82898629782a89ddd712900577ff994084a39a8c72af3d3d7e4
Contents?: true
Size: 1.04 KB
Versions: 7
Compression:
Stored size: 1.04 KB
Contents
require 'adyen/signature' module Adyen module REST # The Signature module can sign and verify HMAC SHA-256 signatures for API module Signature extend self # Sign the parameters with the given shared secret # @param [Hash] params The set of parameters to sign. Should sent `sharedSecret` to sign. # @return [String] signature from parameters def sign(params) Adyen::Signature.sign(params, :rest) end # Verify the parameters with the given shared secret # @param [Hash] params The set of parameters to verify. # Should include `sharedSecret` param to sign and the `hmacSignature` param to compare with the signature calculated # @return [Boolean] true if the `hmacSignature` in the params matches our calculated signature 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 end end end
Version data entries
7 entries across 7 versions & 2 rubygems