This repository contains a work-in-progress SDK for presence tracing based on the CrowdNotifier protocol. The API and the underlying protocols are subject to change.
CrowdNotifier proposes a protocol for building secure, decentralized, privacy-preserving presence tracing systems. It simplifies and accelerates the process of notifying individuals that shared a semi-public location with a SARS-CoV-2-positive person for a prolonged time without introducing new risks for users and locations. Existing proximity tracing systems (apps for contact tracing such as SwissCovid, Corona Warn App, and Immuni) notify only a subset of these people: those that were close enough for long enough. Current events have shown the need to notify all people that shared a space with a SARS-CoV-2-positive person. The proposed system provides an alternative to other presence-tracing systems that are based on invasive collection or that are prone to abuse by authorities.
The CrowdNotifier design aims to minimize privacy and security risks for individuals and communities, while guaranteeing the highest level of data protection and good usability and deployability. For further details on the design, see the CrowdNotifier White Paper.
The CrowdNotifier protocol is undergoing changes to improve its security and privacy properties. See CrowdNotifier for updates on the design. This SDK will be updated to reflect these changes.
The CrowdNotifierSDK for Android contains alpha-quality code only and is not yet complete. We are continuing the development of this library, and the API is likely to change. The library has not yet been reviewed or audited for security and compatibility.
This repository is part of a larger ecosystem. Please see the links below for SDKs for other platforms, and demo and backend applications that build on them.
- Android SDK: crowdnotifier-sdk-android
- iOS SDK: crowdnotifier-sdk-ios
- TypeScript Reference Implementation: crowdnotifier-ts
- Android Demo App: notifyme-app-android
- iOS Demo App: notifyme-app-ios
- Backend SDK: notifyme-sdk-backend
- Web Apps: notifyme-webpages
You can find further information on the CrowdNotifier protocol in the CrowdNotifier white paper
The SDK is available on JCenter and can be included directly as Gradle dependency:
dependencies {
implementation 'org.crowdnotifier:crowdnotifier-sdk-android:1.1'
}
// Get VenueInfo
VenueInfo venueInfo = CrowdNotifier.getVenueInfo(qrCode, prefix);
// Store a Check-In
long id = CrowdNotifier.addCheckIn(arrivalTime, departureTime, venueInfo, getContext());
// Update a Check-In
CrowdNotifier.updateCheckIn(id, arrivalTime, departureTime, venueInfo, getContext());
// Match published SKs against stored encrypted venue visits
List<ExposureEvent> newExposures = CrowdNotifier.checkForMatches(publishedSKs, getContext());
// Get all exposureEvents
List<ExposureEvent> allExposures = CrowdNotifier.getExposureEvents(getContext());
// Clean up old entries
CrowdNotifier.cleanUpOldData(getContext(), 10);
The CrowdNotifier class implements the following static methods that can be used to interact with the system. The SDK only stores encrypted entries of check-ins as well as exposure matches. Any additional storage of data needs to be handled by the app itself.
Name | Description | Function Name |
---|---|---|
getVenueInfo | Returns information about the data contained in a QR code, or null if the QR code does not have a valid format | public static VenueInfo getVenueInfo(String qrCode, String expectedQrCodePrefix) |
addCheckin | Stores a check in given arrival time, departure time and a VenueInfo object. Returns the id of the stored entry. | public static long addCheckIn(long arrivalTime, long departureTime, VenueInfo venueInfo, Context context) |
updateCheckin | Updates a checkin that has previously been stored | public static boolean updateCheckIn(long id, long arrivalTime, long departureTime, VenueInfo venueInfo, Context context) |
checkForMatches | Given a set of published events with a known infected visitor, stores and returns those locally stored check ins that overlap with one of the problematic events | public static List<ExposureEvent> checkForMatches(List<ProblematicEventInfo> publishedSKs, Context context) |
getExposureEvents | Returns all currently stored check ins that have previously matched a problematic event | public static List<ExposureEvent> getExposureEvents(Context context) |
cleanUpOldData | Removes all check ins that are older than the specified number of days | public static void cleanUpOldData(Context context, int maxDaysToKeep) |
This project is truly open-source and we welcome any feedback on the code regarding both the implementation and security aspects. This repository contains the Android prototype SDK, so please focus your feedback for this repository on implementation issues.
Before proceeding, please read the Code of Conduct to ensure positive and constructive interactions with the community.
This project is licensed under the terms of the MPL 2 license. See the LICENSE file.