{"id":19198507,"url":"https://github.com/virgilsecurity/demo-firebase-js","last_synced_at":"2025-05-09T01:18:58.769Z","repository":{"id":39562564,"uuid":"145692367","full_name":"VirgilSecurity/demo-firebase-js","owner":"VirgilSecurity","description":"A simple Web application that demonstrates how the end-to-end encryption works. The application uses firebase as a backend service for authentication and chat messaging, and Virgil E3Kit SDK for end-to-end encryption.","archived":false,"fork":false,"pushed_at":"2023-03-04T02:48:27.000Z","size":3517,"stargazers_count":33,"open_issues_count":14,"forks_count":7,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-20T10:41:48.611Z","etag":null,"topics":["demo-app","encryption","firebase","firestore","hipaa","javascript","virgil-e3kit-sdk"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VirgilSecurity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-22T10:15:48.000Z","updated_at":"2024-08-30T04:27:19.000Z","dependencies_parsed_at":"2024-11-09T12:37:07.478Z","dependency_job_id":null,"html_url":"https://github.com/VirgilSecurity/demo-firebase-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fdemo-firebase-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fdemo-firebase-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fdemo-firebase-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fdemo-firebase-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VirgilSecurity","download_url":"https://codeload.github.com/VirgilSecurity/demo-firebase-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171473,"owners_count":21865337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["demo-app","encryption","firebase","firestore","hipaa","javascript","virgil-e3kit-sdk"],"created_at":"2024-11-09T12:22:30.488Z","updated_at":"2025-05-09T01:18:58.747Z","avatar_url":"https://github.com/VirgilSecurity.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Virgil E3Kit JS Web + Firebase Demo\n\n\u003ca href=\"https://developer.virgilsecurity.com/docs\"\u003e\u003cimg width=\"230px\" src=\"https://cdn.virgilsecurity.com/assets/images/github/logos/virgil-logo-red.png\" align=\"left\" hspace=\"10\" vspace=\"6\"\u003e\u003c/a\u003e This is an end-to-end encrypted HIPAA-compliant demo chat app for Firebase that is using [Virgil Security](https://virgilsecurity.com)'s [E3Kit JavaScript SDK](https://github.com/VirgilSecurity/virgil-e3kit-js). The demo allows you to register users and back up their private keys, create peer-to-peer channels and send end-to-end encrypted messages.\n\nYou can reuse this sample in your projects to protect user data, documents, images using Virgil's end-to-end encryption [HIPAA whitepaper](https://virgilsecurity.com/wp-content/uploads/2018/07/Firebase-HIPAA-Chat-Whitepaper-Virgil-Security.pdf).\n\nAfter you set up the demo with the all credentials required in the instructions below you can run a chat for chatting:\n\n\u003cimg src=\"images/alice-bob-chatting.png\" alt=\"Chat screenshot\"\u003e\n\n\u003e The demo is using E3Kit v2.3.3.\n\n## Prerequisites\n\n* [Node v10](https://nodejs.org/en/download) or newer\n* [npm](https://www.npmjs.com/get-npm) or [yarn](https://yarnpkg.com/)\n\n## Set up and run demo\n\n### Clone JavaScript project\n\n```bash\ngit clone https://github.com/VirgilSecurity/demo-firebase-js\ncd demo-firebase-js\n```\n\n### Connect your Virgil and Firebase accounts\n\nTo connect your Virgil and Firebase accounts, you need to deploy a Firebase function that gives out Virgil JWT tokens for your authenticated users.\n\nTo deploy the function, head over to our GitHub repo and follow the instructions in README:\n\n* **[Firebase function deployment instructions](https://github.com/VirgilSecurity/e3kit-firebase-func)**\n\n#### Configure Authentication\n\nAt Firebase dashboard, select the **Authentication** panel and then click the **Sign In Method** tab. Choose the **E-mail** authentication method and click **Done**, then follow instructions and click **Save**.\n\n\u003cimg width=\"100%\" src=\"images/sign-in-firebase.png\" align=\"left\" hspace=\"1\" vspace=\"3\"\u003e\n\u0026nbsp;\n\n#### Configure Cloud Firestore\n\nSet up a Firestore database for the sample apps:\n1. Select the **Cloud Firestore** panel\n2. Click **Create database** under Firestore\n3. Choose **Start in test mode** and click **Enable**\n\nOnce the database is created, click on the **Rules** tab, click **Edit rules** and paste:\n  ```\n  service cloud.firestore {\n    match /databases/{database}/documents {\n      match /{document=**} {\n        allow read, write: if request.auth.uid != null;\n      }\n    }\n  }\n  ```\nNow click **PUBLISH**.\n\n\u003cimg width=\"100%\" src=\"images/database-firebase.png\" align=\"left\" hspace=\"1\" vspace=\"3\"\u003e\n\n\u0026nbsp;\n\u003e You only need to do this once - if you had already done it earlier, you don't need to do it again.\n\n### Add your Firebase project config to app\n\n1. Go to the Firebase console -\u003e your project's page in Firebase console, click the **gear icon** -\u003e **Project settings**\n\u003cimg width=\"100%\" src=\"https://cdn.virgilsecurity.com/assets/images/github/firebase-js-demo/project-settings.png\" align=\"left\" hspace=\"1\" vspace=\"3\"\u003e\n\u0026nbsp;\n\n2. Click **Add app** and choose **\"\u003c/\u003e Add Firebase to your web app\"**\n\u003cimg width=\"640px\"  src=\"images/add-app.png\" alt=\"Chat screenshot\"\u003e\n\u0026nbsp;\n\n3. Copy **only this part** to the clipboard:\n  ```\n    var firebaseConfig = {\n      apiKey: \"...\",\n      authDomain: \"...\",\n      databaseURL: \"...\",\n      projectId: \"...\",\n      storageBucket: \"...\",\n      messagingSenderId: \"...\"\n    };\n  ```\n\n\u003cimg width=\"640px\"  src=\"images/firebaseconf.png\" alt=\"Chat screenshot\"\u003e\n\n\u0026nbsp;\n\n4. **Replace the copied block** in your `src/firebase.ts` file.\n\n\u003cimg  width=\"740px\" src=\"images/firebaseсonfig.png\" alt=\"Chat screenshot\"\u003e\n\u0026nbsp;\n\n### Build and run\n\n* **Update dependencies, build \u0026 run**\n  ```\n  npm install\n  npm run start\n  ```\n\n\u003e In case you receive a message like `warning found n vulnerabilities` printed in the console after running the `npm install`, there is a potential security vulnerability in one of the demo's dependencies. Don't worry, this is a normal occurrence and in the majority of cases it is fixed by updating the packages. To install any updates, run the command `npm audit fix`. If some of the vulnerabilities persist after the update, check the results of the `npm audit` to see a detailed report. The report includes instructions on how to act on this information.\n\n## Explore demo\n\n1. **Browse to http://localhost:1234**. You will see a register/login form; you can use any e-mail and password to sign up a test user.\n\n\u003cimg width=\"640px\"  src=\"images/sign-up.png\" alt=\"Chat screenshot\"\u003e\n\n2. Start a **second incognito or browser window** to have 2 chat apps running with 2 different users. Sign up one more user.\n\n\u003cimg width=\"100%\" src=\"https://cdn.virgilsecurity.com/assets/images/github/firebase-js-demo/open-two-windows.png\" align=\"left\" hspace=\"1\" vspace=\"3\"\u003e\n\n3. Click the \"New Channel\" to create a channel between the 2 users.\n\n\u003cimg width=\"640px\"  src=\"images/find-users.png\" alt=\"Chat screenshot\"\u003e\n\n\u0026nbsp;\nNow you can start sending encrypted messages between them.\n\n\u003cimg src=\"images/alice-bob-chatting.png\" alt=\"Chat screenshot\"\u003e\n\n\u003e 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 browser 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 [here](https://github.com/VirgilSecurity/demo-firebase-js/blob/d263f0ddd4f92f51ee2a925cdffd32a19a0387ae/src/models/MessageListModel.ts#L34).\n\n## License\n\nThis library is released under the [3-clause BSD License](LICENSE).\n\n## Support\nOur developer support team is here to help you. Find out more information on our [Help Center](https://help.virgilsecurity.com/).\n\nYou can find us on [Twitter](https://twitter.com/VirgilSecurity) or send us email support@VirgilSecurity.com.\n\nAlso, get extra help from our support team on [Slack](https://virgilsecurity.com/join-community).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirgilsecurity%2Fdemo-firebase-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvirgilsecurity%2Fdemo-firebase-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirgilsecurity%2Fdemo-firebase-js/lists"}