DA

package
v0.0.0-...-de87630 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: BSD-3-Clause Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PROVATE_KEY string = "" // 定义好的通讯密钥
	/* 128-byte string literal not displayed */
	TIME_PARSE string = "2006-01-02 15:04" // 默认事件格式化格式

	SALT_TIMEOUT time.Duration = 5
)

Variables

This section is empty.

Functions

func BackData

func BackData(a *AuthStatus, w http.ResponseWriter)

验证返回

func Captcha

func Captcha(a GetAuth) bool

验证数据是否准确

func MakeAuthBySalt

func MakeAuthBySalt(salt *Salt, captDate string) string

依靠盐生成第二步验证数据 生成验证盐值 拿加密的 salt盐值字符串 + 输入时间格式化到 "2006-01-02 15:04" 格式的字符串 + 内部私有key 进行sha1算法hash

Types

type AuthStatus

type AuthStatus struct {
	StatusCode int
	Msg        string
}

type DefaultEngine

type DefaultEngine struct{}

默认加密引擎

type GetAuth

type GetAuth struct {
	Id      string `json:"salt_id"`
	AuthStr string `json:"auth"`
}

type Salt

type Salt struct {
	Id   string `json:"salt_id"`
	Salt string `json:"salt"`
	Time string `json:"time"`
}

func NewSalt

func NewSalt() (*Salt, error)

创建一个salt salt组成:

salt_id: uuid生成的唯一id
time: 当前时间
salt: sha1算法hash的 当前时间格式化到 "2006-01-02 15:04" 格式的字符串 + 随机新uuid + 设定好的key值

Jump to

Keyboard shortcuts

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