contact-tracing

Crates.iocontact-tracing
lib.rscontact-tracing
version0.2.1
sourcesrc
created_at2020-04-12 08:38:15.485848
updated_at2020-04-12 09:10:59.145488
descriptionImplementation of the apple/google contact tracing protocol
homepagehttps://github.com/mitsuhiko/proximity-tracing
repositoryhttps://github.com/mitsuhiko/proximity-tracing
max_upload_size
id228924
size19,673
Armin Ronacher (mitsuhiko)

documentation

https://docs.rs/contact-tracing

README

contact-tracing

This crate implements the apple/google proximity contact tracing.

The version of this implementation is the initial reference spec from April 2020.

Features

  • chrono: Adds timestamp operations to all structs (on by default)
  • serde: Adds serde support (implies base64)
  • base64: Adds base64 encoding/decoding through Display and FromStr

Broadcast Example

To broadcast one needs a tracing key and the rolling proximity identifier (RPI) for a given time. The RPI is normally created from the daily tracing key but there is a shortcut to derive it automatically:

use contact_tracing::{TracingKey, DailyTracingKey, Rpi};

let tkey = TracingKey::unique();
let rpi = Rpi::for_now(&tkey);

Infection Checking Example

Infection checking uses the daily tracing keys directly:

use contact_tracing::{TracingKey, DailyTracingKey, Rpi};

// normally these would come from the internet somewhere
let tkey = TracingKey::unique();
let dtkey = DailyTracingKey::for_today(&tkey);

for (tin, rpi) in dtkey.iter_rpis().enumerate() {
    // check your database of contacts against the TIN and RPIs generated
    // for each daily tracing key downloaded.  The TIN should be within
    // some reasonable window of the timestamp you captured.
}

License: Apache-2.0

Commit count: 12

cargo fmt