aboutsummaryrefslogtreecommitdiff
path: root/include/signer
diff options
context:
space:
mode:
authorLibravatar buttercat1791 <mjjurkoic@gmail.com>2024-05-31 09:30:03 -0500
committerLibravatar buttercat1791 <mjjurkoic@gmail.com>2024-05-31 09:30:03 -0500
commit15c061974ae164a9b6b0d159d35f0389711d0345 (patch)
tree0a75a40c7e5d860000ee4477cb839a0e587df464 /include/signer
parent308840a3a3d80616e5a61bebbcdebb6d8ad99c66 (diff)
Parse connection token
Diffstat (limited to 'include/signer')
-rw-r--r--include/signer/noscrypt_signer.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/signer/noscrypt_signer.hpp b/include/signer/noscrypt_signer.hpp
index d2135da..606438e 100644
--- a/include/signer/noscrypt_signer.hpp
+++ b/include/signer/noscrypt_signer.hpp
@@ -40,6 +40,9 @@ private:
std::string _localPrivateKey;
std::string _localPublicKey;
+ std::string _remotePublicKey;
+ std::string _bunkerSecret;
+
///< A list of relays that will be used to connect to the remote signer.
std::vector<std::string> _relays;
@@ -58,6 +61,24 @@ private:
*/
std::tuple<std::string, std::string> _createLocalKeypair();
+ /**
+ * @brief Parses the remote signer npub from a connection token provided by the signer.
+ * @param connectionToken A connection token beginning with `bunker://`.
+ * @returns The index of the first character of the connection token's query string, or -1 if
+ * no valid public key could be parsed.
+ * @remark This function updates the `_remotePublicKey` string in its class instance by side
+ * effect.
+ */
+ int _parseRemotePublicKey(std::string connectionToken);
+
+ /**
+ * @brief Parses a single query param from a connection token provided by a remote signer.
+ * @param param A single query param from the connection token of the form `key=value`.
+ * @remark This function updates the `_relays` vector and the `_bunkerSecret` string in its
+ * class instance by side effect.
+ */
+ void _handleConnectionTokenParam(std::string param);
+
#pragma region Logging
void _logNoscryptInitResult(NCResult initResult);