From d185b1070b817a4c04c1bb86ffca53cfb234e138 Mon Sep 17 00:00:00 2001 From: DanGould Date: Mon, 4 Dec 2023 12:05:10 -0500 Subject: [PATCH] Define payjoin network resources in mod --- mutiny-core/src/nodemanager.rs | 12 +++--------- mutiny-core/src/payjoin.rs | 6 ++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mutiny-core/src/nodemanager.rs b/mutiny-core/src/nodemanager.rs index f637200e4..c846c6841 100644 --- a/mutiny-core/src/nodemanager.rs +++ b/mutiny-core/src/nodemanager.rs @@ -1024,16 +1024,11 @@ impl NodeManager { let pj = { // DANGER! TODO get from &self config, do not get config directly from PAYJOIN_DIR ohttp-gateway // That would reveal IP address - const OHTTP_RELAYS: [&str; 2] = [ - "https://ohttp-relay.obscuravpn.io/payjoin", - "https://bobspace-ohttp.duckdns.org", - ]; - const PAYJOIN_DIR: &str = "https://payjo.in"; let http_client = reqwest::Client::builder().build().unwrap(); let ohttp_config_base64 = http_client - .get(format!("{}/ohttp-config", PAYJOIN_DIR)) + .get(format!("{}/ohttp-config", crate::payjoin::PAYJOIN_DIR)) .send() .await .unwrap() @@ -1042,11 +1037,10 @@ impl NodeManager { .unwrap(); let mut enroller = payjoin::receive::v2::Enroller::from_relay_config( - PAYJOIN_DIR, + crate::payjoin::PAYJOIN_DIR, &ohttp_config_base64, - OHTTP_RELAYS[0], // TODO pick ohttp relay at random + crate::payjoin::OHTTP_RELAYS[0], // TODO pick ohttp relay at random ); - // enroll client let (req, context) = enroller.extract_req().unwrap(); let ohttp_response = http_client diff --git a/mutiny-core/src/payjoin.rs b/mutiny-core/src/payjoin.rs index 5e9f59a9c..af862ca5a 100644 --- a/mutiny-core/src/payjoin.rs +++ b/mutiny-core/src/payjoin.rs @@ -6,6 +6,12 @@ use payjoin::receive::v2::Enrolled; use serde::{Deserialize, Serialize}; use std::collections::HashMap; +pub(crate) const OHTTP_RELAYS: [&str; 2] = [ + "https://ohttp-relay.obscuravpn.io/payjoin", + "https://bobspace-ohttp.duckdns.org", +]; +pub(crate) const PAYJOIN_DIR: &str = "https://payjo.in"; + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Session { pub enrolled: Enrolled,