database

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRegistrationToken

func AddRegistrationToken(token, username string) error

Add a token to the database for the specific username, may fail of the token does not meet complexity requirements

func Authenticate

func Authenticate(address, code string) (err error)

func DeleteDevice

func DeleteDevice(address string) error

func DeleteRegistrationToken

func DeleteRegistrationToken(identifier string) error

func GenerateToken

func GenerateToken(username string) (token string, err error)

Randomly generate a token for a specific username

func GetRegistrationToken

func GetRegistrationToken(token string) (username string, err error)

func GetRegistrationTokens

func GetRegistrationTokens() (map[string]string, error)

Returns list of tokens in a map of token : username

func IsEnforcingMFA

func IsEnforcingMFA(address string) bool

func Load

func Load(path string) error

func SetAttempts

func SetAttempts(address string, attempts int) error

func SetMFAEnforcing

func SetMFAEnforcing(address string) error

func ShowSecret

func ShowSecret(address string) (*otp.Key, error)

func UpdateDeviceEndpoint added in v1.4.1

func UpdateDeviceEndpoint(address string, endpoint *net.UDPAddr) error

Types

type Device

type Device struct {
	Address   string
	Publickey string
	Username  string
	Enforcing bool
	Attempts  int
	Endpoint  *net.UDPAddr
}

func CreateMFAEntry

func CreateMFAEntry(address, publickey, username string) (Device, error)

func GetDeviceByIP

func GetDeviceByIP(address string) (d Device, err error)

Yes mildly cursed.

func GetDeviceByUsername

func GetDeviceByUsername(username string) (d Device, err error)

func GetDevices

func GetDevices() ([]Device, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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