# pquerna/otp

TOTP library for Go

Repository: https://github.com/pquerna/otp
Canonical: https://ross.abutalabs.com/products/pquerna-otp
Language: Go
License: Apache-2.0
License Family: permissive
Last push: 2025-08-07T16:15:45+00:00

## Health v2 (maintenance only)
Score: 39/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 35, release rhythm 8, longevity 100
- inputs: {"age_days": 4271, "days_push": 391, "days_rel": 474, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2944, forks 254 (observed 2026-08-28T04:07:31.164634+00:00)

## What it is
A Go library implementing Time-based (TOTP, RFC 6238) and HMAC-based (HOTP, RFC 4228) one-time password algorithms for adding two-factor authentication to applications. It supports key generation, code generation and validation, and QR code image generation for user enrollment.

## Use cases
- add TOTP two-factor authentication to a Go web app
- generate QR codes for authenticator app enrollment
- validate 6-digit OTP codes from users
- implement HOTP counter-based one-time passwords
- build MFA login flow without SMS dependency

## When to choose
- you need standards-compliant TOTP/HOTP in a Go application
- you want QR code generation for easy authenticator setup
- you need a mature, widely used OTP library with an Apache-2.0 license

## When to avoid
- you need full MFA orchestration (recovery codes, enrollment UI) out of the box
- your project is not in Go
- you need SMS-based or push-based second factors

## Facets
- artifact type: library
- maturity: stable
- function: auth, security, cryptography
- domain: security, backend, web-development, developer-tools
- platform: go, cross-platform
- tags: totp, hotp, two-factor-authentication, mfa, one-time-password, qr-code, rfc6238, rfc4226

## Member repositories
- pquerna/otp (main) score 39

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:31.164634+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:47:37.521956+00:00, confidence not recorded.
  - readme: https://github.com/pquerna/otp (fetched 2026-08-28T04:07:31.164634+00:00, sha b1ec589f0f75)
- Data as of 2026-08-30T08:39:29.467469+00:00.
