You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 12, 2023. It is now read-only.
* Allow for v1.5+ early key release. Multiple keys can be provided that all have the same start interval
* Add configuration params for this
* Add tests for new pieces. 100% coverage on exposure model transform.
* Add documentation.
* add same day release as an optional feature to the generate server
Fixes#705
Part of #663
TEKs are published by sending the appropriate JSON document in the body of
25
+
an HTTP POST request to the `exposure` server.
26
+
27
+
The structure of the API is defined in [pkg/api/v1alpha1/exposure_types.go](https://github.com/google/exposure-notifications-server/blob/main/pkg/api/v1alpha1/exposure_types.go),
28
+
in the `Publish` type. Please see the documentation in the source file
29
+
for details of the fields themselves.
30
+
31
+
Here, we point out some non-obvious validation that is applied to the keys.
32
+
33
+
* All keys must be valid! If there are any validation errors, the entire batch
34
+
is rejected.
35
+
* Max keys per publish: Default is `20` and can be adjusted with the
36
+
`MAX_KEYS_ON_PUBLISH` environment variable.
37
+
* Max overlapping keys with same start interval: Default is `3` and can be
38
+
adjusted with the `MAX_SAME_START_INTERVAL_KEYS` environment variable.
39
+
In practical terms, this means that if you are obtaining TEK history on a
40
+
mobile device with >= v1.5 of the device API, it will stop the validity
41
+
of the current day's TEK and issue a new now. Both keys will have the same
42
+
start iterval.
43
+
* Max age: How old keys can be. The default is `360h` (15 days) and can be
44
+
adjusted with the `MAX_INTERVAL_AGE_ON_PUBLISH`. All provided keys must have
45
+
a `rollingStartNumber` that is >= to the max age.
46
+
* Keys with a future start time (`rollingStartNumber` indicates time > now),
47
+
are rejected.
48
+
* Keys that are "sill valid" are accepted by the server, but they are embargoed
49
+
until after they key could no longer be replayed usefully. A stall valid key
50
+
is one where the `rollingStartNumber` is in the past, but the
51
+
`rollingStartNumber` + the `rollingPeriod` indicates a future time.
52
+
* When using health authority verification certificates
53
+
(__strongly recommended__), the TEK data in the publish request and the
54
+
`hmackey` must be able to be used to calculate the HMAC value as present in
55
+
the certificate.
56
+
57
+
## Server Access Configuration
23
58
24
59
In order for your application to publish keys to the server, the server
25
60
requires the registration of the Application Name (for Android) or the Bundle ID
// OK, overlaps by start interval. But move out the nextInterval
273
+
nextInterval=ex.IntervalNumber+ex.IntervalCount
274
+
continue
275
+
}
276
+
251
277
ifex.IntervalNumber<nextInterval {
252
-
ift.debugReleaseSameDay {
253
-
logging.FromContext(ctx).Errorf("exposure keys have overlapping intervals")
254
-
break
255
-
}
256
-
returnnil, fmt.Errorf("exposure keys have overlapping intervals")
278
+
msg:=fmt.Sprintf("exposure keys have non aligned overlapping intervals. %v overlaps with previous key that is good from %v to %v.", ex.IntervalNumber, lastInterval, nextInterval)
279
+
logging.FromContext(ctx).Errorf(msg)
280
+
returnnil, fmt.Errorf(msg)
257
281
}
282
+
// OK, current key starts at or after the end of the previous one. Advance both variables.
283
+
lastInterval=ex.IntervalNumber
258
284
nextInterval=ex.IntervalNumber+ex.IntervalCount
259
285
}
260
286
287
+
fork, v:=rangestartIntervals {
288
+
ifv>t.maxSameDayKeys {
289
+
returnnil, fmt.Errorf("too many overlapping keys for start interval: %v want: <= %v, got: %v", k, t.maxSameDayKeys, v)
0 commit comments