#otp #authorization #lib #authorisation

no-std bin+lib miniotp

Minimal customisable HOTP and TOTP implementations

5 releases (stable)

2.0.0 Mar 13, 2021
1.2.0 Jul 28, 2020
1.1.0 Mar 28, 2020
1.0.0 Mar 27, 2020
0.1.0 Mar 27, 2020

#600 in Authentication

MIT license

38KB
1K SLoC

MiniOTP

A minimal, customisable HOTP and TOTP implementation.

MVP works in #![no_std] mode with default-features = false.


lib.rs:

miniotp

An otp crate that aims for correctness of implementation, while giving the same speed that one would expect.

Features:

  • std - on by default; enables use of system time and/or allocations.
  • alloc - off by default; enables use of the alloc crate where allocations are required.
  • only-gauth - you only use google authenticator-valid codes. This disables some features, like setting the length, algorithm, period, or epoch. This is enabled by default.
  • cstr - enables support for creating a code from a AsRef<CStr>; for easier compatibility with noria::DataType::Text(_), or other data bases.
  • base32 - on by default; enables a set of functions related to taking an OTP secret as or into a string.
  • serde - off by default; adds (de)serialisation ability to TOTP and HOTP structs.
  • abomonation_impl - off by default; adds faster, array bytewise (de)serialisation ability to TOTP and HOTP structs.

Dependencies

~5–15MB
~248K SLoC