Module: WyWecall::Api::Sign
- Included in:
- Client
- Defined in:
- lib/wy_wecall/api/sign.rb
Instance Method Summary collapse
Instance Method Details
#build_body_signature(body, timestamp) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/wy_wecall/api/sign.rb', line 15 def build_body_signature(body, ) log_debug("Wecall signature body: #{body}, timestamp: #{timestamp}") = "#{timestamp}#{body.to_json}" log_debug("Wecall signature message: #{message}, algorithm: #{algorithm}, app_secret: #{app_secret}") signature = OpenSSL::HMAC.hexdigest(algorithm, app_secret, ) log_debug("Wecall signature result: #{signature}") signature end |
#build_signature(params, timestamp) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/wy_wecall/api/sign.rb', line 6 def build_signature(params, ) log_debug("Wecall signature params: #{params}, timestamp: #{timestamp}") = "#{timestamp}#{params.sort.to_h.values.compact.join}" log_debug("Wecall signature message: #{message}, algorithm: #{algorithm}, app_secret: #{app_secret}") signature = OpenSSL::HMAC.hexdigest(algorithm, app_secret, ) log_debug("Wecall signature result: #{signature}") signature end |