tokenverify

package
v2.0.16 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenMalformed = apperr.New("token_malformed_error",
		apperr.WithTextTranslate(translator.Translate{
			translator.RU: "Неверный токен",
			translator.EN: "Token malformed",
		}),
		apperr.WithCode(code.Unauthenticated),
	)
	ErrTokenNotValidYet = apperr.New("token_not_valid_yet",
		apperr.WithTextTranslate(translator.Translate{
			translator.RU: "Недействительный токен",
			translator.EN: "Token not valid yet",
		}),
		apperr.WithCode(code.Unauthenticated),
	)
	ErrTokenUnknown = apperr.New("token_unknown",
		apperr.WithTextTranslate(translator.Translate{
			translator.RU: "Неизвестный токен",
			translator.EN: "Token unknown",
		}),
		apperr.WithCode(code.Unauthenticated),
	)
	ErrTokenExpired = apperr.New("token_expired",
		apperr.WithTextTranslate(translator.Translate{
			translator.RU: "Срок действия токена истек",
			translator.EN: "Token expired",
		}),
		apperr.WithCode(code.Unauthenticated),
	)
	ErrTokenNotExist = apperr.New("token_not_exist",
		apperr.WithTextTranslate(translator.Translate{
			translator.RU: "Токен не найден",
			translator.EN: "Token not exist",
		}),
		apperr.WithCode(code.Unauthenticated),
	)
	ErrTokenKicked = apperr.New("token_kicked",
		apperr.WithTextTranslate(translator.Translate{
			translator.RU: "Токен удален",
			translator.EN: "Token kicked",
		}),
		apperr.WithCode(code.Unauthenticated),
	)
)

Functions

func Secret

func Secret(secret string) jwt.Keyfunc

Types

type Claims

type Claims struct {
	UserID   int
	DeviceID int // login Device
	jwt.RegisteredClaims
}

func BuildClaims

func BuildClaims(userID int, DeviceID int, ttl time.Duration) Claims

func GetClaimFromToken

func GetClaimFromToken(tokensString string, secretFunc jwt.Keyfunc) (*Claims, error)

Jump to

Keyboard shortcuts

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