otp 2.2.3
otp: ^2.2.3 copied to clipboard

Dart native js
Flutter Android iOS Linux macOS web Windows

RFC6238 Time-Based One-Time Password / Google Authenticator Library

example/example.dart

import 'package:otp/otp.dart';

void main() {
  final code = OTP.generateTOTPCodeString('JBSWY3DPEHPK3PXP', DateTime.now().millisecondsSinceEpoch);
  print(code);

  final code2 = OTP.generateTOTPCodeString('JBSWY3DPEHPK3PXP', DateTime.now().millisecondsSinceEpoch, interval: 10);
  print(code2);

  final code3 = OTP.generateTOTPCodeString('JBSWY3DPEHPK3PXP', DateTime.now().millisecondsSinceEpoch, interval: 20, algorithm: Algorithm.SHA512);
  print(code3);

  final code4 = OTP.generateHOTPCodeString('OBRWE5CEFNFWQQJRMZRGM4LZMZIGKKZU', 1);
  print(code4);

  final code5 = OTP.generateTOTPCodeString('JBSWY3DPEHPK3PXP', 1362302550000);
  print(code5);
}
29
likes
100
pub points
88%
popularity

Publisher

yuli.dev

RFC6238 Time-Based One-Time Password / Google Authenticator Library

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

base32, convert, crypto, quick_log

More

Packages that depend on otp