generator

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(opts GenerateOptions) (string, error)

Generate generates a Time or Counter based OTP code.

Types

type GenerateOptions

type GenerateOptions struct {
	Secret    string
	Counter   int64
	Digits    int
	Algorithm HashAlgorithm
}

type HashAlgorithm

type HashAlgorithm string
const (
	SHA1   HashAlgorithm = "SHA1"
	SHA256 HashAlgorithm = "SHA256"
	SHA512 HashAlgorithm = "SHA512"
)

func ToHashAlgorithm

func ToHashAlgorithm(s string) HashAlgorithm

ToHashAlgorithm converts a string into a HashAlgorithm. If the string is empty returns SHA1.

Jump to

Keyboard shortcuts

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