gauth

package
v1.0.161 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create added in v1.0.122

func Create(issuer, accountName string, size int) (string, string, error)

func CreateImage added in v1.0.144

func CreateImage(url string, size int) (string, error)

func CreateURL added in v1.0.144

func CreateURL(issuer, accountName string) (string, string, error)

CreateURL 密钥,链接

func GenerateSecretKey

func GenerateSecretKey(seed string) (string, error)

生成随机密钥,输出结果是经过base32编码

func GenerateSeed

func GenerateSeed() string

* @生成密钥种子

func GetNewCode

func GetNewCode(secretKey string, curTimeSlice int64) uint32

* @生成code验证码 * @secretKey 密钥 * @curTimeSlice 当前时间戳 - time.Now().Unix()

func SHA1

func SHA1(data []byte) []byte

func SHA1PRNG

func SHA1PRNG(seed []byte, size int) ([]byte, error)

func SHA512

func SHA512(data []byte) []byte

func ValidCode

func ValidCode(secretKey string, code uint32, size ...int) bool

* @校验code有效性 * @secretKey 密钥 * @code 验证码 * @size 偏移时间 s >= 1 && s <= 17

func Validate added in v1.0.122

func Validate(code, secret string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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