gototp

package module
v0.0.0-...-e84f63c Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 6 Imported by: 0

README

Go Report Card

gototp

Description

Very simple Go library for generating TOTP codes. Simplified version of https://github.com/xlzd/gotp supporting just TOTP.

Installation

go get github.com/mskrha/gototp

Example usage

package main

import (
	"fmt"

	"github.com/mskrha/gototp"
)

func main() {
	t, err := gototp.NewDefault("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567")
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(t.Generate())
}

Documentation

Index

Constants

View Source
const (
	DefaultDigits   = 6
	DefaultInterval = 30
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TOTP

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

func New

func New(s string, d uint, i uint) (*TOTP, error)

func NewDefault

func NewDefault(s string) (*TOTP, error)

func (*TOTP) Generate

func (t *TOTP) Generate() string

Jump to

Keyboard shortcuts

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