SecurePasswd_MGMT 2026.03.19
A modern, cross-platform password manager and two-factor authenticator (TOTP) designed with state-of-the-art security.
Loading...
Searching...
No Matches
totp.h File Reference
#include <stdint.h>
#include <time.h>
Include dependency graph for totp.h:
This graph shows which files directly or indirectly include this file:

Functions

char * generate_totp_code (const char *base32_secret)
 Generates a 6-digit TOTP code from a base32-encoded secret for the current time.
char * generate_totp_code_at_time (const char *base32_secret, time_t current_time)
 Generates a 6-digit TOTP code from a base32-encoded secret for a specific time.

Function Documentation

◆ generate_totp_code()

char * generate_totp_code ( const char * base32_secret)

Generates a 6-digit TOTP code from a base32-encoded secret for the current time.

Parameters
base32_secretThe base32-encoded TOTP secret.
Returns
A dynamically allocated string containing the 6-digit TOTP code. The caller is responsible for freeing this string.

◆ generate_totp_code_at_time()

char * generate_totp_code_at_time ( const char * base32_secret,
time_t current_time )

Generates a 6-digit TOTP code from a base32-encoded secret for a specific time.

Parameters
base32_secretThe base32-encoded TOTP secret.
current_timeThe time to generate the TOTP code for.
Returns
A dynamically allocated string containing the 6-digit TOTP code. The caller is responsible for freeing this string.