Skip to main content

Module iroh_server

Module iroh_server 

Source

StructsΒ§

Handlers
Helper struct for registering handlers that are called by the Iroh Endpoint. GET handlers and POST handlers are registered separately, since they contain different function signatures. If a route is authenticated, it is also stored in authenticated_routes which is checked when the specific handler is called.

FunctionsΒ§

handle_incoming_iroh_request πŸ”’
Handle a specific Iroh request. The request must be deserialized, matched to a handler, executed, then return a response to the caller.
handle_request πŸ”’
Checks if the requested route is authenticated and will reject the request if the authentication is incorrect. Then it will lookup the specific handler in Handlers, execute it, and return the function’s JSON along with an HTTP status code.
iroh_verify_password πŸ”’
Verifies if the supplied password in the Iroh request matches the gateway’s password
make_get_handler πŸ”’
Creates a GET handler for the Iroh endpoint by wrapping it in a closure.
make_post_handler πŸ”’
Creates a POST handler for the Iroh endpoint by wrapping it in a closure.
parse_verify_route πŸ”’
Parses the LNURL-verify route /verify/{payment_hash} into the payment hash and the query parameters (?wait) of the request.
run_handler πŸ”’
Runs a request handler, turning a panic or an error into a 500 response for the caller that triggered it.
start_iroh_endpoint
Create the Iroh Endpoint and spawn a thread that starts listening for requests.
unknown_route πŸ”’
Response for a route that no handler is registered for.

Type AliasesΒ§

GetHandler πŸ”’
Handler for a GET request, which must contain no parameters and return serde_json::Value
PostHandler πŸ”’
Handler for a POST request, which must contain serde_json::Value encoded parameters and return serde_json::Value.