token

package
v1.0.0-beta.8 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

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

Token represents a single token issued in the system.

func FromUserToken

func FromUserToken(userToken, usage string) (Token, error)

FromUserToken creates a Token struct from a user token string.

func New

func New(usage string) Token

New creates a new token.

func (*Token) Decrypt

func (t *Token) Decrypt(ciphertext []byte, additionalData string) ([]byte, error)

Decrypt decrypts the ciphertext with this token's encryption key.

func (*Token) Encrypt

func (t *Token) Encrypt(plaintext, additionalData string) ([]byte, error)

Encrypt encrypts the plaintext with this token's encryption key.

func (Token) Stored

func (t Token) Stored() []byte

Stored returns the value that should be stored in the datastore, for lookups.

func (Token) User

func (t Token) User() string

User returns the value that should be exposed and used by the user.

Jump to

Keyboard shortcuts

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