gootp

package module
v0.0.0-...-5f3c9df Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: MIT Imports: 5 Imported by: 0

README

GOOTP

Build Status

Description

Another implementation of RFC4226(HOTP) and RFC6238(TOTP).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HOTP

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

HOTP implementation

func NewHOTP

func NewHOTP(secret []byte, digits int) (h *HOTP)

NewHOTP generate new HOTP instance

func (HOTP) At

func (h HOTP) At(counter uint64) string

At generate code

func (HOTP) Verify

func (h HOTP) Verify(code string, counter uint64) bool

Verify verify OTP code

type TOTP

type TOTP struct {
	*HOTP
	// contains filtered or unexported fields
}

TOTP implementation

func NewTOTP

func NewTOTP(secret []byte, digits, x int) (t *TOTP)

NewTOTP generate new TOTP instance

func (TOTP) At

func (t TOTP) At(timestamp int64) string

At get OTP at specific timestamp

func (TOTP) Now

func (t TOTP) Now() string

Now get current TOTP

func (TOTP) Verify

func (t TOTP) Verify(code string) bool

Verify verify OTP code

Jump to

Keyboard shortcuts

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