Skip to content
Backend's function that connects your Virgil and Firebase accounts for implementing end-to-end encryption
Branch: master
Clone or download
xlwknx Merge pull request #3 from VirgilSecurity/dependabot/npm_and_yarn/fun…
…ctions/axios-0.18.1

Bump axios from 0.18.0 to 0.18.1 in /functions
Latest commit 61fb88f Jun 3, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
functions Bump axios from 0.18.0 to 0.18.1 in /functions Jun 3, 2019
utils init Oct 26, 2018
.gitignore init Oct 26, 2018
LICENSE Initial commit Oct 26, 2018
README.md Add note about Node version in npm install step Mar 14, 2019
config.example.json add example config Nov 16, 2018
firebase.json init Oct 26, 2018

README.md

Configure your Firebase function to generate Virgil JWT

This repository contains a backend's function that connects your Virgil and Firebase accounts for implementing end-to-end encryption.

Prerequisites

  • Node version from 6 to 10

Node 11 is not supported yet, you can use one of node version managers to switch the version: n or nvm

Configure Your Firebase Project

We assume that you already have a Firebase Project. If you don't, please create one now at your Firebase Console.

Configure User Authentication

If you haven't already, set up Sign-in method in your Firebase Project by enabling any of the Sign-in providers. For the purposes of this tutorial it doesn't matter which sign-in provider you choose.

To set up your Sign-in method, go to your Firebase Console and navigate to Authentication, under Develop. Go to the Sign-in method tab and set up your preferred sing-in method(s).

Deploy the Firebase function

This Firebase function will connect Firebase's and Virgil's authentication via JWT tokens.

  • Clone this repository

    git clone https://github.com/VirgilSecurity/virgil-e3kit-firebase-func.git
    cd virgil-e3kit-firebase-func
  • Install Firebase CLI if you haven't already.

    npm install -g firebase-tools
  • Start up the Firebase CLI

    firebase login
  • Connect this repository to your Firebase project

    firebase use --add
  • Select your firebase project from the list and press ENTER.

  • Type an alias for your project and press ENTER again.

  • Sign up for a free Virgil account

  • Get your Virgil application config file:

    • On a Dashboard: CREATE NEW APPLICATION -> choose ADD END-TO-END ENCRYPTION TO PRODUCT use case -> press the CREATE APPLICATION button -> press the GENERATE CONFIGURATION FILE button to generate a config file -> choose a name for your API Key -> press GENERATE.
    • Then click the DOWNLOAD THIS CONFIG button to download your config.json file
  • Copy config.json to this repository's root folder and run:

    cd functions
    npm run configure
    npm install
  • If npm install fails, make sure you have a compatible node version. See in Prerequisites.

  • Windows users only: In firebase.json rename $RESOURCE_DIR to %RESOURCE_DIR%

  • Deploy the Firebase function:

    npm run deploy
  • And finally, copy the function's URL to the clipboard: go back to the Firebase console -> Functions tab and take a note of your brand new function's url https://YOUR_FUNCTION_URL.cloudfunctions.net/api from the TRIGGER column. You'll need this when setting up your apps.

You can’t perform that action at this time.