hotp

package
v0.0.0-...-5eebb81 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package hotp implements the HOTP algorithm according to RFC 4226

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Truncate

func Truncate(digits otp.Digits, sum []byte) string

Truncate implements the "dynamic truncation" as defined in RFC 4226 See http://tools.ietf.org/html/rfc4226#section-5.4 for details

func WithSkew

func WithSkew(skew int) otp.ValidationOption

Types

type Algorithm

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

func New

func New(key []byte, opts ...Option) *Algorithm

func (*Algorithm) Digits

func (a *Algorithm) Digits() otp.Digits

func (*Algorithm) Export

func (a *Algorithm) Export(exporter otp.Exporter)

func (*Algorithm) Generate

func (a *Algorithm) Generate(reference int64) string

func (*Algorithm) HashAlgorithm

func (a *Algorithm) HashAlgorithm() otp.HashAlgorithm

func (*Algorithm) Key

func (a *Algorithm) Key() []byte

func (*Algorithm) Validate

func (a *Algorithm) Validate(value string, reference int64, opts ...otp.ValidationOption) (int64, error)

type Option

type Option func(alg *Algorithm)

func WithDigits

func WithDigits(digits otp.Digits) Option

func WithHashAlgorithm

func WithHashAlgorithm(algorithm otp.HashAlgorithm) Option

Jump to

Keyboard shortcuts

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