Coder Social home page Coder Social logo

pushinwork / covid-alert Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openmined/covid-alert

0.0 0.0 0.0 9.62 MB

A privacy-preserving app for comparing last-known locations of coronavirus patients

License: Apache License 2.0

JavaScript 85.34% HTML 0.75% Starlark 2.21% Java 3.19% Ruby 3.69% Objective-C 4.82%

covid-alert's Introduction

COVID Alert

NOTE: This repo serves as a demo for the work being done by the Private Set Intersection team here at OpenMined. You can find their repos here:

We are no longer pursuing a production use-case with this application. Instead we've decided to contribute to another project: https://github.com/corona-trace

Folder Structure

  • /covidalert - React Native App for end-users
  • /dashboard - Create React App with Firebase cloud functions for an API and admin dashboard
  • /designs - All the related design files
  • /package - A small NPM package with three functions. One is for turning GPS coordinates into a sectorKey and gridTensor, and two others for allowing us to stringify and parse BitInts in JSON.

Languages

We have support for the following languages:

  • English
  • Spanish
  • Italian
  • Portuguese (Brazilian)
  • French
  • Russian
  • Chinese (Mandarin)
  • Arabic
  • Hindi

We are open to any pull requests to add support for other languages!

Getting app to work

The dashboard and package directories mostly speak for themselves. To get the app to run, run the following lines:

  1. yarn install to install dependencies
  2. react-native link to add assets (fonts and images) to packages
  3. If you want to install ios, run cd ios && pod install && cd ../
  4. yarn start for hot reloading
  5. iOS: yarn ios / Android: yarn android

Technical Explanation

For anyone wanting to know how we’re currently performing set intersection on the Covid Alert app… this is the description of how the system works. We’re looking to improvements on this process, specifically related to key generation and private set intersection in either Paillier HME or SEAL.

We’re trying to work on improving key generation speed for iOS and Android using React Native. There’s two places where we’re currently using Paillier HME: on the device to generate keys, encrypt the grid tensor, and then decrypt the result AND on the Node.js serverless function where the actual computation takes place. Here’s the workflow:

  1. Mobile phone generates a public/private key for Paillier upon loading the application. Mobile phone also generates a GPS coordinate of the user’s location every 30 seconds while moving.
  2. Coordinates are clipped to 2 digits to generate a “sector key” (accurate to 1km x 1km, aka… not very accurate) and then the 3rd digit (accurate to 100m x 100m) is clipped to generate a “grid tensor” (a 10x10 array of 0's with a 1 representing the location of the user).
  3. The sector key is left unencrypted since it’s not accurate enough to describe a person. The grid tensor, however, is flattened and then each value is encrypted.
  4. The unencypted sector key, the encrypted grid tensor, and the n and g values of the public key are sent to the server.
  5. The server receives everything and immediately regenerates the public key (using the provided n and g values, it must be identical to the one generated on the phone). It also then looks up all locations in the database reported in the last 72 hours for the same sector key.
  6. If one or more locations are found, we loop through the locations and perform a Paillier multiplication of each of the values (unencrypted) of that location (converted into a grid tensor) and the encrypted grid tensor supplied by the mobile phone. At the end of that matrix multiplication, the values are summed. We then continue to iterate over each location summing them against each other as we go.
  7. The final value (all the multiplied sums computed into value) is returned to the mobile phone in encrypted form.
  8. The mobile phone decrypts the value. If it’s 0, they’re safe. If it’s 1 or greater, they’re in an overlapped zone of someone with COVID in the last 72 hours and are promptly notified to exit the area calmly and quietly.

That’s the whole workflow from A->Z. Here’s a link to each of the main files involved in this work...

Acknowledgements

Many people have worked on this application within the OpenMined community, many of which do not show up in the commit history. Here's a brief list (in alphabetical order):

covid-alert's People

Contributors

cereallarceny avatar tcp avatar iamtrask avatar kritikalcoder avatar kevmo314 avatar samelsamel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.