<?php
declare(strict_types=1);
/** Smoke: TOTP generate + verify round-trip (CLI). */
require_once __DIR__ . '/../src/bootstrap.php';

$secret = AuthTotp::generateSecret();
$slice = (int) floor(time() / 30);
$code = AuthTotp::codeAt($secret, $slice);
$ok = AuthTotp::verify($secret, $code);
echo $ok ? "OK totp verify\n" : "FAIL totp verify\n";
$enc = AuthCrypto::encrypt($secret);
$dec = AuthCrypto::decrypt($enc);
echo ($dec === $secret) ? "OK crypto round-trip\n" : "FAIL crypto\n";
exit($ok && $dec === $secret ? 0 : 1);
