accesstoken

package
v1.49.21 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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