Skip to content

Add an onion message-based DNSSEC HRN Resolver #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ rustdoc-args = ["--cfg", "docsrs"]

[features]
http = ["reqwest", "std", "serde", "serde_json"]
std = ["dnssec-prover"]
std = ["dnssec-prover", "getrandom"]
default = ["std"]

[dependencies]
lightning-invoice = { version = "0.33", default-features = false }
lightning = { version = "0.1", default-features = false, features = ["dnssec"] }
bitcoin = { version = "0.32", default-features = false }
getrandom = { version = "0.3", default-features = false }
getrandom = { version = "0.3", default-features = false, optional = true }
dnssec-prover = { version = "0.6", default-features = false, optional = true, features = ["validation", "std", "tokio"] }
reqwest = { version = "0.11", default-features = false, optional = true, features = ["rustls-tls-webpki-roots", "json"] }
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
serde_json = { version = "1.0", default-features = false, optional = true, features = ["alloc"] }

[dev-dependencies]
tokio = { version = "1.0", default-features = false, features = ["rt", "macros"] }
lightning = { version = "0.1", features = ["std"] }
lightning-net-tokio = { version = "0.1", default-features = false }
5 changes: 4 additions & 1 deletion ci/ci-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ cargo check --verbose --color always
cargo check --release --verbose --color always
cargo test --no-default-features
[ "$RUSTC_MINOR_VERSION" -gt 81 ] && cargo test --features http
cargo test --features std
# One std test syncs much of the lightning network graph, so --release is a must
# At least until https://github.com/lightningdevkit/rust-lightning/pull/3687 gets backported
export RUSTFLAGS="-C debug-assertions=on"
cargo test --features std --release
[ "$RUSTC_MINOR_VERSION" -gt 81 ] && cargo doc --document-private-items --no-default-features
[ "$RUSTC_MINOR_VERSION" -gt 81 ] && cargo doc --document-private-items --features http,std
exit 0
4 changes: 2 additions & 2 deletions fuzz/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
use bitcoin::Network;

use bitcoin_payment_instructions::amount::Amount;
use bitcoin_payment_instructions::hrn::HumanReadableName;
use bitcoin_payment_instructions::hrn_resolution::{
DummyHrnResolver, HrnResolution, HrnResolutionFuture, HrnResolver, LNURLResolutionFuture,
DummyHrnResolver, HrnResolution, HrnResolutionFuture, HrnResolver, HumanReadableName,
LNURLResolutionFuture,
};
use bitcoin_payment_instructions::PaymentInstructions;

Expand Down
5 changes: 2 additions & 3 deletions src/dns_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ use dnssec_prover::rr::Name;

use crate::amount::Amount;
use crate::dnssec_utils::resolve_proof;
use crate::hrn::HumanReadableName;
use crate::hrn_resolution::{
HrnResolution, HrnResolutionFuture, HrnResolver, LNURLResolutionFuture,
HrnResolution, HrnResolutionFuture, HrnResolver, HumanReadableName, LNURLResolutionFuture,
};

/// An [`HrnResolver`] which resolves BIP 353 Human Readable Names to payment instructions using a
Expand Down Expand Up @@ -59,7 +58,7 @@ mod tests {
use crate::*;

#[tokio::test]
async fn test_http_hrn_resolver() {
async fn test_dns_hrn_resolver() {
let resolver = DNSHrnResolver(SocketAddr::from_str("8.8.8.8:53").unwrap());
let instructions = PaymentInstructions::parse(
"[email protected]",
Expand Down
83 changes: 0 additions & 83 deletions src/hrn.rs

This file was deleted.

3 changes: 2 additions & 1 deletion src/hrn_resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
//! associated types in this module.

use crate::amount::Amount;
use crate::hrn::HumanReadableName;

use lightning_invoice::Bolt11Invoice;

pub use lightning::onion_message::dns_resolution::HumanReadableName;

use core::future::Future;
use core::pin::Pin;

Expand Down
3 changes: 1 addition & 2 deletions src/http_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ use lightning_invoice::{Bolt11Invoice, Bolt11InvoiceDescriptionRef};

use crate::amount::Amount;
use crate::dnssec_utils::resolve_proof;
use crate::hrn::HumanReadableName;
use crate::hrn_resolution::{
HrnResolution, HrnResolutionFuture, HrnResolver, LNURLResolutionFuture,
HrnResolution, HrnResolutionFuture, HrnResolver, HumanReadableName, LNURLResolutionFuture,
};

const DOH_ENDPOINT: &'static str = "https://dns.google/dns-query?dns=";
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ pub mod dns_resolver;
#[cfg(feature = "http")]
pub mod http_resolver;

#[cfg(feature = "std")] // TODO: Drop once we upgrade to LDK 0.2
pub mod onion_message_resolver;

pub mod amount;

pub mod receive;

pub mod hrn_resolution;

pub mod hrn;

use amount::Amount;
use hrn::HumanReadableName;
use hrn_resolution::{HrnResolution, HrnResolver};
use hrn_resolution::{HrnResolution, HrnResolver, HumanReadableName};

/// A method which can be used to make a payment
#[derive(Clone, Debug, PartialEq, Eq)]
Expand Down
Loading
Loading