gauth

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: ISC Imports: 13 Imported by: 1

Documentation

Overview

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

Index

Constants

View Source
const (
	DefaultPeriod = 30
)

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 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. Returns a slice of otpauth URLs representing the parsed configurations.

func ReadConfigFile added in v1.3.0

func ReadConfigFile(path string) ([]byte, bool, error)

ReadConfigFile reads the config file at path and returns its contents and whether it is encrypted or not

func WriteConfigFile added in v1.3.0

func WriteConfigFile(path string, passwd []byte, newConfig []byte) error

WriteConfigFile encrypts the provided newConfig using passwd, if necessary, and writes it to path

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