package main
import (
"encoding/base32"
"fmt"
"log"
"os"
)
func main() {
generator := NewGenerator("sha1", 30, 6, nil)
err := generator.SetSecretString(base32.StdEncoding, "JBSWY3DPEHPK3PXP")
if err != nil {
log.Printf("error: %v", err)
os.Exit(1)
}
// Generate a 2FA code
code, err := generator.Generate()
if err != nil {
log.Printf("error: %v", err)
os.Exit(2)
}
fmt.Println(code)
// Generate a 2FA URL
urlOf2fa := generator.URL(base32.StdEncoding, "label", "issuer")
fmt.Println(urlOf2fa)
}
-
Notifications
You must be signed in to change notification settings - Fork 0
Simple TOTP
License
kmtr/totp
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Simple TOTP
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published