12#include <boost/property_tree/ptree.hpp>
13#include <nlohmann/json.hpp>
14#include <Simple-Web-Server/server_https.hpp>
60 void setup(
const std::string &pkey,
const std::string &cert);
73 SunshineHTTPS(boost::asio::io_context &io_context, boost::asio::ssl::context &ctx):
74 SimpleWeb::HTTPS(io_context, ctx) {
79 SimpleWeb::error_code ec;
100 std::string uniqueID = {};
101 std::string cert = {};
102 std::string name = {};
113 std::shared_ptr<typename SimpleWeb::ServerBase<SimpleWeb::HTTP>::Response>,
114 std::shared_ptr<typename SimpleWeb::ServerBase<SunshineHTTPS>::Response>>
116 std::string salt = {};
204 bool pin(std::string
pin, std::string name);
Simple-Web-Server HTTPS backend configured for Sunshine certificate handling.
Definition nvhttp.h:65
SunshineHTTPS(boost::asio::io_context &io_context, boost::asio::ssl::context &ctx)
Construct an HTTPS connection using Sunshine's TLS context.
Definition nvhttp.h:73
Thread-safe queue with blocking and shutdown-aware consumers.
Definition thread_safe.h:391
Tagged storage for one of two possible value types.
Definition utility.h:756
Declarations for cryptography functions.
Contains all the functions and variables related to the nvhttp (GameStream) server.
Definition nvhttp.cpp:41
constexpr auto GFE_VERSION
The GFE version we are replicating.
Definition nvhttp.h:35
void serverchallengeresp(pair_session_t &sess, pt::ptree &tree, const std::string &encrypted_response)
Handle the server-challenge response phase of GameStream pairing.
Definition nvhttp.cpp:528
void clientpairingsecret(pair_session_t &sess, std::shared_ptr< safe::queue_t< crypto::x509_t > > &add_cert, pt::ptree &tree, const std::string &client_pairing_secret)
Handle the client pairing-secret phase of GameStream pairing.
Definition nvhttp.cpp:565
PAIR_PHASE
Enumerates supported pAIR PHASE options.
Definition nvhttp.h:87
@ SERVERCHALLENGERESP
Sunshine is in the server challenge response phase.
@ CLIENTCHALLENGE
Sunshine is in the client challenge phase.
@ NONE
Sunshine is not in a pairing phase.
@ CLIENTPAIRINGSECRET
Sunshine is in the client pairing secret phase.
@ GETSERVERCERT
Sunshine is in the get server certificate phase.
constexpr auto PORT_HTTPS
The HTTPS port, as a difference from the config port.
Definition nvhttp.h:45
constexpr auto VERSION
The protocol version.
Definition nvhttp.h:30
void start()
Start the nvhttp server.
Definition nvhttp.cpp:1263
void setup(const std::string &pkey, const std::string &cert)
Setup the nvhttp server.
Definition nvhttp.cpp:1250
constexpr auto PORT_HTTP
The HTTP port, as a difference from the config port.
Definition nvhttp.h:40
void clientchallenge(pair_session_t &sess, pt::ptree &tree, const std::string &challenge)
Handle the client-challenge phase of GameStream pairing.
Definition nvhttp.cpp:478
bool pin(std::string pin, std::string name)
Compare the user supplied pin to the Moonlight pin.
Definition nvhttp.cpp:774
bool unpair_client(const std::string_view uuid)
Remove single client.
Definition nvhttp.cpp:1424
void getservercert(pair_session_t &sess, pt::ptree &tree, const std::string &pin)
Return the server certificate text for pairing responses.
Definition nvhttp.cpp:447
void erase_all_clients()
Remove all paired clients.
Definition nvhttp.cpp:1417
bool set_client_enabled(const std::string_view uuid, bool enabled)
Enable or disable a client.
Definition nvhttp.cpp:1441
void remove_session(const pair_session_t &sess)
removes the temporary pairing session
Definition nvhttp.cpp:422
nlohmann::json get_all_clients()
Get all paired clients.
Definition nvhttp.cpp:936
std::string get_cert_by_uuid(const std::string_view uuid)
Get cert by UUID.
Definition nvhttp.cpp:1456
Pairing handshake state exchanged with a Moonlight client.
Definition nvhttp.h:98
std::string serverchallenge
Server challenge sent during pairing.
Definition nvhttp.h:109
struct nvhttp::pair_session_t::@11 client
Client object or client certificate data owned by this state..
std::vector< uint8_t > clienthash
Client certificate hash used during pairing.
Definition nvhttp.h:106
std::string serversecret
Server pairing secret.
Definition nvhttp.h:108
std::unique_ptr< crypto::aes_t > cipher_key
Cipher key.
Definition nvhttp.h:105
PAIR_PHASE last_phase
used as a security measure to prevent out of order calls
Definition nvhttp.h:122
struct nvhttp::pair_session_t::@12 async_insert_pin
Async insert pin.
Declarations for thread-safe data structures.