Struct libotp::HOTP [] [src]

pub struct HOTP { /* fields omitted */ }

This is the secret that will be used to generate HMAC based one-time-passwords.

References

  • This object implements utilities for RFC4226.

Methods

impl HOTP
[src]

[src]

Creates a new HOTPSecret from OS generated random number.

Arguments

  • algorithm - Algorithm to use for OTP generation.

[src]

Loads a base32 encoded secret.

Arguments

  • data - base32 encoded secret to load.

[src]

Loads the HOTP secret from a given [u8].

Arguments

  • data - The shared secret.
  • algorithm - Algorithm used for OTP generation.

[src]

Exports the HOTP Secret as base32 encoded string.

[src]

Generates a One Time Password from the provided parameters.

Arguments

  • counter - Password's counter. This counter value should never be reused for security reasons.
  • digits - Desired OTP length, this value should be at least 6.

[src]

Validates the given OTP

Arguments

  • counter - The counter to test against.
  • digits - The OTPs length.
  • guess - A user provided guess to validate.

Note

It is recommended to check the following counters in case the user skipped an OTP. You should verify that an OTP with the same counter was not already used.