mfa

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 2 Imported by: 0

README

MFA

This package wraps some common MFA functionality I often need.

All the heavy lifting is done by the gotp package.

References

License

The MIT License (MIT)

Copyright (c) 2021 Scott Barr

See LICENSE

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSecret

func NewSecret(l int) string

NewSecret returns a secret of given length.

Types

type TOTPDevice

type TOTPDevice struct {
	// contains filtered or unexported fields
}

TOTPDevice creates a new TOTP device.

func NewTOTPDevice

func NewTOTPDevice(secret string) *TOTPDevice

NewTOTPDevice returns a new TOTPDevice with the given secret.

The secret should be a base32 encoded value.

func (*TOTPDevice) Generate

func (d *TOTPDevice) Generate() (*string, error)

Generate return the current OTP.

func (*TOTPDevice) GenerateAt

func (d *TOTPDevice) GenerateAt(ts int64) (*string, error)

GenerateAt returns the OTP for the given timestamp.

Jump to

Keyboard shortcuts

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