Skip to content

chardoncs/otp2go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

otp2go

Version License

Simple OTP library for Go

License: BSD-3-Clause

Usage

At a glance

// ...
import (
    "fmt"
    "crypto"
    _ "crypto/sha1"

    otp "github.com/chardon55/otp2go"
)
// ...
totp, err := otp.NewTOTPBase32("<Your Base32 secret>", crypto.SHA1)
// check error

password, remainTime := totp.GenerateString6()
fmt.Printf("Password: %s, remaining seconds: %d", password, remainTime)