jwtsigner

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLoadPrivateKey = errors.New("couldn't read private key")

ErrLoadPrivateKey 私钥无法阅读

View Source
var ErrParseClaimsToJSON = errors.New("couldn't parse claims JSON")

ErrParseClaimsToJSON 无法加载JSON

View Source
var ErrSignToken = errors.New("Error signing token")

ErrSignToken 签名错误

View Source
var ErrUnexpectedAlgo = errors.New("unknown algo type key")

ErrUnexpectedAlgo 算法类型错误

Functions

This section is empty.

Types

type Asymmetric

type Asymmetric struct {
	// contains filtered or unexported fields
}

Asymmetric 非对称加密签名器

func AsymmetricFromPEM

func AsymmetricFromPEM(method string, keybytes []byte) (*Asymmetric, error)

AsymmetricFromPEM 使用PEM编码的密钥字节串创建一个非对称加密签名器对象

func AsymmetricFromPEMFile

func AsymmetricFromPEMFile(method string, keyPath string) (*Asymmetric, error)

AsymmetricFromPEMFile 从路径上读取PEM密钥文件创建一个非对称加密签名器对象

func AsymmetricNew

func AsymmetricNew(method string, key PrivateKey) (*Asymmetric, error)

AsymmetricNew 创建一个非对称加密签名器对象

func (*Asymmetric) ExpSign

func (signer *Asymmetric) ExpSign(payload map[string]interface{}, aud string, iss string, exp int64) (string, error)

ExpSign 签名一个会过期的token

func (*Asymmetric) ExpSignJSON

func (signer *Asymmetric) ExpSignJSON(jsonpayload []byte, aud string, iss string, exp int64) (string, error)

ExpSignJSON 为json签名一个无过期的token

func (*Asymmetric) ExpSignJSONString

func (signer *Asymmetric) ExpSignJSONString(jsonstringpayload string, aud string, iss string, exp int64) (string, error)

ExpSignJSONString 为json字符串签名一个会过期的token

func (*Asymmetric) Sign

func (signer *Asymmetric) Sign(payload map[string]interface{}, aud string, iss string) (string, error)

Sign 签名一个无过期的token

func (*Asymmetric) SignJSON

func (signer *Asymmetric) SignJSON(jsonpayload []byte, aud string, iss string) (string, error)

SignJSON 为json签名一个无过期的token

func (*Asymmetric) SignJSONString

func (signer *Asymmetric) SignJSONString(jsonstringpayload string, aud string, iss string) (string, error)

SignJSONString 为json字符串签名一个无过期的token

type PrivateKey

type PrivateKey interface {
	Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error)
}

PrivateKey 非对称加密的私钥

type Symmetric

type Symmetric struct {
	// contains filtered or unexported fields
}

Symmetric 对称加密签名器

func SymmetricNew

func SymmetricNew(method string, key string) (*Symmetric, error)

SymmetricNew 创建一个非对称加密签名器对象

func (*Symmetric) ExpSign

func (signer *Symmetric) ExpSign(payload map[string]interface{}, aud string, iss string, exp int64) (string, error)

ExpSign 签名一个会过期的token

func (*Symmetric) ExpSignJSON

func (signer *Symmetric) ExpSignJSON(jsonpayload []byte, aud string, iss string, exp int64) (string, error)

ExpSignJSON 为json签名一个无过期的token

func (*Symmetric) ExpSignJSONString

func (signer *Symmetric) ExpSignJSONString(jsonstringpayload string, aud string, iss string, exp int64) (string, error)

ExpSignJSONString 为json字符串签名一个会过期的token

func (*Symmetric) Sign

func (signer *Symmetric) Sign(payload map[string]interface{}, aud string, iss string) (string, error)

Sign 签名一个无过期的token

func (*Symmetric) SignJSON

func (signer *Symmetric) SignJSON(jsonpayload []byte, aud string, iss string) (string, error)

SignJSON 为json签名一个无过期的token

func (*Symmetric) SignJSONString

func (signer *Symmetric) SignJSONString(jsonstringpayload string, aud string, iss string) (string, error)

SignJSONString 为json字符串签名一个无过期的token

Jump to

Keyboard shortcuts

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