contact_tracing/lib.rs
1//! This crate implements the apple/google proximity contact tracing.
2//!
3//! The version of this implementation is the [initial reference
4//! spec](https://covid19-static.cdn-apple.com/applications/covid19/current/static/contact-tracing/pdf/ContactTracing-CryptographySpecification.pdf)
5//! from April 2020.
6//!
7//! # Features
8//!
9//! * `chrono`: Adds timestamp operations to all structs (on by default)
10//! * `serde`: Adds serde support (implies `base64`)
11//! * `base64`: Adds base64 encoding/decoding through `Display` and `FromStr`
12//!
13//! # Broadcast Example
14//!
15//! To broadcast one needs a tracing key and the rolling proximity identifier
16//! (RPI) for a given time. The RPI is normally created from the daily tracing
17//! key but there is a shortcut to derive it automatically:
18//!
19//! ```
20//! use contact_tracing::{TracingKey, DailyTracingKey, Rpi};
21//!
22//! let tkey = TracingKey::unique();
23//! let rpi = Rpi::for_now(&tkey);
24//! ```
25//!
26//! # Infection Checking Example
27//!
28//! Infection checking uses the daily tracing keys directly:
29//!
30//! ```
31//! use contact_tracing::{TracingKey, DailyTracingKey, Rpi};
32//!
33//! // normally these would come from the internet somewhere
34//! let tkey = TracingKey::unique();
35//! let dtkey = DailyTracingKey::for_today(&tkey);
36//!
37//! for (tin, rpi) in dtkey.iter_rpis().enumerate() {
38//! // check your database of contacts against the TIN and RPIs generated
39//! // for each daily tracing key downloaded. The TIN should be within
40//! // some reasonable window of the timestamp you captured.
41//! }
42//! ```
43
44mod dtkey;
45mod rpi;
46mod tkey;
47mod utils;
48
49pub use dtkey::*;
50pub use rpi::*;
51pub use tkey::*;
52
53#[allow(unused_imports)]
54pub use utils::*;