signature

package
v0.0.0-...-a87e0e1 Latest Latest
Warning

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

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

Documentation

Overview

Package signature 用于处理平台和机器人开发者之间的互动请求中的签名验证

Index

Constants

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

Variables

This section is empty.

Functions

func Generate

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

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

func Verify

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

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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