gauth

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: 0BSD, ISC Imports: 14 Imported by: 0

Documentation

Overview

Package gauth implements the time-based OTP generation scheme used by Google Authenticator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Codes

func Codes(u *otpauth.URL) (prev, curr, next string, _ error)

Codes returns the previous, current, and next codes from u.

func CodesAtTimeStep

func CodesAtTimeStep(u *otpauth.URL, timeStep uint64) (prev, curr, next string, _ error)

CodesAtTimeStep returns the previous, current, and next codes from u at the given time step value.

func IndexNow

func IndexNow() (uint64, int)

IndexNow returns the current 30-second time step, and the number of seconds remaining until it ends.

func LoadConfigFile

func LoadConfigFile(path string, getPass func() ([]byte, error)) ([]byte, error)

LoadConfigFile reads and decrypts, if necessary, the CSV config at path. The getPass function is called to obtain a password if needed.

func ParseConfig

func ParseConfig(data []byte) ([]*otpauth.URL, error)

ParseConfig parses the contents of data as a gauth configuration file. Each line of the file specifies a single configuration.

The basic configuration format is:

name:secret

where "name" is the site name and "secret" is the base32-encoded secret. This represents a default Google authenticator code with 6 digits and a 30-second refresh.

Otherwise, a line must be a URL in the format:

otpauth://TYPE/LABEL?PARAMETERS

Types

This section is empty.

Jump to

Keyboard shortcuts

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