Module: WxExt::Api::Msg

Extended by:
Msg
Included in:
Msg
Defined in:
lib/wx_ext/api/qrcode.rb

Overview

User api of weixin.

Author:

  • FuShengYang

Instance Method Summary collapse

Instance Method Details

#check_signature(signature, timestamp, nonce, token) ⇒ Boolean

Check the signature before send msg.

Returns:

  • (Boolean)

    Check the signature true or false.



17
18
19
20
# File 'lib/wx_ext/api/qrcode.rb', line 17

def check_signature(signature, timestamp, nonce, token)
  array = [token, timestamp, nonce].sort
  signature == Digest::SHA1.hexdigest(array.join) ? true : false
end