/pub/auth/otp/
Package import"zappem.net/pub/auth/otp"
Documentationhttps://pkg.go.dev/zappem.net/pub/auth/otp
Sourceshttps://github.com/tinkerator/otp

otp

Overview

This package provides a Google Authenticator compatible One Time Pad (otp) implementation.

Automated documentation for this Go package is available from Go Reference.

While the otp package has no dependencies beyond the standard Go packages, we include an example binary, example/main.go, that serves as a demonstration of using the package and includes the generation of a QR code for enrolling a sample OTP config to the Google Authenticator application. This generation uses the github.com/skip2/go-qrcode package.

To try this example:

$ git clone https://github.com/tinkerator/otp.git
$ cd otp
$ go mod tidy
$ go build example/main.go
$ ./main

This will start a webserver listening to localhost:8080. The program generates a random new OTP secret each time it is invoked, and there is no lasting value to the generated key. But the compatibility with Google Authenticator can be validated using it. An example output looks like this:

sample output of the Fake OTP server

The webserver:

License info

The otp package is distributed with the same BSD 3-clause license as that used by golang itself.

Reporting bugs and feature requests

Use the github otp bug tracker.


Markdown rendering courtesy of gomarkdown/markdown.