secret

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultServerUrl = "https://api.jd.com/routerjson"
	CIPHER_LEN       = 2
)

Variables

This section is empty.

Functions

func NewBusinessId

func NewBusinessId() string

Types

type Client

type Client struct {
	AppKey      string
	AppSecret   string
	AccessToken string
	SdkVer      uint
	Host        string
	Env         string
	KeyStore    *crypto.KeyStore
	Enccnt      uint
	Deccnt      uint
	Encerrcnt   uint
	Decerrcnt   uint
	Debug       bool
	sync.RWMutex
}

func NewClient

func NewClient(appKey string, appSecret, accessToken string) *Client

func (*Client) Decrypt

func (this *Client) Decrypt(encryptedStr string, usePrivateEncrypt bool) (string, error)

func (*Client) DecryptOrderInfo

func (this *Client) DecryptOrderInfo(orderInfo *order.OrderInfo, usePrivateKey bool) (err error)

func (*Client) DecryptUserInfo

func (this *Client) DecryptUserInfo(userInfo *user.UserInfo, usePrivateKey bool) (err error)

func (*Client) Encrypt

func (this *Client) Encrypt(str string, usePrivateEncrypt bool) (string, error)

func (*Client) EncryptOrderInfo

func (this *Client) EncryptOrderInfo(orderInfo *order.OrderInfo, usePrivateKey bool) (err error)

func (*Client) EncryptUserInfo

func (this *Client) EncryptUserInfo(userInfo *user.UserInfo, usePrivateKey bool) (err error)

func (*Client) GetCurrentKey

func (this *Client) GetCurrentKey() (key crypto.Key, err error)

func (*Client) GetFirstKey

func (this *Client) GetFirstKey() (key crypto.Key, err error)

func (*Client) GetKey

func (this *Client) GetKey(keyId string) (key crypto.Key, err error)

func (*Client) GetMasterKey

func (this *Client) GetMasterKey(tid string, voucherKey string) (keyStore *crypto.KeyStore, err error)

func (*Client) GetUserBaseInfo

func (this *Client) GetUserBaseInfo(pin string, loadType int, decrypt bool) (*user.UserInfo, error)

func (*Client) GetVoucher

func (this *Client) GetVoucher() (voucherData voucher.VoucherData, err error)

func (*Client) Hash

func (this *Client) Hash(oriData string, usePrivateEncrypt bool) (string, error)

func (*Client) PopOrderEnGet

func (this *Client) PopOrderEnGet(orderId uint64, orderState []string, optionalFields []string, decrypt bool) (*order.OrderInfo, error)

func (*Client) PopOrderEnSearch

func (this *Client) PopOrderEnSearch(searchReq *PopOrderEnSearchRequest, decrypt bool) ([]order.OrderInfo, int, error)

func (*Client) RefreshKeyStore

func (this *Client) RefreshKeyStore() (*crypto.KeyStore, error)

func (*Client) Report

func (this *Client) Report(service string, reportText ReportText, reportType ReportType, code string, msg string, heap string) error

func (*Client) ReportStatitics

func (this *Client) ReportStatitics() error

func (*Client) Salt

func (this *Client) Salt(usePrivateEncrypt bool) ([]byte, error)

func (*Client) SetEnv

func (this *Client) SetEnv(env string)

func (*Client) SetHost

func (this *Client) SetHost(host string)

func (*Client) StartReport

func (this *Client) StartReport()

type PopOrderEnSearchRequest

type PopOrderEnSearchRequest struct {
	StartDate      string   `json:"start_date,omitempty" codec:"start_date,omitempty"`
	EndDate        string   `json:"end_date,omitempty" codec:"end_date,omitempty"`
	OrderState     []string `json:"order_state,omitempty" codec:"order_state,omitempty"`
	OptionalFields []string `json:"optional_fields,omitempty" codec:"optional_fields,omitempty"`
	Page           int      `json:"page,omitempty" codec:"page,omitempty"`
	PageSize       int      `json:"page_size,omitempty" codec:"page_size,omitempty"`
	SortType       uint8    `json:"sort_type,omitempty" codec:"sort_type,omitempty"`
	DateType       uint8    `json:"date_type,omitempty" codec:"date_type,omitempty"`
}

type ReportAttribute

type ReportAttribute struct {
	Type    ReportType  `json:"type"`
	Host    string      `json:"host,omitempty"`
	Level   ReportLevel `json:"level,omitempty"`
	Service string      `json:"service,omitempty"`
	SdkVer  uint        `json:"sdk_ver"`
	Env     string      `json:"env,omitempty"`
	Ts      int64       `json:"ts"`
	Code    string      `json:"code,omitempty"`
	Msg     string      `json:"msg,omitempty"`
	Heap    string      `json:"heap,omitempty"`
	Enccnt  uint        `json:"enccnt,omitempty"`
	Deccnt  uint        `json:"deccnt,omitempty"`
}

type ReportLevel

type ReportLevel = uint
const (
	INFO_LEVEL   ReportLevel = 1
	WARN_LEVEL   ReportLevel = 2
	ERROR_LEVEL  ReportLevel = 3
	SEVERE_LEVEL ReportLevel = 4
)

type ReportStatistcAttribute

type ReportStatistcAttribute struct {
	Type      ReportType  `json:"type"`
	Host      string      `json:"host,omitempty"`
	Level     ReportLevel `json:"level,omitempty"`
	Service   string      `json:"service,omitempty"`
	SdkVer    uint        `json:"sdk_ver"`
	Env       string      `json:"env,omitempty"`
	Ts        int64       `json:"ts"`
	Enccnt    uint        `json:"enccnt"`
	Deccnt    uint        `json:"deccnt"`
	Encerrcnt uint        `json:"encerrcnt"`
	Decerrcnt uint        `json:"decerrcnt"`
}

type ReportText

type ReportText = string
const (
	INIT      ReportText = "INIT"
	EXCEPTION ReportText = "EXCEPTION"
	STATISTIC ReportText = "STATISTIC"
	EVENT     ReportText = "EVENT"
)

type ReportType

type ReportType = uint
const (
	INIT_TYPE      ReportType = 1
	EXCEPTION_TYPE ReportType = 2
	STATISTIC_TYPE ReportType = 3
	EVENT_TYPE     ReportType = 4
)

type Service

type Service struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewService

func NewService(host string, env string) *Service

func (*Service) Instance

func (this *Service) Instance(appKey string, secret string, accessToken string) *Client

Jump to

Keyboard shortcuts

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