session = new Session(); } public function userString(mixed $index): string { assert(is_string($index)); return $index; } public function storeSecret(mixed $index, string $secret) { $userID = $this->userString($index) . "_URI"; $this->session->store($userID, $secret); } public function stripSecret(mixed $index) { $userID = $this->userString($index) . "_URI"; $this->session->store($userID, null); } public function storeLastTime(mixed $index, int $timestamp) { $userID = $this->userString($index) . "_timestamp"; $this->session->store($userID, $timestamp); } public function getSecret(mixed $index): ?string { $userID = $this->userString($index) . "_URI"; return $this->session->get($userID); } public function getLastTime(mixed $index): int { $userID = $this->userString($index) . "_timestamp"; return $this->session->get($userID); } } class HttpEnroll { private $totpFactory; public function __construct() { $this->totpFactory = new Factory( new SessionPersistence(), new RequestRouter("HttpFullFlow.php"), ); $this->userManagement = $this->totpFactory->userManagement("Testman@example.co"); } public function view() { $this->userManagement->view(); } public function response() { $this->userManagement->response(); } } $page = new HttpEnroll(); $page->response(); $page->view(); ?>