data

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2020 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Package data contains methods to authenticate data. There are two basic methods: normal authentification and timed authentification. An authentification consists of an id. The id can be shown publicly and can not be derivated from the data other than through brute force. The verification of the data soley depends on the id, so no state is required. This also means that you can use the functions parallel without problems or side effects. There are two caviats, though: * A hidden value is used to make predictions impossible. This means that whenever you restart the program, old ids are no longer valid. * One data / id combination is always valid (as long as the hidden value is the same).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(data []byte) (id []byte, err error)

Get returns one random id / captcha combination.

Can be used concurrent.

func GetStrings

func GetStrings(data string) (id string, err error)

GetStrings returns a string representation of the id for verification. Please note: You have no access on the original id. See Get for more information.

Can be used concurrent.

func GetStringsTimed

func GetStringsTimed(start time.Time, data string) (id string, err error)

GetStringsTimed returns a timed string representation of the id for verification. Please note: You have no access on the original id. See Get for more information about captchas.

Can be used concurrent.

func GetTimed

func GetTimed(start time.Time, data []byte) (id []byte, err error)

GetTimed returns one timed random id / data combination. start determines the time from which the authentification is valid.

You do not need to remember the time since it is encoded in the id (and can not be tampered with without invalidating the authentification).

Can be used concurrent.

func Verify

func Verify(id, data []byte) bool

Verify validates whether an id / data combination is valid.

Can be used concurrent.

func VerifyStrings

func VerifyStrings(id, data string) bool

VerifyStrings verifies a an id / data combination. See Verify for more information about captchas.

Can be used concurrent.

func VerifyStringsTimed

func VerifyStringsTimed(id, data string, now time.Time, validDuration time.Duration) bool

VerifyStringsTimed verifies a timed id / data combination. See Verify for more information about captchas.

Can be used concurrent.

func VerifyTimed

func VerifyTimed(id, data []byte, now time.Time, validDuration time.Duration) bool

VerifyTimed validates whether an id / data combination is valid and in date. Duration determines how long a captcha should be seen as valid.

Can be used concurrent.

Types

This section is empty.

Jump to

Keyboard shortcuts

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