along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Driver file with page layout and basic action handling. */ require_once "lib/config.inc.php"; require_once "lib/html.inc.php"; require_once "lib/json.inc.php"; require_once "lib/messages.inc.php"; require_once "lib/request.inc.php"; require_once "lib/session.inc.php"; require_once "libauth/authenticator.inc.php"; require_once "libauth/namecoin_rpc.inc.php"; require_once "libauth/namecoin_interface.inc.php"; /* Construct basic worker classes. */ $session = new Session($sessionName); $rpc = new HttpNamecoin($rpcHost, $rpcPort, $rpcUser, $rpcPassword); $nc = new NamecoinInterface($rpc, $namePrefix); $req = new RequestHandler(); $html = new HtmlOutput(); $msg = new MessageList($html); /* Set status which may be changed later to show different pages. */ $status = "unknown"; /** * Try to perform a user login request. */ function tryLogin() { global $req, $session, $msg, $nc; global $status; global $serverUri; if ($status === "unknown" && $req->check("action")) { $action = $req->getString("action");
/** * Construct given the namecoin RPC interface to use. * @param rpc The RPC interface to use. * @param ns Namecoin namespace to use for names. */ public function __construct($rpc, $ns) { parent::__construct($rpc, $ns); $this->map = array(); }
the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Test the namecoin interface. */ require_once "../lib/config.inc.php"; require_once "../libauth/namecoin_interface.inc.php"; $rpc = new HttpNamecoin($rpcHost, $rpcPort, $rpcUser, $rpcPassword); $nc = new NamecoinInterface($rpc, $namePrefix); $res = $nc->getIdValue("dani"); assert($res->email === "*****@*****.**"); $thrown = FALSE; try { $nc->getIdValue("foo-bar-name-does-not-exist (hopefully still not)"); } catch (NameNotFoundException $exc) { $thrown = TRUE; } assert($thrown); $val = $nc->getIdValue("domob"); assert(isset($val->email) && $val->email === "*****@*****.**"); $val = $nc->getIdValue("invalid-json"); assert($val === NULL); $msg = "My test message to be signed!\nAnother line."; $sig = "HCpqMVqWfYuT0WJ8WXyLhMXF5lnZ0DwphVcV0rr8bCNxONddYJtINIs5I8Bd" . "Mqrk4wKaGQTK8035q+IMW3JVP0g=";