totp

package module
v0.0.0-...-9202f12 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: MIT Imports: 5 Imported by: 1

README

go-totp

GoDoc Build Status codecov codebeat badge

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	TimeStep  uint64 // X in RFC6238
	StartTime int64  // T0 in RFC6238, default 0 is OK
	Secret    string // shared secret for generate hotp
	Digit     int
}

Generator generates Time-based One-Time Password

func New

func New(secret string) *Generator

New returns new 6-digit TOTP generator.

func (Generator) Generate

func (g Generator) Generate() int64

Generate OTP

func (Generator) GenerateString

func (g Generator) GenerateString() string

GenerateString generates string OTP.

func (Generator) URI

func (g Generator) URI(issuer, account string) string

URI returns TOTP key URI.

Jump to

Keyboard shortcuts

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