Documentation ¶
Index ¶
- func ApiSign(data map[string]string, priKey string) (error, string)
- func ApiVerifySign(data map[string]string, pubKey string, signStr string) error
- func CallbackServerGenResponseSign(resBody interface{}, priKey string) (resBodyWithSign interface{}, err error)
- func CallbackServerGenResponseSignOnly(resBodyData interface{}, priKey string) (sign string, err error)
- func CallbackServerVerifyRequestSign(reqBody interface{}, pubKey string) error
- func ParseJsonToClassMap(jsonStr string) (m map[string]string)
- func ParseObjectToClassMap(v interface{}) map[string]string
- func ShopClientGenPlatformRequestSign(reqBody interface{}, priKey string) (newReqBody interface{}, err error)
- func ShopClientVerifyPlatformResponseSign(resBody interface{}, pubKey string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApiSign ¶
ApiSign generate data sign
@param data api param data @param priKey rsa private key @return error @return string
func ApiVerifySign ¶
ApiVerifySign verify sign
@param data api response data @param pubKey public key @param signStr sign string @return error
func CallbackServerGenResponseSign ¶
func CallbackServerGenResponseSign(resBody interface{}, priKey string) (resBodyWithSign interface{}, err error)
CallbackServerGenResponseSign shop callback server generate sign for the response to the platform notify
@param resBody the http body response to te platform notify request, type can be []byte, string or struct. @param priKey rsa private key, generated by shop client. @return newResBody new response body with a sign field. if reqBody type is []byte, return newReqBody type is []byte. if reqBody type is string, return newReqBody type is string. if reqBody type is struct, return newReqBody type is map[string]interface{}.
func CallbackServerGenResponseSignOnly ¶
func CallbackServerGenResponseSignOnly(resBodyData interface{}, priKey string) (sign string, err error)
CallbackServerGenResponseSignOnly shop callback server generate sign string for the response body
@param resBodyData the response body 'data' field value, the type should be one of struct, struct point or map[string]interface{}, witch can be marshaled safely. @param priKey rsa private key, generated by shop client. @return sign new crypto string
func CallbackServerVerifyRequestSign ¶
CallbackServerVerifyRequestSign shop callback server verify the request sign sent by platform.
@param reqBody, http request body, type can be []byte, string or struct. @param pubKey, rsa public key, provided by platform.
func ParseJsonToClassMap ¶
ParseJsonToClassMap convert json string to map[string]string
func ParseObjectToClassMap ¶
ParseObjectToClassMap convert struct to map[string]string
func ShopClientGenPlatformRequestSign ¶
func ShopClientGenPlatformRequestSign(reqBody interface{}, priKey string) (newReqBody interface{}, err error)
ShopClientGenPlatformRequestSign shop client generate sign for request body before send request to platform
@param reqBody http request body going to send, type can be []byte, string or struct. @param priKey shop client rsa private key. @return newReqBody if reqBody type is []byte, return newReqBody type is []byte. if reqBody type is string, return newReqBody type is string. if reqBody type is struct, return newReqBody type is map[string]interface{}.
func ShopClientVerifyPlatformResponseSign ¶
ShopClientVerifyPlatformResponseSign shop client verify the 'sign' of platform response
@param resBody http response body received, type can be []byte, string or struct. @param pubKey rsa public key , provided by platform.
Types ¶
This section is empty.