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

A Dart library for generating Mobile-OTP (mOTP) codes.

example/motp.dart

import 'package:motp/motp.dart';

void main() {
  final MOTP motp = MOTP(
    secret: '0123456789ABCDEF',
    pin: '1234',
    period: 10,
    digits: 6,
  );

  // By default, the current epoch time will be used.
  String code = motp.generate();
  print(code); // OUTPUT: 6-digit hexadecimal string.

  // This behavior can be overridden by passing in [unixSeconds] explicitly.
  final int unixSeconds = DateTime.now().millisecondsSinceEpoch ~/ 1000;
  code = motp.generate(unixSeconds);
  print(code); // OUTPUT: 6-digit hexadecimal string.
}
1
likes
150
pub points
15%
popularity

Publisher

verified publisherpanda.observer

A Dart library for generating Mobile-OTP (mOTP) codes.

Repository (GitHub)
View/report issues

Topics

#crypto #cryptography #mfa #otp #security

Documentation

API reference

Funding

Consider supporting this project:

www.buymeacoffee.com

License

MIT (license)

Dependencies

hashlib

More

Packages that depend on motp