simple_totp_auth 0.0.2 copy "simple_totp_auth: ^0.0.2" to clipboard
simple_totp_auth: ^0.0.2 copied to clipboard

A Flutter package to generate and verify TOTP codes with QR setup widget. Works on all platforms.

๐Ÿ” simple_totp_auth #

simple_totp_auth

A lightweight Flutter package for generating, verifying, and sharing Time-based One-Time Passwords (TOTP) using QR codes โ€” perfect for adding secure 2FA (Two-Factor Authentication) to any app.

โœ… Compatible with Google Authenticator, Microsoft Authenticator, Authy, and more!


Demo Screenshots #

Demo Screenshot

Demo Screenshot


โœจ Features #

  • ๐Ÿ”‘ Generate secure Base32 TOTP secrets
  • ๐Ÿ•’ Create & verify 6-digit TOTP codes (RFC 6238)
  • ๐Ÿ“ฑ Generate otpauth:// URIs
  • ๐Ÿ“ท Display QR codes for Authenticator setup
  • ๐Ÿ“‹ Copy secrets to clipboard (cross-platform support)
  • ๐Ÿงฉ Flutter Widget for QR with custom size, color, and logo

๐Ÿš€ Installation #

dependencies:
  simple_totp_auth: ^0.0.2

๐Ÿงช Usage #

๐Ÿ” Generate a Secure Secret Key #

final secret = TOTP.generateSecret();

๐Ÿงฎ Generate a TOTP Code (Valid for 30 seconds) #

final totp = TOTP(secret: secret);
final code = totp.now();
print("Code: $code");

โœ… Verify a Code #

final totp = TOTP(secret: secret);
final code = totp.now();
print("Code: $code");

๐Ÿ“ก Generate QR-Compatible URI #

final uri = totp.generateOTPAuthURI(
  issuer: "MyApp",
  account: "user@example.com",
);
print(uri);


๐Ÿ“ท Display the QR Code in Your App #

TOTPQrWidget(
  secret: secret,
  issuer: 'MyApp',
  accountName: 'user@example.com',
  logoType: LogoType.asset,         // Choose asset or network
  logoPath: 'images/logo.png',      // Path to the asset or URL for network image
  width: 200,
  height: 200,
  color: Colors.white,
  radiusColor: Colors.blue,
  radiusWidth: 2,
  radius: 16,
  padding: 8,
  margin: 8,
)

๐Ÿ“‹ Copy Secret to Clipboard (with feedback) #

final result = await TOTPUtils.copyToClipboard(secret);
print(result); // "Success" or error message

๐Ÿ“ฆ Platform Support #

Platform Support
โœ… Android Yes
โœ… iOS Yes
โœ… Web Yes
โœ… Windows Yes
โœ… macOS Yes
โœ… Linux Yes

Works across all 6 major platforms with no native plugins!


โ˜• Support the Developer #

If you found this package helpful, consider buying me a coffee:

Buy Me a Coffee


Thanks for using simple_totp_auth โค๏ธ

3
likes
160
points
36
downloads

Publisher

verified publisherayusdev.xyz

Weekly Downloads

A Flutter package to generate and verify TOTP codes with QR setup widget. Works on all platforms.

Repository (GitHub)
View/report issues

Topics

#totp #otp #authentication #qr-code #google-authenticator

Documentation

API reference

License

MIT (license)

Dependencies

base32, crypto, flutter, pretty_qr_code

More

Packages that depend on simple_totp_auth