Crate miniotp[][src]

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.

Enabled in this documentation build:

  • std
  • cstr
  • base32
  • serde
  • abomonation_impl

Re-exports

pub use Algorithm::*;
pub use simple::read_hotp_gauth as hotp;
pub use simple::read_totp_gauth as totp;

Modules

simple

Simple OTP primitive usage Simple usage of OTP primitives

Structs

HOTP

A counter-based one-time passcode implementation

Segs

A helper iterator for splitting secrets into more human readable pieces of text.

TOTP

A time-based one-time passcode implementation

Enums

Algorithm

The algorithm run for generating a HOTP or TOTP.

Error

Mapping error type.

Traits

Array

A type that can be coerced to a byte slice.