core

package
v0.0.0-...-51c6937 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2015 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeToken

func EncodeToken(token Token) string

Encode a token into a string, format: userid.expires.signature.

func ReadConfiguration

func ReadConfiguration() error

Read the configuration file config.toml and store result in global Conf

func ValidateToken

func ValidateToken(token Token) (string, error)

Validate a token and returns the userid.

Types

type Configuration

type Configuration struct {
	Secret     []byte
	Expiration time.Duration
}
var Conf Configuration

type Token

type Token struct {
	Userid    string
	Expires   time.Time
	Signature []byte
}

func DecodeToken

func DecodeToken(encoded string) (Token, error)

Decode a string into a token structure.

func GenerateToken

func GenerateToken(content string) Token

Generate a new token to the userid specified.

Jump to

Keyboard shortcuts

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