@@ -16,7 +16,7 @@ in this repository at [covidshield.proto](covidshield.proto).
16
16
The Diagnosis Server implements five main endpoints:
17
17
18
18
19
- * ` /retrieve ` : Fetch a set of Diagnosis Keys for a given two-hour period
19
+ * ` /retrieve ` : Fetch a set of Diagnosis Keys for a given UTC date number
20
20
* ` /upload ` : Upload a batch of Diagnosis Keys
21
21
* ` /new-key-claim ` : Generate One-Time-Code to permit an app user to upload keys
22
22
* ` /claim-key ` : Convert One-Time-Code into a credential that permits upload
@@ -86,23 +86,20 @@ positive diagnosis, and then should call it again each subsequent day, for days
86
86
Duplicate keys will be filtered by the server. Some time on day T+14, the keypairs used for
87
87
encryption and authorization will become invalid and be purged.
88
88
89
- ## ` /retrieve/:region/:period /:hmac `
89
+ ## ` /retrieve/:region/:datenumber /:hmac `
90
90
91
91
The ` region ` is an [ MCC] ( https://www.mcc-mnc.com/ ) (e.g. "302" for Canada).
92
92
93
- An "hour number" in this system is a UTC timestamp divided (using integer division) by 3600. This
94
- quantity increases by 1 each hour.
95
-
96
- A period is an hour number, rounded down to the next lower even number. So for example, the period
97
- for hours 3 and 2 is 2, in both cases. The period increases by 2 every 2 hours.
93
+ A "date number" in this system is a UTC timestamp divided (using integer division) by 86400. This
94
+ quantity increases by 1 each day, at UTC midnight.
98
95
99
96
the hmac parameter in this case must be a hex-encoded SHA256 HMAC (64 characters) of:
100
97
101
- region + ":" + period + ":" + currentHour
98
+ region + ":" + date-number + ":" + currentHour
102
99
103
- where ` period ` is provided in the URL (e.g. ` 441670 ` ), and ` currentHour ` is the current UTC hour
104
- number (e.g. ` 441683 ` ). ` currentHour ` must agree with the server to within +/- 1 hour in order for
105
- the request to be accepted.
100
+ where ` date-number ` is provided in the URL (e.g. ` 18431 ` ), and ` currentHour ` is the current UTC hour
101
+ number (timestamp / 3600; e.g. ` 441683 ` ). ` currentHour ` must agree with the server to within +/- 1
102
+ hour in order for the request to be accepted.
106
103
107
104
Of course there's no reliable way to truly authenticate these requests in an environment where
108
105
millions of devices have immediate access to them upon downloading an Application: this scheme is
@@ -129,8 +126,8 @@ The rationale for this is: a client should fetch the key data for the past 14 da
129
126
There's no need to cache historical keys locally, or to ever fetch them again or feed them into
130
127
future ExposureSessions, as long as the application has recorded locally that keys have been fetched
131
128
and checked for that range of historical time. This implementation is designed in a way that a
132
- device can check every two hours for newly-available unprocessed data packs and expect to find one
133
- new one each two hours to feed into an ExposureSession.
129
+ device can check every day for newly-available unprocessed data packs and expect to find one
130
+ new one each day to feed into an ExposureSession.
134
131
135
132
Note that, over time, historical packs will get smaller: the server will prune keys that, at the
136
133
time of pack generation, are more than 14 days old. However, no new keys will ever be added to a
0 commit comments