accesstoken

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Algorithm = "HS256"
)

Variables

View Source
var (
	TokenIsExpired     = jwt.TokenIsExpired
	TokenIsNotValidYet = jwt.TokenIsNotValidYet
)

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	Claims

	String string `json:"string"`
}

func New

func New(name string, subject string, permissions bit.Mask) *AccessToken

func (*AccessToken) Decode

func (a *AccessToken) Decode(str string, secret []byte) error

func (*AccessToken) Encode

func (a *AccessToken) Encode(secret []byte) string

func (*AccessToken) Peek

func (a *AccessToken) Peek(str string) error

func (*AccessToken) Verify

func (a *AccessToken) Verify(secret []byte) (bool, error)

type Claims

type Claims struct {
	jwt.Claims

	Name        string    `json:"name,omitempty"`
	UserId      string    `json:"uid,omitempty"`
	Permissions bit.Field `json:"bit,omitempty"`
}

func (Claims) Clone

func (c Claims) Clone() jwt.Claimable

func (Claims) HasPermission

func (c Claims) HasPermission(mask bit.Mask) bool

func (Claims) JSON

func (c Claims) JSON() string

Jump to

Keyboard shortcuts

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