module SigVerify
Public Instance Methods
sig_gen(time_str,nonce,token)
click to toggle source
# File lib/lanxin_open/sig_verify.rb, line 11 def sig_gen(time_str,nonce,token) plain = [token,time_str,nonce].sort().join() sig = Digest::SHA1.hexdigest(plain) end
sig_verify(time_str,nonce,token,signature)
click to toggle source
# File lib/lanxin_open/sig_verify.rb, line 3 def sig_verify(time_str,nonce,token,signature) time = time_str.to_i time = time / 1000 if time_str.length >= 13 return false if (Time.now - Time.at(time)) > 120 signature == sig_gen(time_str,nonce,token) end