nonce

package
v0.0.0-...-c294b08 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

A nonce is a number or string used only once. This is useful for generating a unique token for login pages to prevent duplicate submissions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Nonce

type Nonce struct {
	Token string
}

Contains a unique token

type Nonces

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

Keeps track of marked/used tokens

func New

func New() Nonces

func (*Nonces) CheckThenMarkToken

func (n *Nonces) CheckThenMarkToken(token string) error

func (*Nonces) CheckToken

func (n *Nonces) CheckToken(token string) error

func (*Nonces) HasToken

func (n *Nonces) HasToken(token string) bool

Checks if token has been marked.

func (*Nonces) MarkToken

func (n *Nonces) MarkToken(token string)

func (*Nonces) NewNonce

func (n *Nonces) NewNonce() Nonce

func (*Nonces) NewToken

func (n *Nonces) NewToken() string

Returns a new unique token

Jump to

Keyboard shortcuts

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