dstotijn / ct-diag-server

Diagnosis server for Apple/Google's (COVID-19) Exposure Notification framework.
MIT License
61 stars 7 forks source link

Change offset behavior from date based `since` param to cursor based, using key data #31

Closed dstotijn closed 4 years ago

dstotijn commented 4 years ago

As (implicitly) recommended in Apple‘s sample code, the server should support downloading Diagnosis Keys with a cursor based offset, e.g. the latest known Temporary Exposure Key data.

Note: This probably means the server shouldn't order by uploaded_at (not accurate and also may lead to race conditions when handling concurrent uploads), but introduce an auto incrementing column and order by that.

The cache in-memory cache will also have to be adapted. When given a key cursor, it should scan its buffer for the key and stream data starting from there (skipping of course the given cursor's key).

For the query parameter, the hex encoded string representation of the key data should be used. E.g. 9aa2837955831298863798daee32b999.