Skip to content

Cloud function that runs in Firebase to authenticate IoT controller

Notifications You must be signed in to change notification settings

II1302-Group-3/iot-authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Green Garden IoT Authentication

Cloud function that runs in Firebase to authenticate IoT controller

How to use

  1. Install firebase-tools: npm install -g firebase-tools
  2. Run (cd functions && npm install)
  3. Deploy to Firebase with firebase deploy

Secrets

Every Green Garden IoT controller has a unique serial number that is visible to the user, but a way is needed to verify if the serial number was generated by the project group/product owner or not.

The file functions/src/secrets.ts contains two secret strings that are used by the owner to sign serial numbers:

  • PASSWORD: The password that unlocks SIGNING_KEY
  • SIGNING_KEY: This key is combined with the serial number in a hashed JSON object

Example: { serial: "X", signingKey: "Y" } becomes 1f16d2ed0944646e26359c96408bc8c151beb46f.

The combination of serial number and unique key for the backend works like an email and password does for the frontend. It gives the smart garden access to everything in the database under /garden/{serial}. This ensures that every garden can only access its own data instead of giving the IoT controller admin access to the whole database.

About

Cloud function that runs in Firebase to authenticate IoT controller

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published