service

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSignContent

func GetSignContent(params map[string]any) string

GetSignContent

@Description: 生成待签名字符串, string  int  bool 类型数据参与签名
@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 {
	// contains filtered or unexported fields
}

func GetConfig

func GetConfig() *Config

func (*Config) GetApiUrl added in v0.2.0

func (c *Config) GetApiUrl() string

func (*Config) GetAppId added in v0.2.0

func (c *Config) GetAppId() string

func (*Config) GetOpenPubKey added in v0.2.0

func (c *Config) GetOpenPubKey() *rsa.PublicKey

func (*Config) GetPriKey added in v0.2.0

func (c *Config) GetPriKey() *rsa.PrivateKey

func (*Config) SetApiUrl

func (c *Config) SetApiUrl(apiUrl string)

func (*Config) SetAppId added in v0.2.0

func (c *Config) SetAppId(appId string)

func (*Config) SetOpenPubKey added in v0.2.0

func (c *Config) SetOpenPubKey(openPubKey *rsa.PublicKey)

func (*Config) SetPriKey added in v0.2.0

func (c *Config) SetPriKey(priKey *rsa.PrivateKey)

type Response

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

Response @Description:

func HttpPost

func HttpPost(url string, postData map[string]any) (*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