[−][src]Function libreauth::oath::libreauth_hotp_is_valid
#[no_mangle] pub extern "C" fn libreauth_hotp_is_valid(
cfg: *const HOTPcfg,
code: *const u8
) -> i32
[C binding] Check whether or not the supplied HOTP code is valid.
Examples
struct libreauth_hotp_cfg cfg;
const char key[] = "12345678901234567890";
uint32_t ret = libreauth_hotp_init(&cfg);
if (ret != LIBREAUTH_OATH_SUCCESS) {
// Handle the error.
}
cfg.key = key;
cfg.key_len = strlen(key);
if (libreauth_hotp_is_valid(&cfg, "755224")) {
printf("Valid HOTP code\n");
} else {
printf("Invalid HOTP code\n");
}