f726320f096927aaeba1a5c7659dd8942734495b
[dnssec-prover] / src / lib.rs
1 //! The DNS provides a single, global, hierarchical namespace with (when DNSSEC is used)
2 //! cryptographic guarantees on all of its data.
3 //!
4 //! This makes it incredibly powerful for resolving human-readable names into arbitrary, secured
5 //! data.
6 //!
7 //! Unlike TLS, this cryptographic security provides transferable proofs which can convince an
8 //! offline device, using simple cryptographic primitives and a single root trusted key, of the
9 //! validity of DNS data.
10 //!
11 //! This crate implements the creation and validation of such proofs, using the format from RFC
12 //! 9102 to create transferable proofs of DNS entries.
13 //!
14 //! It is no-std (but requires `alloc`) and seeks to have minimal dependencies and a reasonably
15 //! conservative MSRV policy, allowing it to be used in as many places as possible.
16 //!
17 //! Most of the crate's logic is feature-gated, and *all dependencies are optional*:
18 //!  * By default, the `validate` feature is set, using `ring` to validate DNSSEC signatures and
19 //!    proofs using the [`validation`] module.
20 //!  * The `std` feature enables the [`query`] module, allowing for the building of proofs by
21 //!    querying a recursive resolver over TCP.
22 //!  * The `tokio` feature further enables async versions of the [`query`] methods, doing the same
23 //!    querying async using `tokio`'s TCP streams.
24 //!  * Finally, the crate can be built as a binary using the `build_server` feature, responding to
25 //!    queries over HTTP GET calls to `/dnssecproof?d=domain.name.&t=RecordType` with DNSSEC
26 //!    proofs.
27 //!
28 //! Note that this library's MSRV is 1.64 for normal building, however builds fine on 1.63 (and
29 //! possibly earlier) when `RUSTC_BOOTSTRAP=1` is set, as it relies on the
30 //! `const_slice_from_raw_parts` feature.
31
32 #![deny(missing_docs)]
33 #![deny(rustdoc::broken_intra_doc_links)]
34 #![deny(rustdoc::private_intra_doc_links)]
35
36 // const_slice_from_raw_parts was stabilized in 1.64, however we support building on 1.63 as well.
37 // Luckily, it seems to work fine in 1.63 with the feature flag (and RUSTC_BOOTSTRAP=1) enabled.
38 #![allow(stable_features)]
39 #![feature(const_slice_from_raw_parts)]
40
41 #![cfg_attr(not(feature = "std"), no_std)]
42 extern crate alloc;
43
44 #[cfg(feature = "validation")]
45 mod base32;
46
47 #[cfg(all(feature = "validation", fuzzing))]
48 pub mod crypto;
49 #[cfg(all(feature = "validation", not(fuzzing)))]
50 mod crypto;
51
52 pub mod rr;
53 pub mod ser;
54 pub mod query;
55
56 #[cfg(feature = "validation")]
57 pub mod validation;