module Sinopac::FunBiz::Sign
Public Class Methods
sign(content:, nonce:, hash_id:)
click to toggle source
# File lib/sinopac/funbiz/sign.rb, line 13 def self.sign(content:, nonce:, hash_id:) Digest::SHA256.hexdigest("#{to_query(content: content)}#{nonce}#{hash_id}").upcase end
to_query(content:)
click to toggle source
# File lib/sinopac/funbiz/sign.rb, line 5 def self.to_query(content:) content.sort.map { |k, v| unless ([::Hash, ::Array].include?(v.class) || v == '') "#{k}=#{v}" end }.compact.join("&") end