itokensjwt

package
v1.202405300917.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecretKeyLength = 64

	SecretKeyJWTName = "secretKeyJWT"
)

Variables

View Source
var SecretKeyExample = SecretKeyType{
	0x7e, 0x7f, 0x54, 0xfc, 0xbd, 0x1d, 0x6d, 0xe5, 0x6b, 0xc1, 0x01, 0xe7, 0x5c, 0xed, 0x13, 0x5d,
	0xf3, 0xa3, 0x57, 0x1d, 0x51, 0xae, 0xbd, 0x12, 0xf7, 0xc4, 0xda, 0xd4, 0xee, 0x62, 0xff, 0xe0,
	0x43, 0xc6, 0xcc, 0xfb, 0x6e, 0x39, 0x91, 0xd2, 0xa6, 0x1f, 0x7c, 0x87, 0x8b, 0xa0, 0x4d, 0xe6,
	0x08, 0x4a, 0x28, 0xc9, 0x8d, 0xde, 0x39, 0xf9, 0xca, 0xeb, 0x75, 0x52, 0x7e, 0x58, 0x71, 0x31,
}

Functions

func ProvideITokens

func ProvideITokens(secretKey SecretKeyType, timeFunc coreutils.TimeFunc) (tokenImpl itokens.ITokens)

ProvideITokens implementation by provided interface To receive implementation you must provide Secret Key. Min length - 64 byte, panic otherwise

func ProvideTestSecretsReader

func ProvideTestSecretsReader(realSecretsReader isecrets.ISecretReader) isecrets.ISecretReader

Types

type JWTSigner

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

func NewJWTSigner

func NewJWTSigner(secretKey SecretKeyType) *JWTSigner

func (*JWTSigner) CryptoHash256

func (j *JWTSigner) CryptoHash256(data []byte) (hash [hashLength]byte)

func (*JWTSigner) IssueToken

func (j *JWTSigner) IssueToken(app istructs.AppQName, duration time.Duration, pointerToPayload interface{}) (token string, err error)

func (*JWTSigner) ValidateToken

func (j *JWTSigner) ValidateToken(token string, pointerToPayload interface{}) (gp istructs.GenericPayload, err error)

type SecretKeyType

type SecretKeyType []byte

Jump to

Keyboard shortcuts

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