You can reuse this sample in any projects where you want to end-to-end protect user data, documents, images using Virgil's end-to-end encryption. HIPAA whitepaper.
This Demo is based on Virgil Java (Android) SDK.
Looking for other client platforms?
- iOS is based on Virgil Objective-C/Swift SDK
- JavaScript (browser) is based on Virgil E3Kit Typescript/Javascript SDK. Our new client-side SDK.
In Android Studio, go to 'File -> New -> Project from Version Control -> GitHub and paste in the repo's URL:
https://github.com/VirgilSecurity/demo-firebase-android
In order for the app to work, you need to deploy a Firebase function that gives out Virgil JWT tokens for your authenticated users. You'll also need to create a Firestore database with a specific rule set.
You only need to do this once - if you did it already earlier or for your iOS or JavaScript apps, don't need to do it again.
- Copy your new Firebase function's URL: go to the Firebase console -> your project -> Functions tab and copy your new function's url
- Go to Android Studio ->
app/src/main/java/com/android/virgilsecurity/virgilonfire/di/NetworkModule.java
and change the variableBASE_URL
to:https://YOUR_FUNCTION_URL.cloudfunctions.net/api/
- Go back to your project's page in Firebase console, click the gear icon -> Project settings
- Click Add app and choose "Android: Add Firebase to your Android app"
- Name your Android package and click Register app
- Download google-services.json into the 'app' folder in your Android source
At this point you are ready to build and run the application on your real device or emulator (with google services).
Remember, the app deletes messages right after delivery (it's a HIPAA requirement to meet the conduit exception). If you want to see encrypted messages in your Firestore database, run only 1 app instance, send a message to your chat partner and check Firestore DB's contents before opening the other user's app to receive the message. If you don't want to implement this behavior in your own app, you can remove it from this sample.