Skip to content
pubscout

auth_totp

2.0.0, released 5 months ago by rohitchouhan.com

A time-based one-time password (TOTP) and HOTP authentication package for Flutter apps.

WASM-ready
$ flutter pub add auth_totp
Source repository

What it does

Generates and verifies time-based (TOTP) and counter-based (HOTP) one-time passwords, creates secret keys, parses otpauth:// URIs, and aids with QR code generation.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to implement multi-factor authentication (MFA) using authenticator apps like Google Authenticator.
  • You want to generate and verify TOTP or HOTP codes directly within your Flutter app.

Skip it when

  • You are looking for external hosted authentication backends like Firebase Auth or Supabase.
  • You need biometric-only sign-in rather than time-based code verification.

Strengths

  • Supports SHA-1, SHA-256, and SHA-512 algorithms.
  • Includes offline QR code matrix generation for privacy.
  • Supports backup/recovery codes and URI parsing.

Weaknesses

  • Relies on third-party URL APIs if you use the online QR code generation helper.
  • Limited to one-time password logic rather than full identity management.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
2

No special native permissions or build runner required. Just import and use.

String secret = AuthTOTP.createSecret(length: 16);
bool isValid = AuthTOTP.verifyCode(secretKey: secret, totpCode: '123456');

Alternatives

Packages that do the same job and could replace auth_totp.

Works with

Packages commonly used together with auth_totp: ones it builds on, ones built on it, and its own family.