token

package
v0.0.0-...-708a039 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(t *Token) (string, error)

Encode codifica un Token obteniendo el tokenString

func Invalidate

func Invalidate(tokenString string) error

Invalidate invalida un token

Types

type Token

type Token struct {
	ID      primitive.ObjectID `bson:"_id"`
	UserID  primitive.ObjectID `bson:"userId"`
	Enabled bool               `bson:"enabled"`
}

Token es un objeto valor que representa un token.

func Create

func Create(userID primitive.ObjectID) (*Token, error)

Create crea un nuevo token y lo almacena en la db

func Find

func Find(tokenID string) (*Token, error)

Find busca un token en la db

func Validate

func Validate(tokenString string) (*Token, error)

Validate dado un tokenString devuelve el Token asociado

Jump to

Keyboard shortcuts

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