# libcontrac ReadMe
-libcontrac is an implementation of the Contact Tracing API.
+libcontrac is an implementation of the Apple/Google Contact Tracing API.
See the draft specs: https://www.apple.com/covid19/contacttracing/
If you have autoconf you can install as follows.
```
+autoreconf --install
./configure
make
make check
### Broadcasting and uploading keys
-Most of the functionality revolves around the Conrac structure.
+Most of the functionality revolves around the opaque `Contrac` structure.
Create and initialise the structure as follows. The day and interval number
should be set appropriately.
```
Contrac * contrac = contrac_new();
-contrac_generate_tracing_key(contrac);
-contrac_set_day_number(contrac, 23);
-contrac_set_time_interval_number(contrac, 76);
+// Generates a random Tracing Key if one hasn't yet been set
+contrac_update_current_time(data);
```
-Get the Rolling Proxmity Identifier for broadcast in Bluetooth beacons.
+Get the Rolling Proximity Identifier for broadcast in Bluetooth beacons.
```
// Returns a buffer containing RPI_SIZE bytes of data
const unsigned char * rpi = contrac_get_proximity_id(contrac);
Add RPIs captured via Bluetooth to an RPI list.
```
RpiList * rpis = rpi_list_new();
-Rpi * rpi = rpi_new();
-
-// Add captured bytes at given time
-rpi_assign(rpi, captured_bytes, time_interval_number);
-rpi_list_append(rpis, rpi);
+// Add bytes captured at a given time to the list
+rpi_list_add_beacon(rpis, captured_bytes, time_interval_number);
```
Construct a list of DTKs from data downloaded from a Diagnosis Server.
```
DtkList * dtks = dtk_list_new();
-Dtk * dtk = dtk_new();
-
-// Add data downloaded from the server
-dtk_assign(dtk, dtk_bytes, day_number);
-dtk_list_append(dtks, dtk);
+// Add data downloaded from the server to the list
+dtk_list_add_diagnosis(dtks, dtk_bytes, day_number);
```
Having collected these two lists any matches can be tested for as follows.
More information can be found at: https://www.flypig.co.uk/contrac
The source code can be obtained from git:
-
+```
git clone git@www.flypig.org.uk:libcontrac
+```
I can be contacted via one of the following.