oath_totp_validate3(3)
π oath_totp_validate3 β NAME π
okay so bestie, this is oath_totp_validate3, an API function straight out of liboath (that's the manual we're in, liboath(3) vibes, hi), and it's literally the girl whose whole job is checking whether your TOTP code is valid. no cap. π
β¨ SYNOPSIS β¨
#include <oath.h>
int oath_totp_validate3(const char * secret, size_t secret_length,
time_t now, unsigned time_step_size, time_t start_offset, size_t window,
int * otp_pos, uint64_t * otp_counter, const char * otp);
she takes nine arguments. nine. main character energy fr fr. π
π«Ά ARGUMENTS π«Ά
const char * secretβ the shared secret string. the little secret. the tea. π€«size_t secret_lengthβ how longsecretis, in bytes.time_t nowβ the Unix time value you want to validate the TOTP for. like, right now? or whenever. your call. β°unsigned time_step_sizeβ the time step system parameter. typically30. that's the default-ish vibe everyone uses.time_t start_offsetβ the Unix time of when to start counting time steps. typically0.size_t windowβ how many OTPs after/before the start OTP to test. so like, the search radius. πint * otp_posβ output search position in the search window (zero is first position, jsyk). may beNULL.uint64_t * otp_counterβ the counter value used to calculate the OTP value. may beNULL. πconst char * otpβ the OTP to validate. the code itself. the moment of truth. π
πΈ DESCRIPTION πΈ
Validate an OTP according to the OATH TOTP algorithm per RFC 6238. that's it. that's the whole gig. validation queen. π
currently only OTP lengths of 6, 7 or 8 digits are supported. yes, only those three. this restriction may be lifted in future versions, although some limitations are inherent in the protocol β so like, don't come for her, the protocol is the messy one here. π
π₯ RETURNS π₯
returns the absolute value of the position in the OTP window (zero is first position), or OATH_INVALID_OTP if no OTP was found in the OTP window, or an error code. so: a number, or a sad little sentinel, or a bad-vibes error. that's the range. π
β SINCE β
2.4.0 β she's been iconic since 2.4.0, respect her longevity. π«Ά
π¦ REPORTING BUGS π¦
found a bug? report it to <oath-toolkit-help@nongnu.org>. π§
- liboath home page:
https://oath-toolkit.codeberg.page/ - general help using GNU software:
http://www.gnu.org/gethelp/
π COPYRIGHT π
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. (yes that includes your group chat. slay.) π
ngl bestie, that's the whole page β every flag, every param, every caveat, nothing skipped, periodt. π
and that's the sign-off from liboath, version 2.6.15, dated oath_totp_validate3(3) β mwah, go validate something. π§π
π¦ where this page comes from
- arch rolling: oath-toolkit 2.6.15-1 Β· GPL-3.0-or-later
- nixpkgs unstable: oath-toolkit 2.6.15
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms