Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit 2b70c36

Browse files
committed
Use live payjoin network resources
1 parent bf5f2fc commit 2b70c36

File tree

3 files changed

+33
-23
lines changed

3 files changed

+33
-23
lines changed

Diff for: Cargo.lock

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: mutiny-core/src/nodemanager.rs

+17-13
Original file line numberDiff line numberDiff line change
@@ -1062,21 +1062,25 @@ impl<S: MutinyStorage> NodeManager<S> {
10621062

10631063
// If we are in safe mode, we don't create payjoin sessions
10641064
let pj = {
1065-
// TODO get from &self config
1066-
const PJ_RELAY_URL: &str = "http://localhost:8080";
1067-
const OH_RELAY_URL: &str = "http://localhost:8080";
1068-
const OHTTP_CONFIG_BASE64: &str =
1069-
"AQAg7YjKSn1zBziW3LvPCQ8X18hH0dU67G-vOcMHu0-m81AABAABAAM";
1065+
// DANGER! TODO get from &self config, do not get config directly from PAYJOIN_DIR ohttp-gateway
1066+
// That would reveal IP address
1067+
1068+
let http_client = reqwest::Client::builder().build().unwrap();
1069+
1070+
let ohttp_config_base64 = http_client
1071+
.get(format!("{}/ohttp-config", crate::payjoin::PAYJOIN_DIR))
1072+
.send()
1073+
.await
1074+
.unwrap()
1075+
.text()
1076+
.await
1077+
.unwrap();
1078+
10701079
let mut enroller = payjoin::receive::v2::Enroller::from_relay_config(
1071-
PJ_RELAY_URL,
1072-
OHTTP_CONFIG_BASE64,
1073-
OH_RELAY_URL,
1074-
//Some("c53989e590b0f02edeec42a9c43fd1e4e960aec243bb1e6064324bd2c08ec498")
1080+
crate::payjoin::PAYJOIN_DIR,
1081+
&ohttp_config_base64,
1082+
crate::payjoin::OHTTP_RELAYS[0], // TODO pick ohttp relay at random
10751083
);
1076-
let http_client = reqwest::Client::builder()
1077-
//.danger_accept_invalid_certs(true) ? is tls unchecked :O
1078-
.build()
1079-
.unwrap();
10801084
// enroll client
10811085
let (req, context) = enroller.extract_req().unwrap();
10821086
let ohttp_response = http_client

Diff for: mutiny-core/src/payjoin.rs

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ use payjoin::receive::v2::Enrolled;
66
use serde::{Deserialize, Serialize};
77
use std::collections::HashMap;
88

9+
pub(crate) const OHTTP_RELAYS: [&str; 2] = [
10+
"https://ohttp-relay.obscuravpn.io/payjoin",
11+
"https://bobspace-ohttp.duckdns.org",
12+
];
13+
pub(crate) const PAYJOIN_DIR: &str = "https://payjo.in";
14+
915
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1016
pub struct Session {
1117
pub enrolled: Enrolled,

0 commit comments

Comments
 (0)