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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
⌂ 换网址