utils

package
v1.0.2-0...-08b43f4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AsymmetricMethods = map[string]bool{
	"RS256": true,
	"RS384": true,
	"RS512": true,
	"ES256": true,
	"ES384": true,
	"ES512": true,
}

AsymmetricMethods 非对称加密支持的算法范围

View Source
var CenterSupportedMethods = map[string]bool{
	"RS256": true,
	"HS256": true,
}

AsymmetricMethods 非对称加密支持的算法范围

View Source
var SymmetricMethods = map[string]bool{
	"HS256": true,
	"HS384": true,
	"HS512": true,
}

SymmetricMethods 对称加密支持的算法范围

Functions

func IsEs

func IsEs(method string) bool

IsEs 判断文件是不是ES方法加密

func IsRs

func IsRs(method string) bool

IsRs 判断文件是不是RS方法加密

func LoadData

func LoadData(p string) ([]byte, error)

LoadData 读取并加载文件数据

Types

type Signer

type Signer interface {

	// Sign 签名一个无过期的token
	Sign(payload map[string]interface{}, aud string, iss string) (string, error)

	// ExpSign 签名一个会过期的token
	ExpSign(payload map[string]interface{}, aud string, iss string, exp int64) (string, error)

	// SignJSON 为json签名一个无过期的token
	SignJSON(jsonpayload []byte, aud string, iss string) (string, error)

	// ExpSignJSON 为json签名一个会过期的token
	ExpSignJSON(jsonpayload []byte, aud string, iss string, exp int64) (string, error)

	// SignJSONString 为json字符串签名一个无过期的token
	SignJSONString(jsonstringpayload string, aud string, iss string) (string, error)

	// ExpSignJSONString 为json字符串签名一个会过期的token
	ExpSignJSONString(jsonstringpayload string, aud string, iss string, exp int64) (string, error)
}

Signer 签名器接口

type Verifier

type Verifier interface {

	// Verify 用Verifier对象验签
	Verify(tokenstring string) (map[string]interface{}, error)
}

Verifier 验证器接口

Jump to

Keyboard shortcuts

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