nonce

package module
v0.0.0-...-a7d5615 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2015 License: MIT Imports: 7 Imported by: 5

README

Note

Project is retired and not under active development.

nonce-golang

One time token library

Works with Google Go version 1.x

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 or unauthorized submissions. @url github.com/LarryBattle/nonce-golang @license MIT , 2013 @author Larry Battle, github.com/LarryBattle

Index

Constants

View Source
const (
	Version    = "0.1.0"
	Token_New  = true
	Token_Used = false
)

Variables

This section is empty.

Functions

func CheckThenMarkToken

func CheckThenMarkToken(token string) error

Checks if the token is known and new. After the check, the token is marked as unused

func CheckToken

func CheckToken(token string) error

Checks for three conditions. 1. If a token is supplied 2. If the passed token was created 3. If the passed token isn't used' An error will be returned if any of the conditions are false

func MarkToken

func MarkToken(token string)

Saves the token as used.

func NewToken

func NewToken() string

Returns a new unique token

func SetIO

func SetIO(io IO)

Set the IO reader and writer

Types

type IO

type IO interface {
	Set(token string, val bool)
	Get(token string) (val bool, has bool)
}

The interface for saving and retrieving data

Jump to

Keyboard shortcuts

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