hotp

package module
v0.0.0-...-08549c3 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2020 License: MIT Imports: 10 Imported by: 0

README

HOTP, TOTP (short-lived OTP values, which are desirable for enhanced security)

Usage
package main

import (
	"fmt"
	"github.com/kbukum/hotp"
)

func main() {
	totp := hotp.TOTP{
		OTP: hotp.OTP{
			SharedSecret: "Secret Key",
			Digits:       8,
			Crypto:hotp.SHA1,
		},
		StartTime: 0,
		TimeStep:  30,
	}
	fmt.Println(totp.Password())
}

REFERENCES

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DigitPowers = []int64{1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000}
)

Functions

This section is empty.

Types

type Crypto

type Crypto int
const (
	SHA1 Crypto = iota + 1
	SHA256
	SHA512
)

type OTP

type OTP struct {
	SharedSecret string
	Digits       int
	Crypto       Crypto
}

func (*OTP) Password

func (hotp *OTP) Password(counter int) string

type TOTP

type TOTP struct {
	OTP
	StartTime int64
	TimeStep  int64
}

func (*TOTP) Password

func (totp *TOTP) Password() string

Jump to

Keyboard shortcuts

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