WechatPay v0.7.0 WechatPay.Utils.Signature View Source

Module to sign data

Link to this section Summary

Functions

Generate the signature of data with API key

Verify the signature of Wechat’s response

Link to this section Functions

Link to this function sign(data, apikey) View Source
sign(map(), String.t()) :: String.t()

Generate the signature of data with API key

Example

iex> WechatPay.Utils.Signature.sign(%{...}, "wx9999")
...> "02696FC7E3E19F852A0335F2F007DD3E"
Link to this function verify(data, apikey) View Source
verify(map(), String.t()) :: :ok | {:error, WechatPay.Error.t()}

Verify the signature of Wechat’s response

Example

iex > WechatPay.Utils.Signature.verify(%{sign: "foobar"}, "wx9999")
... > :ok