oath_totp_validate(3)

🌸 NAME 🌸

okay so bestie, this is oath_totp_validate(3) from liboath β€” and the NAME tea is simple: oath_totp_validate is an API function, and she's the main character of this page. πŸ’…βœ¨

✨ SYNOPSIS ✨

Here's the summoning spell, copy it exactly, no cap:

#include <oath.h>

int oath_totp_validate(const char * secret, size_t secret_length, time_t
now, unsigned time_step_size, time_t start_offset, size_t window, const
char * otp);

πŸŽ€ ARGUMENTS πŸŽ€

okay, let's meet the cast, one by one 🫢

  • const char * secret β€” the shared secret string. The actual secret tea. πŸ”
  • size_t secret_length β€” length of secret. How many characters she's serving. πŸ“
  • time_t now β€” Unix time value to validate TOTP for. That's the moment we're checking against. ⏰
  • unsigned time_step_size β€” time step system parameter (typically 30). The heartbeat of the TOTP situation. πŸ’“
  • time_t start_offset β€” Unix time of when to start counting time steps (typically 0). Where the counting era begins. πŸ•°οΈ
  • size_t window β€” how many OTPs after/before start OTP to test. The search radius, basically. πŸ”
  • const char * otp β€” the OTP to validate. The code under the vibe check. βœ…

πŸ¦‹ DESCRIPTION πŸ¦‹

Validate an OTP according to the OATH TOTP algorithm per RFC 6238. That's the whole assignment. πŸ“±βœ¨

Currently only OTP lengths of 6, 7, or 8 digits are supported β€” those are the only sizes allowed on the runway right now. This restriction may be lifted in future versions, although some limitations are literally inherent in the protocol, so it's not just a vibe thing. 🧚

πŸ’– RETURNS πŸ’–

She returns the absolute value of position in OTP window β€” zero is first position β€” or OATH_INVALID_OTP if no OTP was found in the OTP window, or an error code. So it's giving position number, invalid-OTP moment, or error code. Periodt. πŸ’…

⭐ SINCE ⭐

1.6.0 β€” that's the era, bestie. πŸ•°οΈπŸ‘‘

πŸ™ˆ REPORTING BUGS πŸ™ˆ

Got a bug? Do not suffer in silence, report it to <oath-toolkit-help@nongnu.org>. 🫢

Copyright © 2009-2026 Simon Josefsson. 🫑

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. No cap, those are the license vibes. 🌈


xoxo, your liboath bestie β€” source/version from the footer is liboath 2.6.15, and no separate date was printed, so I'm not inventing one. πŸ’–βœ¨

πŸ“¦ where this page comes from