gauth

package module
v0.0.0-...-462a00a Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2014 License: MIT Imports: 10 Imported by: 0

README

go-gauth

GoDoc

go-gauth is a simple library for integrating Google Authenticator based two factor authentication into your Go application. It should be pretty straight forward to use, but in the case that there is any confusion, you can refer to the godoc.

Documentation

Index

Constants

View Source
const (
	RETURN_DIGITS int = 6
	SECRET_LENGTH int = 16
)

Variables

This section is empty.

Functions

func GenerateSecret

func GenerateSecret() (string, error)

Generates a cryptographically secure base32 string that is the proper length for a secret to be used with Google Authenticator. This can be used for generating new secrets.

func GetOTP

func GetOTP(secret string) (string, error)

Returns a string containing the TOTP token associated with the provided secret at the current time. The secret should be base32 encoded.

func ValidateOTP

func ValidateOTP(otp, secret string) bool

Returns a boolean indicating if the provided otp string is valid for the provided secret at the current time. The secret should be base32 encoded.

Types

This section is empty.

Jump to

Keyboard shortcuts

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