<?php

	// https://www.aqcm.fr/v2/M6/2FAS_register.php

	include("../M6/2FAS_Authenticator.php");

	$user_mail		= "test_user@gmail.com";
	$appli			= "AQCM05";

	// Generate a secure secret
	$secret = Authenticator::createSecret(16);
	$secret = "4HWWDT2XL4OFKHHG";
	echo($secret);echo("</br>");

	// Generate a TOTP code
	$code = Authenticator::generateCode($secret);
	$code = 107893;
	echo($code);echo("</br>");
	
	// Verify the code
	$isValid = Authenticator::verifyCode($secret, $code);
	echo $isValid ? "Valid code" : "Invalid code";echo("</br>");echo("</br>");

	// Generate a QR code URL for Google Authenticator
	$qrCodeUrl = Authenticator::generateQrCodeUrl($user_mail, $secret, $appli);
	echo $qrCodeUrl;echo("</br>");

?>
