interaction

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package interaction 用于处理平台和机器人开发者之间的互动请求(如内联搜索等)。

Index

Constants

View Source
const (
	// HeaderSig 请求签名
	HeaderSig = "X-Signature-Ed25519"
	// HeaderTimestamp 跟请求签名对应的时间戳,用于验证签名
	HeaderTimestamp = "X-Signature-Timestamp"
)

Variables

This section is empty.

Functions

func GenSignature

func GenSignature(secret string, header http.Header, httpBody []byte) (string, error)

GenSignature 生成签名,sdk 中的改方法,主要用于与验证签名方法配合进行验证

func SimulateSearch

func SimulateSearch(config *SearchConfig, keyword string) (*dto.SearchRsp, error)

SimulateSearch 模拟内联搜索请求 开发者可以使用本方法请求自己的服务器进行平台内联搜索的模拟,避免在平台上触发搜索请求。提升联调效率。

func VerifySignature

func VerifySignature(secret string, header http.Header, httpBody []byte) (bool, error)

VerifySignature 验证签名,需要传入 http 头,httpBody 请在方法外部从 http request 上读取了 body 之后再交给签名验证方法进行验证,避免重复读取

Types

type SearchConfig

type SearchConfig struct {
	AppID    uint64
	EndPoint string // 回调url地址
	Secret   string
}

SearchConfig 搜索请求配置

Jump to

Keyboard shortcuts

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