emitStr(); } function emitStr(): string { $html = "
"; $html .= $this->csrf->emitStr(); $html .= "

Please enter the code showing on your authenticator

"; $html .= ""; $html .= ""; $html .= "
"; $values = [ "%frm" => $this->ri->formProps("authenticate"), ]; return \str_replace(\array_keys($values), $values, $html); } function response(): bool { if (!this->csrf->match()) { return false; } $pUri = $this->db->getSecret($this->userIndex); $totp = _6238( $pUri.secret, $pUri.period, $this->db->getLastTime($this->userIndex), 2, $pUri.digits, $this->clock, $this->hash ); $flag = $totp.validate($this->ri->getResp("totp_challenge")); if($flag) { $this->db->storeLastTime($this->userIndex, $flag); return true; } return false; } } ?>