A firebase functionfirebase functionCloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. that transfers the hashed encryption key for end-to-end encryptionEnd to end encryption in Fleeting NotesPrivacy and security are a big concern for many users. Especially with something as personal as note-taking this is doubly important. In a survey within my discord channel, for every person that wanted markdown support in Fleeting Notes, 7 people wanted end-to-end encryption. With such high demand for E2EE, I had no choice but to work hard to add this crucial feature into the application. end-to-end encryption discord poll Enabling E2EE in Fleeting Notes 1. Navigate to the settings in the Fle from firebase to supabase.

  1. The function takes supabase_user_id as an input
  2. The supabase_user is queried based on the supabase uid
  3. The firebase_user_id is extracted from the supabase_user
  4. encryption_key is queried from firebase using the firebase_user_id
  5. The supabase_user_id and the encryption_key are upserted into supabase
exports.transfer_encryption_key = functions.https.onRequest(async (req, res) => {
  const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_SERVICE_ROLE_KEY);

  // get firebaseUid from supabaseUid
  const supabaseUid = req.body.record?.id;
  const { data } = await supabase.auth.admin.getUserById(supabaseUid);
  const firebaseUid = data?.user?.user_metadata?.['firebaseUid']
  // get encryption key
  const ref = db.collection('encryption').doc(firebaseUid);
  const doc = await ref.get();
  const encryption_key =;

  // update supabase encryption_key
  const { error } = await supabase
      id: supabaseUid,
  return res.sendStatus(200);