From f31b9072af098e55611223aab2d59559d7b4e97a Mon Sep 17 00:00:00 2001 From: Jeff Lai Date: Tue, 8 Mar 2016 11:56:52 +0800 Subject: [PATCH] Fix bug --- lib/dingtalk/client.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/dingtalk/client.rb b/lib/dingtalk/client.rb index 55bfb7a..133a6d0 100644 --- a/lib/dingtalk/client.rb +++ b/lib/dingtalk/client.rb @@ -9,11 +9,13 @@ module Dingtalk end def response_json(return_str) + the_timestamp = timestamp + the_nonce = nonce { - msg_signature: signature(return_str), + msg_signature: signature(return_str, the_timestamp, the_nonce), encrypt: encrypt(return_str), - timeStamp: timestamp, - nonce: nonce + timeStamp: the_timestamp, + nonce: the_nonce } end @@ -21,7 +23,7 @@ module Dingtalk encrypt = Dingtalk::Prpcrypt.encrypt(aes_key, return_str, Dingtalk.suite_key) end - def signature(return_str) + def signature(return_str, timestamp, nonce) sort_params = [Dingtalk.suite_token, timestamp, nonce, encrypt(return_str)].sort.join Digest::SHA1.hexdigest(sort_params) end -- libgit2 0.21.0