service

package
v0.0.0-...-850f758 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const OpenApiUrl = "http://127.0.0.1:9501/openapi"

Variables

This section is empty.

Functions

func GetSignContent

func GetSignContent(params map[string]string) string

getSignContent

@Description:  生成待签名字符串
@param params
@return string

func RsaPriKeySignature

func RsaPriKeySignature(content string, priKey *rsa.PrivateKey) (string, error)

RsaPriKeySignature

@Description: 私钥生成签名
@param content:待签名字符串
@param priKey
@return string
@return error

func RsaPrivateKeyDecode

func RsaPrivateKeyDecode(priKey string) (*rsa.PrivateKey, error)

RsaPrivateKeyDecode

@Description: 将rsa私钥解析为 *rsa.PrivateKey 类型
@param priKey
@return *rsa.PrivateKey
@return error

func RsaPubKeySignVerify

func RsaPubKeySignVerify(content string, sign string, pubKey *rsa.PublicKey) error

RsaPubKeySignVerify

@Description: rsa公钥验证签名
@param content:待验证的字符串
@param sign: 待验证的签名
@param pubKey: 公钥
@return error

func RsaPublicKeyDecode

func RsaPublicKeyDecode(pubKey string) (*rsa.PublicKey, error)

RsaPublicKeyDecode

@Description: 将rsa公钥解析为 *rsa.PublicKey 类型
@param pubKey
@return *rsa.PublicKey
@return error

Types

type Config

type Config struct {
	AppId      string //应用ID
	PriKey     *rsa.PrivateKey
	OpenPubKey *rsa.PublicKey
	ApiUrl     string //接口地址

}

func GetConfig

func GetConfig(appId string, priKey *rsa.PrivateKey, openPubKey *rsa.PublicKey) *Config

func (*Config) SetApiUrl

func (c *Config) SetApiUrl(apiUrl string)

type Response

type Response struct {
	// contains filtered or unexported fields
}

func HttpPost

func HttpPost(url string, postData map[string]string) (*Response, error)

func (*Response) GetErrorCode

func (res *Response) GetErrorCode() int

func (*Response) GetErrorMessage

func (res *Response) GetErrorMessage() string

func (*Response) GetHttpStatus

func (res *Response) GetHttpStatus() int

func (*Response) GetSuccessData

func (res *Response) GetSuccessData() map[string]interface{}

func (*Response) SetErrorCode

func (res *Response) SetErrorCode(errorCode int)

func (*Response) SetHttpStatus

func (res *Response) SetHttpStatus(httpStatus int)

func (*Response) SetMessage

func (res *Response) SetMessage(message string)

func (*Response) SetSuccessData

func (res *Response) SetSuccessData(data map[string]interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL