• This repository has been archived on 07/Dec/2022
  • Stars
    star
    162
  • Rank 232,284 (Top 5 %)
  • Language
    Kotlin
  • License
    European Union Pu...
  • Created over 4 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android sources for the Dutch Covid19 Notification App

COVID-19 Notification App - Android

Introduction

This repository contains the native Android implementation of the Dutch COVID-19 Notification App CoronaMelder.

Feature Overview

This is a general overview of the features that are available in the app:

  • Onboarding. When the app starts or the first time, the user is informed of the functionality of the app and is asked to give permission for local notifications and the use of the GAEN framework.
  • Treatment perspective. When you receive an exposure notification, the app will provide information what to do in this situation.
  • Share GGD Key. If you have tested positive for coronavirus, you can share your unique identifiers publicly to make sure people who came into contact with you during the infectious period are alerted.
  • Pausing. The user has the option to pause the contact tracing framework for a set number of hours. This is useful when you are in an environment where other measures have been taken to protect people from the virus or in situations where you are aware that you are interacting with a large number of potentially infected individuals (like in Coronavirus testlocations) and you don't want to receive notifications about this in the future.
  • Q&A Section. In-app information about the functionality of the app, how your privacy is protected and how the app works in detail.
  • Requesting a Coronatest. Information on how to request a Coronatest with links to related websites or phonenumbers. Note that you can not directly request a test within the app itself.
  • Invite people to use the app. Allows the user to share a link to coronamelder.nl to their friends & family using the android share intent.
  • App Config Notifications. Provides the possibility to schedule a notification by configuring it in the app config.

Other functions of the app that are automatically performed and are not available through the UI of the app:

  • Contact Tracing using the GAEN framework. The app regularly downloads published keys from a public API and checks if the user ever came into contact with the device from which these infectious keys originated. This work is performed in regularly scheduled background tasks.
  • Decoy Traffic Generation. Since the "Share GGD Key" functionality of the app sends data to the API, any network traffic coming from the app could be construed as a sign that the user was infected. Because this presents a potential breach of privacy, the app regularly schedules similar (decoy) calls to the API to mask this traffic.

Deactivation

Currently the app has been deactivated, ceasing all server communications, revert 2ec9c476 to enable communication with the CDN again.

Supported devices

The Android app is supported on devices with API level 23 and above, that is Android 6.0 and above, that include support for Bluetooth Low Energy.

The app uses the Google Exposure Notification API, therefore Google Play services is required. The app supports Google Play services version 202665000 and above.

Development & Contribution process

The development team works on the repository in a private fork (for reasons of compliance with existing processes) and shares its work as often as possible.

