token

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericTokenGenerator

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

func NewGenericTokenGenerator

func NewGenericTokenGenerator(tokenLen int) *GenericTokenGenerator

NewGenericTokenGenerator returns a new *GenericTokenGenerator generating tokens with the given length.

func (*GenericTokenGenerator) Generate

func (tg *GenericTokenGenerator) Generate(length int) (string, error)

Token returns cryptographically secure randomly generated string, encoded with base64 raw standard encoding.

type TokenGenerator

type TokenGenerator interface {
	Generate(int) (string, error)
}

TokenGenerator implements just the method Generate(), which must return a cryptographically secure random string and an error.

var DefaultTokenGenerator TokenGenerator = &GenericTokenGenerator{120}

Jump to

Keyboard shortcuts

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