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 ¶
- func Get(data []byte) (id []byte, err error)
- func GetStrings(data string) (id string, err error)
- func GetStringsTimed(start time.Time, data string) (id string, err error)
- func GetTimed(start time.Time, data []byte) (id []byte, err error)
- func Verify(id, data []byte) bool
- func VerifyStrings(id, data string) bool
- func VerifyStringsTimed(id, data string, now time.Time, validDuration time.Duration) bool
- func VerifyTimed(id, data []byte, now time.Time, validDuration time.Duration) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStrings ¶
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 ¶
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 ¶
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 VerifyStrings ¶
VerifyStrings verifies a an id / data combination. See Verify for more information about captchas.
Can be used concurrent.
func VerifyStringsTimed ¶
VerifyStringsTimed verifies a timed id / data combination. See Verify for more information about captchas.
Can be used concurrent.
Types ¶
This section is empty.