If you plan to make non-trivial changes, we recommend to open an issue beforehand where we can discuss your planned changes. This increases the chance that we might be able to use your contribution (or it avoids doing work if there are reasons why we wouldn't be able to use it).

Git commits must be signed https://docs.github.com/en/github/authenticating-to-github/signing-commits

Development Setup

Google Account on (test)device must be on the allow list for Exposure Notifications to enable debug settings and enable โ€œBypass app signature checkโ€ to be able to run the app with a debug signature. "Enable diagnostics key file signature check" needs to be enabled to catch any errors related to the TEK file signatures on the server.

Build types and flavors

The Android project has a couple of flavors to target the specific environments. All flavors have a release and debug build type, except for the production flavor (to prevent debugging on production, this can be turned on in build.gradle when needed).

The build flavors control feature flags that are configured as BuildConfig fields. Currently the app module and the api module use these flavors.

Flavor Features
dev SSL pinning and response signatures disabled. Endpoints need to be set using Gradle properties cdnEndpoint and apiEndpoint, defaulting to localhost. This configuration can be used when inspecting traffic through a proxy and when running unit tests.
tst External log file enabled on the external storage application directory for debug purposes. A debug notification is enabled to allow for testing the notification state. The "secure screen" feature preventing screenshots on the status and notification screens is disabled. Endpoints are set to the tst environment
acc Production-like build with external log file enabled on the external storage application directory for testing purposes. Endpoints are set to the acc environment
prod Production build with all security features enabled

Core app functionality / starting points

This section highlights the key functionalities in relation to the code for getting started.

Exposure notification API

CoronaMelder has a (partial) abstraction ExposureNotificationApi around the Google Exposure Notifications API that converts the task based async API in Play Services to Kotlin suspend functions. This also aids testing by using FakeExposureNotificationApi in various tests.

NearbyExposureNotificationApi is the main implementation, wrapping the Google ExposureNotificationClient.

The Google Exposure Notification API is provided in the play-services-nearby-api module as an aar file.

ExposureNotificationsRepository

ExposureNotificationsRepository deals with everything related to exposure notifications through ExposureNotificationApi and is used throughout the app. The main functions are

  • Reporting the API status (enabled, disabled and checking of preconditions such as if bluetooth and location services are enabled)
  • Changing the API status (enable requesting consent, disabling)
  • Processing diagnostic keys from the server
  • Processing callbacks from this processing by recording exposures that reach the risk level threshold

Processing of manifest and TEK files

The processManifest is periodically run from ProcessManifestWorker and will fetch the latest manifest from the server, check if the app is decommissioned or needs to be updated.

The processExposureKeySets method manages the downloading of new exposure key files from the cdn. The goal is to attempt to process all files available and it will keep going (but recording errors) if a file fails to download or doesn't pass signature verification. The processed exposure key sets are stored in encrypted shared preferences so that they are only processed once.

For processing diagnostic keys, a token is generated. If an exposure is detected ExposureBroadcastReceiver will be called with that token. This will kick off ExposureNotificationJob which will then call back into ExposureNotificationRepository addExposure() to determine if the user should be notified or not.

Note that we're currently using the deprecated "v1" API mode.

Network setup

The api module contains all network related (Retrofit) services. There are a couple notable interceptors configured on the OkHttp instance which are configured using annotations on the Retrofit service interfaces.

SignedResponseInterceptor

This interceptor deals with verifying responses from the server that are signed. In a signed response, the response is actually a zip file containing content.bin and content.sig. The latter contains the cryptographic signature for the content file. The interceptor uses ResponseSignatureValidator to validate the signature and then transforms the response to a "normal" json response (the content.bin file). Methods annotated with @SignedResponse will use this interceptor.

PaddedRequestInterceptor

This interceptor is used on the api endpoints to pad the request with additional bytes. This prevents an attacker from determining the type of request by looking at the network traffic. This interceptor requires RequestSize as a parameter, which is set using the @Tag annotation on the Retrofit interface. It also requires the body of the request to have a padding json field. Methods annotated with @PaddedRequest will use this interceptor.

SignedBodyInterceptor

This interceptor is used to calculate the HMAC signature when posting TEKs to the postKeys endpoint. The secret is passed using the HmacSecret data class, set as a @Tag on the retrofit interface. The calculated hmac will be base64 encoded and added as a query parameter.

Disclaimer

Keep in mind that the Google Exposure Notification API is only accessible by verified health authorities. Other devices trying to access the API using the code in this repository will fail to do so.

More Repositories

1

nl-covid19-notification-app-design

Design documentatie rondom Covid19 Notificatie App
196
star
2

nl-covid19-data-dashboard

The dashboard provides information on the outbreak and prevalence of COVID-19 in The Netherlands
TypeScript
174
star
3

nl-covid19-notification-app-website

Project website
HTML
173
star
4

nl-kat-coordination

Repo nl-kat-coordination for minvws
Python
122
star
5

nl-covid19-notification-app-ios

Swift
120
star
6

nl-covid19-notification-app-coordination

CoronaMelder Documentation and Repo Overview
HTML
78
star
7

nl-covid19-notification-app-backend

Server-side code for CoronaMelder.
C#
77
star
8

nl-covid19-coronacheck-app-coordination

CoronaCheck Documentation and Repo Overview
TeX
45
star
9

nl-covid19-coronacheck-app-android

Kotlin
44
star
10

nl-covid19-testvac-qr-core

This is a proof of concept (PoC) for creating a QR code system for proving that one has had a valid vaccination record
Go
40
star
11

nl-covid19-coronacheck-app-ios

Swift
25
star
12

nl-covid19-data-backend-processing

Calculations behind the corona dashboard, which provides information on the outbreak and prevalence of COVID-19 in The Netherlands.
TSQL
17
star
13

nl-covid19-notification-app-community-website

Community website COVID-19 notificatieapp
Nix
16
star
14

nl-covid19-notification-lab-android

Android app for experiments with GAEN and Bluetooth protocols
Kotlin
15
star
15

nl-covid19-coronacheck-provider-docs

C#
13
star
16

nl-covid19-coronacheck-website

B2C website CoronaCheck
Vue
10
star
17

nl-kat-boefjes

Repo nl-kat-boefjes for openkat
Python
9
star
18

nl-covid19-coronacheck-backend-bizrules-signing-service

Signing service for DCC and Domestic Certs
Python
8
star
19

nl-covid19-notification-app-statistics

Collection of statistics related to CoronaMelder
8
star
20

nl-rdo-manon

Manon is een design framework
Svelte
8
star
21

pUZI-php

Proficient UZI pass reader in php.
Shell
8
star
22

nl-covid19-coronacheck-app-dgcg-integration

DGCG Integration code for CoronaCheck.
C#
8
star
23

horsebattery

A password generator inspired by https://xkcd.com/936/
PHP
8
star
24

nl-rdo-woo-web

Source code for the (new) WOO platform used by the Ministry of Health, Welfare and Sport
PHP
8
star
25

nl-eHealth-experimental

Collaboration within the eHealth network of the European Communities; experimental concepts for FHIR records for cross border use (vacinnations in different countries, use record of country A in country B, etc).
8
star
26

nl-covid19-coronacheck-mobile-core

Go
7
star
27

nl-kat-octopoes

Repo nl-kat-octopoes for openkat
Python
7
star
28

nl-covid19-coronacheck-idemix

Go
6
star
29

nl-rdo-zammad-api-export

This can be used to export tickets from Zammad to PDF. Each ticket will have its own PDF file.
PHP
6
star
30

nl-covid19-notification-app-provenance

Dutch Corona App - Provenance and Escrow/verification details of (production) builds
Shell
6
star
31

.github

6
star
32

nl-covid19-coronacheck-app-design

5
star
33

nl-kat-rocky

Repo nl-kat-rocky for openkat
HTML
5
star
34

nl-kat-mula

Repo nl-kat-mula for openkat
Python
4
star
35

nl-covid19-notification-app-iccportal

TypeScript
4
star
36

nl-covid19-notification-lab-ios

iOS app for experiments with GAEN and Bluetooth protocols
Swift
4
star
37

nl-covid19-dbco-app-ios

Swift
4
star
38

nl-kat-bytes

Repo nl-kat-bytes for openkat
Python
4
star
39

nl-covid19-coronacheck-app-coronatestprovider-portal-deprecated

3
star
40

go-uzi-middleware

UZI pass middleware for go
Go
3
star
41

nl-covid19-coronacheck-app-bff

Coronatester - backend for frontend
PHP
3
star
42

nl-covid19-dbco-app-coordination

DBCO Documentation and Repo Overview
Shell
2
star
43

nl-covid19-coronacheck-hcert

Go
2
star
44

laravel-crypto

PHP
2
star
45

nl-covid19-dbco-app-design

2
star
46

nl-rdo-max

Multiple Authentication eXchange (MAX) - OIDC to SAML
Python
2
star
47

nl-covid19-coronacheck-web-pdf-tools

JavaScript
2
star
48

nl-covid19-coronacheck-app-provenance

2
star
49

nl-rdo-app-ios-modules

Repo nl-rdo-app-ios-modules for minvws
Swift
2
star
50

generiekefuncties-toestemming

Samenwerken aan de Generieke Functie Toestemming
2
star
51

generiekefuncties-adressering

Samenwerken aan de Generieke Functie Adressering
2
star
52

nl-covid19-coronacheck-app-coronatestprovider-example

PHP
2
star
53

nl-covid19-coronacheck-signature-demo-deprecated

C#
2
star
54

nl-covid19-dbco-portal-design

2
star
55

pUzi-python

Proficient UZI pass reader in python.
Python
2
star
56

nl-rdo-woo-coordination

WOO Platform Coordination
1
star
57

nl-kat-keiko

Repo nl-kat-keiko for minvws
Python
1
star
58

puzi-auth-bundle

Symfony bundle for UZI authentication
PHP
1
star
59

pUZI-laravel

Laravel bundle for UZI authentication
PHP
1
star
60

libsodium-windows-cli

Libsodium Windows CLI
C#
1
star
61

nl-ggd-patientid-auth-provider

Web portal to allow patient id authentication via OIDC
PHP
1
star
62

nl-rdo-openid-connect-php-laravel

Repo nl-rdo-openid-connect-php-laravel for minvws
PHP
1
star
63

generiekefuncties-lokalisatie

Repo generiekefuncties-lokalisatie for minvws
1
star
64

nl-dodo-prikkenzonderafspraak

Repo nl-dodo-prikkenzonderafspraak for minvws
TypeScript
1
star
65

horsebattery-laravel

horsebattery-laravel
PHP
1
star
66

nl-rdo-git-repository-tools

Repo nl-rdo-git-repository-tools for minvws
Swift
1
star
67

nl-covid19-dienst-testen-api

Repo nl-covid19-dienst-testen-api for minvws
PHP
1
star
68

nl-contact-tracing-odds-and-ends

Various tools and utilities
Shell
1
star
69

nl-covid19-dbco-app-backend

PHP
1
star
70

nl-covid19-coronacheck-authentication-service

OpenID / SAML glue logic for DICTU Toegangs Verlenings Service
HTML
1
star
71

nl-ggd-meldportaal-web-public

Repo nl-ggd-meldportaal-web-public for minvws
PHP
1
star
72

rdo-aptly-manage

Repo rdo-aptly-manage-public for minvws
Python
1
star
73

base45-go

Go
1
star
74

nl-dodo-mijnvraagovercorona-web

Repo nl-dodo-mijnvraagovercorona-web-cleanup for minvws
TypeScript
1
star