config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HmacAlgorithm

type HmacAlgorithm int

HmacAlgorithm type describes the supported hash algorithms for usage in OTP generation.

const (
	// HmacSHA1 indicates to use the SHA1 hash to calculate an HMAC.
	HmacSHA1 HmacAlgorithm = iota + 1
	// HmacSHA256 indicates to use the SHA256 hash to calculate an HMAC.
	HmacSHA256
	// HmacSHA512 indicates to use the SHA512 hash to calculate an HMAC.
	HmacSHA512
)

func (HmacAlgorithm) Hash

func (alg HmacAlgorithm) Hash() (h hash.Hash)

Hash returns a hash.Hash instance corresponding to the HmacAlgorithm type.

func (HmacAlgorithm) MarshalJSON added in v0.3.0

func (alg HmacAlgorithm) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON representation of HmacAlgorithm.

func (HmacAlgorithm) String

func (alg HmacAlgorithm) String() string

String returns a string representation of HmacAlgorithm.

type Length

type Length int

Length type describes the recommended OTP lengths.

const (
	Length1 Length = iota + 1
	Length2
	Length3
	Length4
	Length5
	Length6
	Length7
	Length8
)

Supported length to the OTP generated using HOTP or TOTP.

func (Length) LeftPad

func (l Length) LeftPad(number int) string

LeftPad adds extra zeroes to the left of the number to complete the Length.

func (Length) String

func (l Length) String() string

String converts the Length into a string.

func (Length) Truncate

func (l Length) Truncate(number int) int

Truncate will cut the provided number to fit the Length.

Jump to

Keyboard shortcuts

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