From b7acc31d00822a69cf44e0952ab33d02ce7ea125 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 15:35:29 -0500 Subject: [PATCH 01/24] new branch + function fix --- client/src/components/Auth/AuthenticationResponse.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Auth/AuthenticationResponse.tsx b/client/src/components/Auth/AuthenticationResponse.tsx index e8751e7da..43b14fefc 100644 --- a/client/src/components/Auth/AuthenticationResponse.tsx +++ b/client/src/components/Auth/AuthenticationResponse.tsx @@ -51,7 +51,7 @@ const decodeCustomError = (error: CustomError) => { } //Function that handles the response depending on type -function handleResponse(response: AuthenticationResponse) { +const handleResponse = (response: AuthenticationResponse) => { if(response?.user) { return ""; } From 169993b581aecb769dc2683076dac7c7f5adcb94 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 16:13:16 -0500 Subject: [PATCH 02/24] small bug fixes --- .../Auth/AuthenticationResponse.tsx | 37 +++++++++---------- client/src/components/Auth/LoginScreen.tsx | 19 +++++++--- client/src/contexts/SocketContext.tsx | 4 +- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/client/src/components/Auth/AuthenticationResponse.tsx b/client/src/components/Auth/AuthenticationResponse.tsx index 43b14fefc..b0911c374 100644 --- a/client/src/components/Auth/AuthenticationResponse.tsx +++ b/client/src/components/Auth/AuthenticationResponse.tsx @@ -27,23 +27,20 @@ export const inValidEmailResponse = new CustomError("Invalid Email", "Please pro //Function that decodes the error code const decodeFirebaseError = (error: FirebaseError) => { - if(error.code === "auth/missing-email" || error.code === "auth/invalid-email") { - return "Please provide a valid email address"; + switch(error.code) { + case "auth/missing-email" || "auth/invalid-email": + return "Please provide a valid email address"; + case "auth/weak-password": + return "Password must be 6 characters or more"; + case "auth/missing-password": + return "Please provide a password"; + case "auth/invalid-credential": + return "The password or email is incorrect"; + case "auth/too-many-requests": + return "Too many requests, please try again later"; + default: + return "Unknown error"; } - - if(error.code === "auth/weak-password") { - return "Password must be 6 characters or more"; - } - - if(error.code === "auth/missing-password") { - return "Please provide a password"; - } - - if(error.code === "auth/invalid-credential") { - return "The password or email is incorrect"; - } - - return "Unknown error" } const decodeCustomError = (error: CustomError) => { @@ -52,22 +49,22 @@ const decodeCustomError = (error: CustomError) => { //Function that handles the response depending on type const handleResponse = (response: AuthenticationResponse) => { - if(response?.user) { + if(response?.user) { // If the user is not undefined return ""; } - if(response.error instanceof FirebaseError) { + if(response.error instanceof FirebaseError) { // If the error is a firebase error return decodeFirebaseError(response.error); } - if(response.error instanceof CustomError) { + if(response.error instanceof CustomError) { // If the error is a custom error return decodeCustomError(response.error); } return "Unknown error" } -//Something +// Authentication Message Component Props interface AuthenticationErrorMessageProps { response: AuthenticationResponse | undefined; onPress?: () => void; diff --git a/client/src/components/Auth/LoginScreen.tsx b/client/src/components/Auth/LoginScreen.tsx index 477af597c..13de78217 100644 --- a/client/src/components/Auth/LoginScreen.tsx +++ b/client/src/components/Auth/LoginScreen.tsx @@ -30,18 +30,22 @@ const LoginScreen = () => { const [invalidLogin, invalidateLogin] = React.useState(false); const onHandleSubmit = async () => { + Keyboard.dismiss(); setAuthResponse(await appSignIn(email, password)); + }; + + useEffect(() => { + setEmail(inputEmail?.toString() || ""); // On load of the page, set the email to the inputEmail if they entered it! + }, []); + + useEffect(() => { if (authResponse?.user) { router.replace("(home)/chatchannel"); } else if (authResponse?.error) { console.log(authResponse.error); invalidateLogin(true); } - }; - - useEffect(() => { - setEmail(inputEmail?.toString() || ""); // On load of the page, set the email to the inputEmail if they entered it! - }, []); + }, [authResponse]) if (!fontsLoaded && !fontError) { return null; @@ -76,7 +80,10 @@ const LoginScreen = () => { - setAuthResponse(undefined)} /> + { + setAuthResponse(undefined) + invalidateLogin(false) + }} /> diff --git a/client/src/contexts/SocketContext.tsx b/client/src/contexts/SocketContext.tsx index 73403a4b5..622b52eee 100644 --- a/client/src/contexts/SocketContext.tsx +++ b/client/src/contexts/SocketContext.tsx @@ -17,7 +17,7 @@ export const SocketProvider = ({ children }: { children: React.ReactNode }) => { useEffect(() => { let isMounted = true; - const socketIo = io(`http://${EXPO_IP}:8080`); // Hardcoded IP address + const socketIo = io(`http://${ EXPO_IP }:8080`); // Hardcoded IP address socketIo.on("connect", () => { if (isMounted) { @@ -33,7 +33,7 @@ export const SocketProvider = ({ children }: { children: React.ReactNode }) => { return () => { isMounted = false; - socket?.disconnect(); + socketIo.disconnect(); }; }, []); From f57004f0593b1ef5ebd5579d722e17383514a1c1 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 16:14:49 -0500 Subject: [PATCH 03/24] fixes pt2 --- client/src/contexts/SocketContext.tsx | 1 - client/src/services/store.ts | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/client/src/contexts/SocketContext.tsx b/client/src/contexts/SocketContext.tsx index 622b52eee..e8428e91e 100644 --- a/client/src/contexts/SocketContext.tsx +++ b/client/src/contexts/SocketContext.tsx @@ -1,6 +1,5 @@ import React, { createContext, useContext, useEffect, useState } from "react"; import { io, Socket } from "socket.io-client"; -import * as Network from "expo-network"; import { useLocation } from "./LocationContext"; import { EXPO_IP } from "@env"; diff --git a/client/src/services/store.ts b/client/src/services/store.ts index f748dd7d7..817d338e1 100644 --- a/client/src/services/store.ts +++ b/client/src/services/store.ts @@ -1,7 +1,6 @@ import { User, createUserWithEmailAndPassword, onAuthStateChanged, signInWithEmailAndPassword, signOut } from 'firebase/auth' import { Store } from 'pullstate' -import { auth, app } from '../configs/firebaseConfig' -import { FirebaseError } from 'firebase/app'; +import { auth} from '../configs/firebaseConfig' interface AuthStoreInterface { isLoggedin: boolean, From 311db936fd43b6d32913d4f53131ecdd190f2c40 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 16:37:36 -0500 Subject: [PATCH 04/24] JWT WIP --- client/src/contexts/LocationContext.tsx | 2 +- client/src/contexts/SocketContext.tsx | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/contexts/LocationContext.tsx b/client/src/contexts/LocationContext.tsx index 4b219b3ed..3579e2266 100644 --- a/client/src/contexts/LocationContext.tsx +++ b/client/src/contexts/LocationContext.tsx @@ -60,7 +60,7 @@ export const LocationProvider = ({ } catch (error) { console.error("Error fetching location:", error); } - }, LOCATION_REFRESH_RATE); // Fetch location every 3 seconds + }, Number(LOCATION_REFRESH_RATE)); // Fetch location every 3 seconds // Cleanup function to clear interval when component unmounts return () => clearInterval(interval); diff --git a/client/src/contexts/SocketContext.tsx b/client/src/contexts/SocketContext.tsx index e8428e91e..ea665827f 100644 --- a/client/src/contexts/SocketContext.tsx +++ b/client/src/contexts/SocketContext.tsx @@ -16,7 +16,11 @@ export const SocketProvider = ({ children }: { children: React.ReactNode }) => { useEffect(() => { let isMounted = true; - const socketIo = io(`http://${ EXPO_IP }:8080`); // Hardcoded IP address + const socketIo = io(`http://${ EXPO_IP }:8080`, { + auth: { + token: "poop", + } + }); // Hardcoded IP address socketIo.on("connect", () => { if (isMounted) { From 3bc3166c4e1c52dfda59c12c5296f8826e840ab7 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 15:35:29 -0500 Subject: [PATCH 05/24] new branch + function fix --- client/src/components/Auth/AuthenticationResponse.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Auth/AuthenticationResponse.tsx b/client/src/components/Auth/AuthenticationResponse.tsx index 4e5a6c8a5..d84f0e36a 100644 --- a/client/src/components/Auth/AuthenticationResponse.tsx +++ b/client/src/components/Auth/AuthenticationResponse.tsx @@ -51,7 +51,7 @@ const decodeCustomError = (error: CustomError) => { } //Function that handles the response depending on type -function handleResponse(response: AuthenticationResponse) { +const handleResponse = (response: AuthenticationResponse) => { if(response?.user) { return ""; } From 9b93ee77b332885b27bb38a25425ceeb25d5e21e Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 16:13:16 -0500 Subject: [PATCH 06/24] small bug fixes --- .../Auth/AuthenticationResponse.tsx | 96 ++++++++++--------- client/src/components/Auth/LoginScreen.tsx | 19 ++-- client/src/contexts/SocketContext.tsx | 4 +- 3 files changed, 64 insertions(+), 55 deletions(-) diff --git a/client/src/components/Auth/AuthenticationResponse.tsx b/client/src/components/Auth/AuthenticationResponse.tsx index d84f0e36a..077790681 100644 --- a/client/src/components/Auth/AuthenticationResponse.tsx +++ b/client/src/components/Auth/AuthenticationResponse.tsx @@ -1,16 +1,18 @@ import React from "react"; -import { StyleSheet, Text, Dimensions, TouchableOpacity} from "react-native"; +import { StyleSheet, Text, Dimensions, TouchableOpacity } from "react-native"; import { FirebaseError } from "firebase/app"; import { User } from "firebase/auth"; //Type to handle Authentication Responses from firebase -export type AuthenticationResponse = { - user: User | null; - error?: undefined; -} | { - user?: undefined; - error: unknown; -} +export type AuthenticationResponse = + | { + user: User | null; + error?: undefined; + } + | { + user?: undefined; + error: unknown; + }; export class CustomError { public code: string; @@ -23,79 +25,80 @@ export class CustomError { } //Custom responses -export const inValidEmailResponse = new CustomError("Invalid Email", "Please provide a valid email address") +export const inValidEmailResponse = new CustomError( + "Invalid Email", + "Please provide a valid email address" +); //Function that decodes the error code const decodeFirebaseError = (error: FirebaseError) => { - if(error.code === "auth/missing-email" || error.code === "auth/invalid-email") { - return "Please provide a valid email address"; - } - - if(error.code === "auth/weak-password") { - return "Password must be 6 characters or more"; - } - - if(error.code === "auth/missing-password") { - return "Please provide a password"; + switch (error.code) { + case "auth/missing-email" || "auth/invalid-email": + return "Please provide a valid email address"; + case "auth/weak-password": + return "Password must be 6 characters or more"; + case "auth/missing-password": + return "Please provide a password"; + case "auth/invalid-credential": + return "The password or email is incorrect"; + case "auth/too-many-requests": + return "Too many requests, please try again later"; + default: + return "Unknown error"; } - - if(error.code === "auth/invalid-credential") { - return "The password or email is incorrect"; - } - - return "Unknown error" -} +}; const decodeCustomError = (error: CustomError) => { return error.message; -} +}; //Function that handles the response depending on type const handleResponse = (response: AuthenticationResponse) => { - if(response?.user) { + if (response?.user) { + // If the user is not undefined return ""; } - console.log(response.error) - - if(response.error instanceof FirebaseError) { + if (response.error instanceof FirebaseError) { return decodeFirebaseError(response.error); } - if(response.error instanceof CustomError) { + if (response.error instanceof CustomError) { + // If the error is a custom error return decodeCustomError(response.error); } - return "Unknown error" -} + return "Unknown error"; +}; -//Something +// Authentication Message Component Props interface AuthenticationErrorMessageProps { response: AuthenticationResponse | undefined; onPress?: () => void; } -export const AuthenticationErrorMessage: React.FC = ({ response, onPress }) => { - if( response === undefined ) { +export const AuthenticationErrorMessage: React.FC< + AuthenticationErrorMessageProps +> = ({ response, onPress }) => { + if (response === undefined) { return null; } - const errorMessage = handleResponse(response) + const errorMessage = handleResponse(response); return ( - errorMessage && - + errorMessage && ( + {errorMessage} - + + ) ); -} - +}; const styles = StyleSheet.create({ error_text: { color: "white", fontSize: Dimensions.get("window").height * 0.02, - }, error_container: { display: "flex", @@ -106,7 +109,6 @@ const styles = StyleSheet.create({ marginTop: Dimensions.get("window").height * 0.005, width: Dimensions.get("window").width * 0.8, borderRadius: 10, - padding: 10 - } + padding: 10, + }, }); - diff --git a/client/src/components/Auth/LoginScreen.tsx b/client/src/components/Auth/LoginScreen.tsx index 477af597c..13de78217 100644 --- a/client/src/components/Auth/LoginScreen.tsx +++ b/client/src/components/Auth/LoginScreen.tsx @@ -30,18 +30,22 @@ const LoginScreen = () => { const [invalidLogin, invalidateLogin] = React.useState(false); const onHandleSubmit = async () => { + Keyboard.dismiss(); setAuthResponse(await appSignIn(email, password)); + }; + + useEffect(() => { + setEmail(inputEmail?.toString() || ""); // On load of the page, set the email to the inputEmail if they entered it! + }, []); + + useEffect(() => { if (authResponse?.user) { router.replace("(home)/chatchannel"); } else if (authResponse?.error) { console.log(authResponse.error); invalidateLogin(true); } - }; - - useEffect(() => { - setEmail(inputEmail?.toString() || ""); // On load of the page, set the email to the inputEmail if they entered it! - }, []); + }, [authResponse]) if (!fontsLoaded && !fontError) { return null; @@ -76,7 +80,10 @@ const LoginScreen = () => { - setAuthResponse(undefined)} /> + { + setAuthResponse(undefined) + invalidateLogin(false) + }} /> diff --git a/client/src/contexts/SocketContext.tsx b/client/src/contexts/SocketContext.tsx index 73403a4b5..622b52eee 100644 --- a/client/src/contexts/SocketContext.tsx +++ b/client/src/contexts/SocketContext.tsx @@ -17,7 +17,7 @@ export const SocketProvider = ({ children }: { children: React.ReactNode }) => { useEffect(() => { let isMounted = true; - const socketIo = io(`http://${EXPO_IP}:8080`); // Hardcoded IP address + const socketIo = io(`http://${ EXPO_IP }:8080`); // Hardcoded IP address socketIo.on("connect", () => { if (isMounted) { @@ -33,7 +33,7 @@ export const SocketProvider = ({ children }: { children: React.ReactNode }) => { return () => { isMounted = false; - socket?.disconnect(); + socketIo.disconnect(); }; }, []); From 415723be2e30ad5353114a0b4be7555325739a75 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 16:14:49 -0500 Subject: [PATCH 07/24] fixes pt2 --- client/src/contexts/SocketContext.tsx | 1 - client/src/services/store.ts | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/client/src/contexts/SocketContext.tsx b/client/src/contexts/SocketContext.tsx index 622b52eee..e8428e91e 100644 --- a/client/src/contexts/SocketContext.tsx +++ b/client/src/contexts/SocketContext.tsx @@ -1,6 +1,5 @@ import React, { createContext, useContext, useEffect, useState } from "react"; import { io, Socket } from "socket.io-client"; -import * as Network from "expo-network"; import { useLocation } from "./LocationContext"; import { EXPO_IP } from "@env"; diff --git a/client/src/services/store.ts b/client/src/services/store.ts index f748dd7d7..817d338e1 100644 --- a/client/src/services/store.ts +++ b/client/src/services/store.ts @@ -1,7 +1,6 @@ import { User, createUserWithEmailAndPassword, onAuthStateChanged, signInWithEmailAndPassword, signOut } from 'firebase/auth' import { Store } from 'pullstate' -import { auth, app } from '../configs/firebaseConfig' -import { FirebaseError } from 'firebase/app'; +import { auth} from '../configs/firebaseConfig' interface AuthStoreInterface { isLoggedin: boolean, From 086c8d0064aea0cea8f428ded8a648c685f4639d Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 16:37:36 -0500 Subject: [PATCH 08/24] JWT WIP --- client/src/contexts/LocationContext.tsx | 2 +- client/src/contexts/SocketContext.tsx | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/contexts/LocationContext.tsx b/client/src/contexts/LocationContext.tsx index 4b219b3ed..3579e2266 100644 --- a/client/src/contexts/LocationContext.tsx +++ b/client/src/contexts/LocationContext.tsx @@ -60,7 +60,7 @@ export const LocationProvider = ({ } catch (error) { console.error("Error fetching location:", error); } - }, LOCATION_REFRESH_RATE); // Fetch location every 3 seconds + }, Number(LOCATION_REFRESH_RATE)); // Fetch location every 3 seconds // Cleanup function to clear interval when component unmounts return () => clearInterval(interval); diff --git a/client/src/contexts/SocketContext.tsx b/client/src/contexts/SocketContext.tsx index e8428e91e..ea665827f 100644 --- a/client/src/contexts/SocketContext.tsx +++ b/client/src/contexts/SocketContext.tsx @@ -16,7 +16,11 @@ export const SocketProvider = ({ children }: { children: React.ReactNode }) => { useEffect(() => { let isMounted = true; - const socketIo = io(`http://${ EXPO_IP }:8080`); // Hardcoded IP address + const socketIo = io(`http://${ EXPO_IP }:8080`, { + auth: { + token: "poop", + } + }); // Hardcoded IP address socketIo.on("connect", () => { if (isMounted) { From 0c89eb7dc9046723399e8443de6b0dfabc47b530 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 15:35:29 -0500 Subject: [PATCH 09/24] new branch + function fix --- client/src/components/Auth/AuthenticationResponse.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Auth/AuthenticationResponse.tsx b/client/src/components/Auth/AuthenticationResponse.tsx index cb74702f5..bfb0291c7 100644 --- a/client/src/components/Auth/AuthenticationResponse.tsx +++ b/client/src/components/Auth/AuthenticationResponse.tsx @@ -51,7 +51,7 @@ const decodeCustomError = (error: CustomError) => { } //Function that handles the response depending on type -function handleResponse(response: AuthenticationResponse) { +const handleResponse = (response: AuthenticationResponse) => { if(response?.user) { return ""; } From 47629e74925ac77eb65e8ac3377ac2ce605c2d9d Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 16:13:16 -0500 Subject: [PATCH 10/24] small bug fixes --- .../Auth/AuthenticationResponse.tsx | 96 ++++++++++--------- client/src/components/Auth/LoginScreen.tsx | 19 ++-- client/src/contexts/SocketContext.tsx | 4 +- 3 files changed, 64 insertions(+), 55 deletions(-) diff --git a/client/src/components/Auth/AuthenticationResponse.tsx b/client/src/components/Auth/AuthenticationResponse.tsx index bfb0291c7..187011aa6 100644 --- a/client/src/components/Auth/AuthenticationResponse.tsx +++ b/client/src/components/Auth/AuthenticationResponse.tsx @@ -1,16 +1,18 @@ import React from "react"; -import { StyleSheet, Text, Dimensions, TouchableOpacity} from "react-native"; +import { StyleSheet, Text, Dimensions, TouchableOpacity } from "react-native"; import { FirebaseError } from "firebase/app"; import { User } from "firebase/auth"; //Type to handle Authentication Responses from firebase -export type AuthenticationResponse = { - user: User | null; - error?: undefined; -} | { - user?: undefined; - error: unknown; -} +export type AuthenticationResponse = + | { + user: User | null; + error?: undefined; + } + | { + user?: undefined; + error: unknown; + }; export class CustomError { public code: string; @@ -23,79 +25,80 @@ export class CustomError { } //Custom responses -export const inValidEmailResponse = new CustomError("Invalid Email", "Please provide a valid email address") +export const inValidEmailResponse = new CustomError( + "Invalid Email", + "Please provide a valid email address" +); //Function that decodes the error code const decodeFirebaseError = (error: FirebaseError) => { - if(error.code === "auth/missing-email" || error.code === "auth/invalid-email") { - return "Please provide a valid email address"; - } - - if(error.code === "auth/weak-password") { - return "Password must be 6 characters or more"; - } - - if(error.code === "auth/missing-password") { - return "Please provide a password"; + switch (error.code) { + case "auth/missing-email" || "auth/invalid-email": + return "Please provide a valid email address"; + case "auth/weak-password": + return "Password must be 6 characters or more"; + case "auth/missing-password": + return "Please provide a password"; + case "auth/invalid-credential": + return "The password or email is incorrect"; + case "auth/too-many-requests": + return "Too many requests, please try again later"; + default: + return "Unknown error"; } - - if(error.code === "auth/invalid-credential") { - return "The password or email is incorrect"; - } - - return "Unknown error" -} +}; const decodeCustomError = (error: CustomError) => { return error.message; -} +}; //Function that handles the response depending on type const handleResponse = (response: AuthenticationResponse) => { - if(response?.user) { + if (response?.user) { + // If the user is not undefined return ""; } - console.log(response.error) - - if(response.error instanceof FirebaseError) { + if (response.error instanceof FirebaseError) { return decodeFirebaseError(response.error); } - if(response.error instanceof CustomError) { + if (response.error instanceof CustomError) { + // If the error is a custom error return decodeCustomError(response.error); } - return "Unknown error" -} + return "Unknown error"; +}; -//Something +// Authentication Message Component Props interface AuthenticationErrorMessageProps { response: AuthenticationResponse | undefined; onPress?: () => void; } -export const AuthenticationErrorMessage: React.FC = ({ response, onPress }) => { - if( response === undefined ) { +export const AuthenticationErrorMessage: React.FC< + AuthenticationErrorMessageProps +> = ({ response, onPress }) => { + if (response === undefined) { return null; } - const errorMessage = handleResponse(response) + const errorMessage = handleResponse(response); return ( - errorMessage && - + errorMessage && ( + {errorMessage} - + + ) ); -} - +}; const styles = StyleSheet.create({ error_text: { color: "white", fontSize: Dimensions.get("window").height * 0.02, - }, error_container: { display: "flex", @@ -106,7 +109,6 @@ const styles = StyleSheet.create({ marginTop: Dimensions.get("window").height * 0.005, width: Dimensions.get("window").width * 0.9, borderRadius: 10, - padding: 10 - } + padding: 10, + }, }); - diff --git a/client/src/components/Auth/LoginScreen.tsx b/client/src/components/Auth/LoginScreen.tsx index 477af597c..13de78217 100644 --- a/client/src/components/Auth/LoginScreen.tsx +++ b/client/src/components/Auth/LoginScreen.tsx @@ -30,18 +30,22 @@ const LoginScreen = () => { const [invalidLogin, invalidateLogin] = React.useState(false); const onHandleSubmit = async () => { + Keyboard.dismiss(); setAuthResponse(await appSignIn(email, password)); + }; + + useEffect(() => { + setEmail(inputEmail?.toString() || ""); // On load of the page, set the email to the inputEmail if they entered it! + }, []); + + useEffect(() => { if (authResponse?.user) { router.replace("(home)/chatchannel"); } else if (authResponse?.error) { console.log(authResponse.error); invalidateLogin(true); } - }; - - useEffect(() => { - setEmail(inputEmail?.toString() || ""); // On load of the page, set the email to the inputEmail if they entered it! - }, []); + }, [authResponse]) if (!fontsLoaded && !fontError) { return null; @@ -76,7 +80,10 @@ const LoginScreen = () => { - setAuthResponse(undefined)} /> + { + setAuthResponse(undefined) + invalidateLogin(false) + }} /> diff --git a/client/src/contexts/SocketContext.tsx b/client/src/contexts/SocketContext.tsx index 118035845..f38c95557 100644 --- a/client/src/contexts/SocketContext.tsx +++ b/client/src/contexts/SocketContext.tsx @@ -17,7 +17,7 @@ export const SocketProvider = ({ children }: { children: React.ReactNode }) => { useEffect(() => { let isMounted = true; - const socketIo = io(`http://${EXPO_IP}:8080`); // Hardcoded IP address + const socketIo = io(`http://${ EXPO_IP }:8080`); // Hardcoded IP address socketIo.on("connect", () => { if (isMounted) { @@ -34,7 +34,7 @@ export const SocketProvider = ({ children }: { children: React.ReactNode }) => { return () => { isMounted = false; - socket?.disconnect(); + socketIo.disconnect(); }; }, []); From 206b5bfc11298fee30215781e7f9c1779f48f987 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 16:14:49 -0500 Subject: [PATCH 11/24] fixes pt2 --- client/src/contexts/SocketContext.tsx | 1 - client/src/services/store.ts | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/client/src/contexts/SocketContext.tsx b/client/src/contexts/SocketContext.tsx index f38c95557..3ecdb1521 100644 --- a/client/src/contexts/SocketContext.tsx +++ b/client/src/contexts/SocketContext.tsx @@ -1,6 +1,5 @@ import React, { createContext, useContext, useEffect, useState } from "react"; import { io, Socket } from "socket.io-client"; -import * as Network from "expo-network"; import { useLocation } from "./LocationContext"; import { EXPO_IP } from "@env"; diff --git a/client/src/services/store.ts b/client/src/services/store.ts index f748dd7d7..817d338e1 100644 --- a/client/src/services/store.ts +++ b/client/src/services/store.ts @@ -1,7 +1,6 @@ import { User, createUserWithEmailAndPassword, onAuthStateChanged, signInWithEmailAndPassword, signOut } from 'firebase/auth' import { Store } from 'pullstate' -import { auth, app } from '../configs/firebaseConfig' -import { FirebaseError } from 'firebase/app'; +import { auth} from '../configs/firebaseConfig' interface AuthStoreInterface { isLoggedin: boolean, From 6dbcf445b97df33e6e7e1c311ccab2aecea174bc Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 16:37:36 -0500 Subject: [PATCH 12/24] JWT WIP --- client/src/contexts/LocationContext.tsx | 6 +++--- client/src/contexts/SocketContext.tsx | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/src/contexts/LocationContext.tsx b/client/src/contexts/LocationContext.tsx index 95150db64..6c571c9a8 100644 --- a/client/src/contexts/LocationContext.tsx +++ b/client/src/contexts/LocationContext.tsx @@ -17,9 +17,9 @@ const LocationContext = createContext(null); const getLocation = async () => { return await Location.getCurrentPositionAsync({ - accuracy: Location.Accuracy.Balanced + accuracy: Location.Accuracy.Balanced, }); // Change accuracy while testing. Could become .env variable. -} +}; export const useLocation = () => { return useContext(LocationContext); @@ -66,7 +66,7 @@ export const LocationProvider = ({ } catch (error) { console.error("Error fetching location:", error); } - }, Number(LOCATION_REFRESH_RATE)); // Send location every few seconds + }, Number(LOCATION_REFRESH_RATE)); // Fetch location every 3 seconds // Cleanup function to clear interval when component unmounts return () => clearInterval(interval); diff --git a/client/src/contexts/SocketContext.tsx b/client/src/contexts/SocketContext.tsx index 3ecdb1521..db26c2b51 100644 --- a/client/src/contexts/SocketContext.tsx +++ b/client/src/contexts/SocketContext.tsx @@ -16,7 +16,11 @@ export const SocketProvider = ({ children }: { children: React.ReactNode }) => { useEffect(() => { let isMounted = true; - const socketIo = io(`http://${ EXPO_IP }:8080`); // Hardcoded IP address + const socketIo = io(`http://${ EXPO_IP }:8080`, { + auth: { + token: "poop", + } + }); // Hardcoded IP address socketIo.on("connect", () => { if (isMounted) { From 1f0526077e508d5b2a8cb1a7b0b65c742edff0b2 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 15:35:29 -0500 Subject: [PATCH 13/24] new branch + function fix --- client/src/components/Auth/AuthenticationResponse.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/components/Auth/AuthenticationResponse.tsx b/client/src/components/Auth/AuthenticationResponse.tsx index 187011aa6..2e2371138 100644 --- a/client/src/components/Auth/AuthenticationResponse.tsx +++ b/client/src/components/Auth/AuthenticationResponse.tsx @@ -55,7 +55,6 @@ const decodeCustomError = (error: CustomError) => { //Function that handles the response depending on type const handleResponse = (response: AuthenticationResponse) => { if (response?.user) { - // If the user is not undefined return ""; } From 7c6237dde673a3b19ffe918951f1cb86ac39ae85 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 13 Feb 2024 16:13:16 -0500 Subject: [PATCH 14/24] small bug fixes --- client/src/components/Auth/AuthenticationResponse.tsx | 4 +++- client/src/contexts/SocketContext.tsx | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/components/Auth/AuthenticationResponse.tsx b/client/src/components/Auth/AuthenticationResponse.tsx index 2e2371138..081a12640 100644 --- a/client/src/components/Auth/AuthenticationResponse.tsx +++ b/client/src/components/Auth/AuthenticationResponse.tsx @@ -55,13 +55,15 @@ const decodeCustomError = (error: CustomError) => { //Function that handles the response depending on type const handleResponse = (response: AuthenticationResponse) => { if (response?.user) { + // If the user is not undefined return ""; } if (response.error instanceof FirebaseError) { + // If the error is a firebase error return decodeFirebaseError(response.error); } - + // If the error is a custom error if (response.error instanceof CustomError) { // If the error is a custom error return decodeCustomError(response.error); diff --git a/client/src/contexts/SocketContext.tsx b/client/src/contexts/SocketContext.tsx index db26c2b51..e755a92f5 100644 --- a/client/src/contexts/SocketContext.tsx +++ b/client/src/contexts/SocketContext.tsx @@ -16,10 +16,10 @@ export const SocketProvider = ({ children }: { children: React.ReactNode }) => { useEffect(() => { let isMounted = true; - const socketIo = io(`http://${ EXPO_IP }:8080`, { + const socketIo = io(`http://${EXPO_IP}:8080`, { auth: { token: "poop", - } + }, }); // Hardcoded IP address socketIo.on("connect", () => { From 293ef4e40666940d16ea42393eddd1ccd3c47512 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Fri, 16 Feb 2024 20:59:17 -0500 Subject: [PATCH 15/24] added passport --- server/package-lock.json | 159 +++++++++++++++++++++++++++++++++++++++ server/package.json | 2 + server/src/index.ts | 4 + 3 files changed, 165 insertions(+) diff --git a/server/package-lock.json b/server/package-lock.json index 52a5aafd3..819318375 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -15,6 +15,8 @@ "express": "^4.18.2", "firebase": "^10.5.0", "geofire-common": "^6.0.0", + "passport": "^0.7.0", + "passport-jwt": "^4.0.1", "socket.io": "^4.7.4", "uuid": "^9.0.1" }, @@ -3808,6 +3810,11 @@ "node-int64": "^0.4.0" } }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -4299,6 +4306,14 @@ "url": "https://dotenvx.com" } }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -6877,6 +6892,76 @@ "node": ">=6" } }, + "node_modules/jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "dependencies": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jsonwebtoken/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jsonwebtoken/node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jsonwebtoken/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -6924,6 +7009,41 @@ "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", "dev": true }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" + }, "node_modules/long": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", @@ -7348,6 +7468,40 @@ "node": ">= 0.8" } }, + "node_modules/passport": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/passport/-/passport-0.7.0.tgz", + "integrity": "sha512-cPLl+qZpSc+ireUvt+IzqbED1cHHkDoVYMo30jbJIdOOjQ1MQYZBPiNvmi8UM6lJuOpTPXJGZQk0DtC4y61MYQ==", + "dependencies": { + "passport-strategy": "1.x.x", + "pause": "0.0.1", + "utils-merge": "^1.0.1" + }, + "engines": { + "node": ">= 0.4.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/jaredhanson" + } + }, + "node_modules/passport-jwt": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/passport-jwt/-/passport-jwt-4.0.1.tgz", + "integrity": "sha512-UCKMDYhNuGOBE9/9Ycuoyh7vP6jpeTp/+sfMJl7nLff/t6dps+iaeE0hhNkKN8/HZHcJ7lCdOyDxHdDoxoSvdQ==", + "dependencies": { + "jsonwebtoken": "^9.0.0", + "passport-strategy": "^1.0.0" + } + }, + "node_modules/passport-strategy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz", + "integrity": "sha512-CB97UUvDKJde2V0KDWWB3lyf6PC3FaZP7YxZ2G8OAtn9p4HI9j9JLP9qjOGZFvyl8uwNT8qM+hGnz/n16NI7oA==", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -7386,6 +7540,11 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, + "node_modules/pause": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", + "integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg==" + }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", diff --git a/server/package.json b/server/package.json index c4dfdf3d6..bcabe0ad6 100644 --- a/server/package.json +++ b/server/package.json @@ -30,6 +30,8 @@ "express": "^4.18.2", "firebase": "^10.5.0", "geofire-common": "^6.0.0", + "passport": "^0.7.0", + "passport-jwt": "^4.0.1", "socket.io": "^4.7.4", "uuid": "^9.0.1" }, diff --git a/server/src/index.ts b/server/src/index.ts index 69e9b98f6..0a2d287cc 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -16,6 +16,10 @@ import { ConnectedUser } from './types/User'; const { createServer } = require('http') const { Server } = require('socket.io') +const passport = require('passport') +const JWTStrategy = require('passport-jwt').Strategy +const ExtractJWT = require('passport-jwt').ExtractJwt + const socket_port = process.env.socket_port const express_port = process.env.express_port From 9a11d56dcce87e6db6cf83c7212b70a6a6a9fca5 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Fri, 16 Feb 2024 23:29:36 -0500 Subject: [PATCH 16/24] started auth + admin sdk --- client/package-lock.json | 153 ++-- client/src/components/Auth/LoginScreen.tsx | 12 +- client/src/configs/firebaseConfig.ts | 8 +- client/src/contexts/SocketContext.tsx | 13 +- client/src/services/store.ts | 4 +- server/.gitignore | 3 + server/package-lock.json | 819 ++++++++++++++++++++- server/package.json | 1 + server/src/index.ts | 16 + server/src/tests/socketio.test.ts | 2 +- server/src/utilities/adminInit.ts | 9 + 11 files changed, 920 insertions(+), 120 deletions(-) create mode 100644 server/src/utilities/adminInit.ts diff --git a/client/package-lock.json b/client/package-lock.json index 720fd9652..853ac67d0 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -28,7 +28,7 @@ "firebase": "^10.7.2", "pullstate": "^1.25.0", "react": "18.2.0", - "react-native": "0.72.10", + "react-native": "0.72.6", "react-native-dotenv": "^3.4.9", "react-native-fs": "^2.20.0", "react-native-safe-area-context": "4.6.3", @@ -4641,19 +4641,19 @@ } }, "node_modules/@react-native-community/cli": { - "version": "11.3.10", - "resolved": "https://registry.npmjs.org/@react-native-community/cli/-/cli-11.3.10.tgz", - "integrity": "sha512-bIx0t5s9ewH1PlcEcuQUD+UnVrCjPGAfjhVR5Gew565X60nE+GTIHRn70nMv9G4he/amBF+Z+vf5t8SNZEWMwg==", - "dependencies": { - "@react-native-community/cli-clean": "11.3.10", - "@react-native-community/cli-config": "11.3.10", - "@react-native-community/cli-debugger-ui": "11.3.10", - "@react-native-community/cli-doctor": "11.3.10", - "@react-native-community/cli-hermes": "11.3.10", - "@react-native-community/cli-plugin-metro": "11.3.10", - "@react-native-community/cli-server-api": "11.3.10", - "@react-native-community/cli-tools": "11.3.10", - "@react-native-community/cli-types": "11.3.10", + "version": "11.3.7", + "resolved": "https://registry.npmjs.org/@react-native-community/cli/-/cli-11.3.7.tgz", + "integrity": "sha512-Ou8eDlF+yh2rzXeCTpMPYJ2fuqsusNOhmpYPYNQJQ2h6PvaF30kPomflgRILems+EBBuggRtcT+I+1YH4o/q6w==", + "dependencies": { + "@react-native-community/cli-clean": "11.3.7", + "@react-native-community/cli-config": "11.3.7", + "@react-native-community/cli-debugger-ui": "11.3.7", + "@react-native-community/cli-doctor": "11.3.7", + "@react-native-community/cli-hermes": "11.3.7", + "@react-native-community/cli-plugin-metro": "11.3.7", + "@react-native-community/cli-server-api": "11.3.7", + "@react-native-community/cli-tools": "11.3.7", + "@react-native-community/cli-types": "11.3.7", "chalk": "^4.1.2", "commander": "^9.4.1", "execa": "^5.0.0", @@ -4671,11 +4671,11 @@ } }, "node_modules/@react-native-community/cli-clean": { - "version": "11.3.10", - "resolved": "https://registry.npmjs.org/@react-native-community/cli-clean/-/cli-clean-11.3.10.tgz", - "integrity": "sha512-g6QjW+DSqoWRHzmIQW3AH22k1AnynWuOdy2YPwYEGgPddTeXZtJphIpEVwDOiC0L4mZv2VmiX33/cGNUwO0cIA==", + "version": "11.3.7", + "resolved": "https://registry.npmjs.org/@react-native-community/cli-clean/-/cli-clean-11.3.7.tgz", + "integrity": "sha512-twtsv54ohcRyWVzPXL3F9VHGb4Qhn3slqqRs3wEuRzjR7cTmV2TIO2b1VhaqF4HlCgNd+cGuirvLtK2JJyaxMg==", "dependencies": { - "@react-native-community/cli-tools": "11.3.10", + "@react-native-community/cli-tools": "11.3.7", "chalk": "^4.1.2", "execa": "^5.0.0", "prompts": "^2.4.0" @@ -4877,11 +4877,11 @@ } }, "node_modules/@react-native-community/cli-config": { - "version": "11.3.10", - "resolved": "https://registry.npmjs.org/@react-native-community/cli-config/-/cli-config-11.3.10.tgz", - "integrity": "sha512-YYu14nm1JYLS6mDRBz78+zDdSFudLBFpPkhkOoj4LuBhNForQBIqFFHzQbd9/gcguJxfW3vlYSnudfaUI7oGLg==", + "version": "11.3.7", + "resolved": "https://registry.npmjs.org/@react-native-community/cli-config/-/cli-config-11.3.7.tgz", + "integrity": "sha512-FDBLku9xskS+bx0YFJFLCmUJhEZ4/MMSC9qPYOGBollWYdgE7k/TWI0IeYFmMALAnbCdKQAYP5N29N55Tad8lg==", "dependencies": { - "@react-native-community/cli-tools": "11.3.10", + "@react-native-community/cli-tools": "11.3.7", "chalk": "^4.1.2", "cosmiconfig": "^5.1.0", "deepmerge": "^4.3.0", @@ -4954,22 +4954,22 @@ } }, "node_modules/@react-native-community/cli-debugger-ui": { - "version": "11.3.10", - "resolved": "https://registry.npmjs.org/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-11.3.10.tgz", - "integrity": "sha512-kyitGV3RsjlXIioq9lsuawha2GUBPCTAyXV6EBlm3qlyF3dMniB3twEvz+fIOid/e1ZeucH3Tzy5G3qcP8yWoA==", + "version": "11.3.7", + "resolved": "https://registry.npmjs.org/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-11.3.7.tgz", + "integrity": "sha512-aVmKuPKHZENR8SrflkMurZqeyLwbKieHdOvaZCh1Nn/0UC5CxWcyST2DB2XQboZwsvr3/WXKJkSUO+SZ1J9qTQ==", "dependencies": { "serve-static": "^1.13.1" } }, "node_modules/@react-native-community/cli-doctor": { - "version": "11.3.10", - "resolved": "https://registry.npmjs.org/@react-native-community/cli-doctor/-/cli-doctor-11.3.10.tgz", - "integrity": "sha512-DpMsfCWKZ15L9nFK/SyDvpl5v6MjV+arMHMC1i8kR+DOmf2xWmp/pgMywKk0/u50yGB9GwxBHt3i/S/IMK5Ylg==", - "dependencies": { - "@react-native-community/cli-config": "11.3.10", - "@react-native-community/cli-platform-android": "11.3.10", - "@react-native-community/cli-platform-ios": "11.3.10", - "@react-native-community/cli-tools": "11.3.10", + "version": "11.3.7", + "resolved": "https://registry.npmjs.org/@react-native-community/cli-doctor/-/cli-doctor-11.3.7.tgz", + "integrity": "sha512-YEHUqWISOHnsl5+NM14KHelKh68Sr5/HeEZvvNdIcvcKtZic3FU7Xd1WcbNdo3gCq5JvzGFfufx02Tabh5zmrg==", + "dependencies": { + "@react-native-community/cli-config": "11.3.7", + "@react-native-community/cli-platform-android": "11.3.7", + "@react-native-community/cli-platform-ios": "11.3.7", + "@react-native-community/cli-tools": "11.3.7", "chalk": "^4.1.2", "command-exists": "^1.2.8", "envinfo": "^7.7.2", @@ -5315,12 +5315,12 @@ } }, "node_modules/@react-native-community/cli-hermes": { - "version": "11.3.10", - "resolved": "https://registry.npmjs.org/@react-native-community/cli-hermes/-/cli-hermes-11.3.10.tgz", - "integrity": "sha512-vqINuzAlcHS9ImNwJtT43N7kfBQ7ro9A8O1Gpc5TQ0A8V36yGG8eoCHeauayklVVgMZpZL6f6mcoLLr9IOgBZQ==", + "version": "11.3.7", + "resolved": "https://registry.npmjs.org/@react-native-community/cli-hermes/-/cli-hermes-11.3.7.tgz", + "integrity": "sha512-chkKd8n/xeZkinRvtH6QcYA8rjNOKU3S3Lw/3Psxgx+hAYV0Gyk95qJHTalx7iu+PwjOOqqvCkJo5jCkYLkoqw==", "dependencies": { - "@react-native-community/cli-platform-android": "11.3.10", - "@react-native-community/cli-tools": "11.3.10", + "@react-native-community/cli-platform-android": "11.3.7", + "@react-native-community/cli-tools": "11.3.7", "chalk": "^4.1.2", "hermes-profile-transformer": "^0.0.6", "ip": "^1.1.5" @@ -5391,11 +5391,11 @@ } }, "node_modules/@react-native-community/cli-platform-android": { - "version": "11.3.10", - "resolved": "https://registry.npmjs.org/@react-native-community/cli-platform-android/-/cli-platform-android-11.3.10.tgz", - "integrity": "sha512-RGu9KuDIXnrcNkacSHj5ETTQtp/D/835L6veE2jMigO21p//gnKAjw3AVLCysGr8YXYfThF8OSOALrwNc94puQ==", + "version": "11.3.7", + "resolved": "https://registry.npmjs.org/@react-native-community/cli-platform-android/-/cli-platform-android-11.3.7.tgz", + "integrity": "sha512-WGtXI/Rm178UQb8bu1TAeFC/RJvYGnbHpULXvE20GkmeJ1HIrMjkagyk6kkY3Ej25JAP2R878gv+TJ/XiRhaEg==", "dependencies": { - "@react-native-community/cli-tools": "11.3.10", + "@react-native-community/cli-tools": "11.3.7", "chalk": "^4.1.2", "execa": "^5.0.0", "glob": "^7.1.3", @@ -5598,11 +5598,11 @@ } }, "node_modules/@react-native-community/cli-platform-ios": { - "version": "11.3.10", - "resolved": "https://registry.npmjs.org/@react-native-community/cli-platform-ios/-/cli-platform-ios-11.3.10.tgz", - "integrity": "sha512-JjduMrBM567/j4Hvjsff77dGSLMA0+p9rr0nShlgnKPcc+0J4TDy0hgWpUceM7OG00AdDjpetAPupz0kkAh4cQ==", + "version": "11.3.7", + "resolved": "https://registry.npmjs.org/@react-native-community/cli-platform-ios/-/cli-platform-ios-11.3.7.tgz", + "integrity": "sha512-Z/8rseBput49EldX7MogvN6zJlWzZ/4M97s2P+zjS09ZoBU7I0eOKLi0N9wx+95FNBvGQQ/0P62bB9UaFQH2jw==", "dependencies": { - "@react-native-community/cli-tools": "11.3.10", + "@react-native-community/cli-tools": "11.3.7", "chalk": "^4.1.2", "execa": "^5.0.0", "fast-xml-parser": "^4.0.12", @@ -5866,12 +5866,12 @@ } }, "node_modules/@react-native-community/cli-plugin-metro": { - "version": "11.3.10", - "resolved": "https://registry.npmjs.org/@react-native-community/cli-plugin-metro/-/cli-plugin-metro-11.3.10.tgz", - "integrity": "sha512-ZYAc5Hc+QVqJgj1XFbpKnIPbSJ9xKcBnfQrRhR+jFyt2DWx85u4bbzY1GSVc/USs0UbSUXv4dqPbnmOJz52EYQ==", + "version": "11.3.7", + "resolved": "https://registry.npmjs.org/@react-native-community/cli-plugin-metro/-/cli-plugin-metro-11.3.7.tgz", + "integrity": "sha512-0WhgoBVGF1f9jXcuagQmtxpwpfP+2LbLZH4qMyo6OtYLWLG13n2uRep+8tdGzfNzl1bIuUTeE9yZSAdnf9LfYQ==", "dependencies": { - "@react-native-community/cli-server-api": "11.3.10", - "@react-native-community/cli-tools": "11.3.10", + "@react-native-community/cli-server-api": "11.3.7", + "@react-native-community/cli-tools": "11.3.7", "chalk": "^4.1.2", "execa": "^5.0.0", "metro": "0.76.8", @@ -6079,12 +6079,12 @@ } }, "node_modules/@react-native-community/cli-server-api": { - "version": "11.3.10", - "resolved": "https://registry.npmjs.org/@react-native-community/cli-server-api/-/cli-server-api-11.3.10.tgz", - "integrity": "sha512-WEwHWIpqx3gA6Da+lrmq8+z78E1XbxxjBlvHAXevhjJj42N4SO417eZiiUVrFzEFVVJSUee9n9aRa0kUR+0/2w==", + "version": "11.3.7", + "resolved": "https://registry.npmjs.org/@react-native-community/cli-server-api/-/cli-server-api-11.3.7.tgz", + "integrity": "sha512-yoFyGdvR3HxCnU6i9vFqKmmSqFzCbnFSnJ29a+5dppgPRetN+d//O8ard/YHqHzToFnXutAFf2neONn23qcJAg==", "dependencies": { - "@react-native-community/cli-debugger-ui": "11.3.10", - "@react-native-community/cli-tools": "11.3.10", + "@react-native-community/cli-debugger-ui": "11.3.7", + "@react-native-community/cli-tools": "11.3.7", "compression": "^1.7.1", "connect": "^3.6.5", "errorhandler": "^1.5.1", @@ -6115,9 +6115,9 @@ } }, "node_modules/@react-native-community/cli-tools": { - "version": "11.3.10", - "resolved": "https://registry.npmjs.org/@react-native-community/cli-tools/-/cli-tools-11.3.10.tgz", - "integrity": "sha512-4kCuCwVcGagSrNg9vxMNVhynwpByuC/J5UnKGEet3HuqmoDhQW15m18fJXiehA8J+u9WBvHduefy9nZxO0C06Q==", + "version": "11.3.7", + "resolved": "https://registry.npmjs.org/@react-native-community/cli-tools/-/cli-tools-11.3.7.tgz", + "integrity": "sha512-peyhP4TV6Ps1hk+MBHTFaIR1eI3u+OfGBvr5r0wPwo3FAJvldRinMgcB/TcCcOBXVORu7ba1XYjkubPeYcqAyA==", "dependencies": { "appdirsjs": "^1.2.4", "chalk": "^4.1.2", @@ -6326,9 +6326,9 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/@react-native-community/cli-types": { - "version": "11.3.10", - "resolved": "https://registry.npmjs.org/@react-native-community/cli-types/-/cli-types-11.3.10.tgz", - "integrity": "sha512-0FHK/JE7bTn0x1y8Lk5m3RISDHIBQqWLltO2Mf7YQ6cAeKs8iNOJOeKaHJEY+ohjsOyCziw+XSC4cY57dQrwNA==", + "version": "11.3.7", + "resolved": "https://registry.npmjs.org/@react-native-community/cli-types/-/cli-types-11.3.7.tgz", + "integrity": "sha512-OhSr/TiDQkXjL5YOs8+hvGSB+HltLn5ZI0+A3DCiMsjUgTTsYh+Z63OtyMpNjrdCEFcg0MpfdU2uxstCS6Dc5g==", "dependencies": { "joi": "^17.2.1" } @@ -9658,13 +9658,13 @@ } }, "node_modules/deprecated-react-native-prop-types": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/deprecated-react-native-prop-types/-/deprecated-react-native-prop-types-4.2.3.tgz", - "integrity": "sha512-2rLTiMKidIFFYpIVM69UnQKngLqQfL6I11Ch8wGSBftS18FUXda+o2we2950X+1dmbgps28niI3qwyH4eX3Z1g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/deprecated-react-native-prop-types/-/deprecated-react-native-prop-types-4.1.0.tgz", + "integrity": "sha512-WfepZHmRbbdTvhcolb8aOKEvQdcmTMn5tKLbqbXmkBvjFjRVWAYqsXk/DBsV8TZxws8SdGHLuHaJrHSQUPRdfw==", "dependencies": { - "@react-native/normalize-colors": "<0.73.0", - "invariant": "^2.2.4", - "prop-types": "^15.8.1" + "@react-native/normalize-colors": "*", + "invariant": "*", + "prop-types": "*" } }, "node_modules/destroy": { @@ -17536,25 +17536,24 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "node_modules/react-native": { - "version": "0.72.10", - "resolved": "https://registry.npmjs.org/react-native/-/react-native-0.72.10.tgz", - "integrity": "sha512-AjVA1+hCm2VMk3KE9Ve5IeDR3aneEhhQJmBAM9xP3i2WqqS3GksxCz8+JdB83bV6x9mBLv5qPMP71vCged3USw==", + "version": "0.72.6", + "resolved": "https://registry.npmjs.org/react-native/-/react-native-0.72.6.tgz", + "integrity": "sha512-RafPY2gM7mcrFySS8TL8x+TIO3q7oAlHpzEmC7Im6pmXni6n1AuufGaVh0Narbr1daxstw7yW7T9BKW5dpVc2A==", "dependencies": { "@jest/create-cache-key-function": "^29.2.1", - "@react-native-community/cli": "11.3.10", - "@react-native-community/cli-platform-android": "11.3.10", - "@react-native-community/cli-platform-ios": "11.3.10", + "@react-native-community/cli": "11.3.7", + "@react-native-community/cli-platform-android": "11.3.7", + "@react-native-community/cli-platform-ios": "11.3.7", "@react-native/assets-registry": "^0.72.0", - "@react-native/codegen": "^0.72.8", + "@react-native/codegen": "^0.72.7", "@react-native/gradle-plugin": "^0.72.11", "@react-native/js-polyfills": "^0.72.1", "@react-native/normalize-colors": "^0.72.0", "@react-native/virtualized-lists": "^0.72.8", "abort-controller": "^3.0.0", "anser": "^1.4.9", - "ansi-regex": "^5.0.0", "base64-js": "^1.1.2", - "deprecated-react-native-prop-types": "^4.2.3", + "deprecated-react-native-prop-types": "4.1.0", "event-target-shim": "^5.0.1", "flow-enums-runtime": "^0.0.5", "invariant": "^2.2.4", diff --git a/client/src/components/Auth/LoginScreen.tsx b/client/src/components/Auth/LoginScreen.tsx index 13de78217..d6bb18018 100644 --- a/client/src/components/Auth/LoginScreen.tsx +++ b/client/src/components/Auth/LoginScreen.tsx @@ -27,17 +27,15 @@ const LoginScreen = () => { const [email, setEmail] = React.useState(""); const [password, setPassword] = React.useState(""); const [authResponse, setAuthResponse] = React.useState(); - const [invalidLogin, invalidateLogin] = React.useState(false); + const [invalidLogin, invalidateLogin] = React.useState(false); // Possbily change this? + // Sign in function with email and password const onHandleSubmit = async () => { Keyboard.dismiss(); setAuthResponse(await appSignIn(email, password)); }; - useEffect(() => { - setEmail(inputEmail?.toString() || ""); // On load of the page, set the email to the inputEmail if they entered it! - }, []); - + // Listens for the response from the sign in function useEffect(() => { if (authResponse?.user) { router.replace("(home)/chatchannel"); @@ -47,6 +45,10 @@ const LoginScreen = () => { } }, [authResponse]) + useEffect(() => { + setEmail(inputEmail?.toString() || ""); // On load of the page, set the email to the inputEmail if they entered it! + }, []); + if (!fontsLoaded && !fontError) { return null; } diff --git a/client/src/configs/firebaseConfig.ts b/client/src/configs/firebaseConfig.ts index 28f8c1b95..0468e3797 100644 --- a/client/src/configs/firebaseConfig.ts +++ b/client/src/configs/firebaseConfig.ts @@ -6,10 +6,10 @@ import {API_KEY, AUTH_DOMAIN, PROJECT_ID, STORAGE_BUCKET, MESSAGING_SENDER_ID, A const firebaseConfig = { apiKey: API_KEY || "Mock-Key", authDomain: AUTH_DOMAIN, - projectId: PROJECT_ID, - storageBucket: STORAGE_BUCKET, - messagingSenderId: MESSAGING_SENDER_ID, - appId: APP_ID, + // projectId: PROJECT_ID, + // storageBucket: STORAGE_BUCKET, + // messagingSenderId: MESSAGING_SENDER_ID, + // appId: APP_ID, }; let app; diff --git a/client/src/contexts/SocketContext.tsx b/client/src/contexts/SocketContext.tsx index e781618af..3ecdb1521 100644 --- a/client/src/contexts/SocketContext.tsx +++ b/client/src/contexts/SocketContext.tsx @@ -16,18 +16,7 @@ export const SocketProvider = ({ children }: { children: React.ReactNode }) => { useEffect(() => { let isMounted = true; -<<<<<<< HEAD - const socketIo = io(`http://${EXPO_IP}:8080`, { - auth: { - token: "poop", - }, -======= - const socketIo = io(`http://${ EXPO_IP }:8080`, { - auth: { - token: "poop", - } ->>>>>>> 64101e9768089c05c0db54dc060e093837f7ba9c - }); // Hardcoded IP address + const socketIo = io(`http://${ EXPO_IP }:8080`); // Hardcoded IP address socketIo.on("connect", () => { if (isMounted) { diff --git a/client/src/services/store.ts b/client/src/services/store.ts index 817d338e1..77536358f 100644 --- a/client/src/services/store.ts +++ b/client/src/services/store.ts @@ -1,6 +1,6 @@ import { User, createUserWithEmailAndPassword, onAuthStateChanged, signInWithEmailAndPassword, signOut } from 'firebase/auth' import { Store } from 'pullstate' -import { auth} from '../configs/firebaseConfig' +import { auth } from '../configs/firebaseConfig' interface AuthStoreInterface { isLoggedin: boolean, @@ -30,7 +30,7 @@ export const appSignIn = async (email: string, password: string) => { store.user = response?.user; store.isLoggedin = response?.user ? true : false; }); - + console.log('appSignIn', await response.user.getIdToken()); // This is the token we need to send to the server return { user: auth.currentUser }; } catch (e) { return { error: e }; diff --git a/server/.gitignore b/server/.gitignore index 59a9766a7..16f6ab416 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -132,6 +132,9 @@ dist # Build files build +# Private Key JSON +private_key/ + # Other .env build/ diff --git a/server/package-lock.json b/server/package-lock.json index 819318375..2c941b895 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -14,6 +14,7 @@ "dotenv": "^16.3.1", "express": "^4.18.2", "firebase": "^10.5.0", + "firebase-admin": "^12.0.0", "geofire-common": "^6.0.0", "passport": "^0.7.0", "passport-jwt": "^4.0.1", @@ -2299,6 +2300,101 @@ "resolved": "https://registry.npmjs.org/@firebase/webchannel-wrapper/-/webchannel-wrapper-0.10.5.tgz", "integrity": "sha512-eSkJsnhBWv5kCTSU1tSUVl9mpFu+5NXXunZc83le8GMjMlsWwQArSc7cJJ4yl+aDFY0NGLi0AjZWMn1axOrkRg==" }, + "node_modules/@google-cloud/firestore": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/@google-cloud/firestore/-/firestore-7.3.0.tgz", + "integrity": "sha512-2IftQLAbCuVp0nTd3neeu+d3OYIegJpV/V9R4USQj51LzJcXPe8h8jZ7j3+svSNhJVGy6JsN0T1QqlJdMDhTwg==", + "optional": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "functional-red-black-tree": "^1.0.1", + "google-gax": "^4.0.4", + "protobufjs": "^7.2.5" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@google-cloud/paginator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@google-cloud/paginator/-/paginator-5.0.0.tgz", + "integrity": "sha512-87aeg6QQcEPxGCOthnpUjvw4xAZ57G7pL8FS0C4e/81fr3FjkpUpibf1s2v5XGyGhUVGF4Jfg7yEcxqn2iUw1w==", + "optional": true, + "dependencies": { + "arrify": "^2.0.0", + "extend": "^3.0.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@google-cloud/projectify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@google-cloud/projectify/-/projectify-4.0.0.tgz", + "integrity": "sha512-MmaX6HeSvyPbWGwFq7mXdo0uQZLGBYCwziiLIGq5JVX+/bdI3SAq6bP98trV5eTWfLuvsMcIC1YJOF2vfteLFA==", + "optional": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@google-cloud/promisify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-4.0.0.tgz", + "integrity": "sha512-Orxzlfb9c67A15cq2JQEyVc7wEsmFBmHjZWZYQMUyJ1qivXyMwdyNOs9odi79hze+2zqdTtu1E19IM/FtqZ10g==", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@google-cloud/storage": { + "version": "7.7.0", + "resolved": "https://registry.npmjs.org/@google-cloud/storage/-/storage-7.7.0.tgz", + "integrity": "sha512-EMCEY+6JiIkx7Dt8NXVGGjy1vRdSGdHkoqZoqjJw7cEBkT7ZkX0c7puedfn1MamnzW5SX4xoa2jVq5u7OWBmkQ==", + "optional": true, + "dependencies": { + "@google-cloud/paginator": "^5.0.0", + "@google-cloud/projectify": "^4.0.0", + "@google-cloud/promisify": "^4.0.0", + "abort-controller": "^3.0.0", + "async-retry": "^1.3.3", + "compressible": "^2.0.12", + "duplexify": "^4.0.0", + "ent": "^2.2.0", + "fast-xml-parser": "^4.3.0", + "gaxios": "^6.0.2", + "google-auth-library": "^9.0.0", + "mime": "^3.0.0", + "mime-types": "^2.0.8", + "p-limit": "^3.0.1", + "retry-request": "^7.0.0", + "teeny-request": "^9.0.0", + "uuid": "^8.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@google-cloud/storage/node_modules/mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "optional": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@google-cloud/storage/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "optional": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@grpc/grpc-js": { "version": "1.9.14", "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.14.tgz", @@ -3112,6 +3208,15 @@ "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" }, + "node_modules/@tootallnate/once": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", + "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "optional": true, + "engines": { + "node": ">= 10" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -3181,17 +3286,21 @@ "version": "1.19.5", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", - "dev": true, "dependencies": { "@types/connect": "*", "@types/node": "*" } }, + "node_modules/@types/caseless": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.5.tgz", + "integrity": "sha512-hWtVTC2q7hc7xZ/RLbxapMvDMgUnDvKvMOpKal4DrMyfGBUfB1oKaZlIRr6mJL+If3bAP6sV/QneGzF6tJjZDg==", + "optional": true + }, "node_modules/@types/connect": { "version": "3.4.38", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", - "dev": true, "dependencies": { "@types/node": "*" } @@ -3213,7 +3322,6 @@ "version": "4.17.21", "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", - "dev": true, "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.33", @@ -3225,7 +3333,6 @@ "version": "4.17.43", "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.43.tgz", "integrity": "sha512-oaYtiBirUOPQGSWNGPWnzyAFJ0BP3cwvN4oWZQY+zUBwpVIGsKUkpBpSztp74drYcjavs7SKFZ4DX1V2QeN8rg==", - "dev": true, "dependencies": { "@types/node": "*", "@types/qs": "*", @@ -3245,8 +3352,7 @@ "node_modules/@types/http-errors": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", - "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", - "dev": true + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", @@ -3282,11 +3388,24 @@ "pretty-format": "^29.0.0" } }, + "node_modules/@types/jsonwebtoken": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.5.tgz", + "integrity": "sha512-VRLSGzik+Unrup6BsouBeHsf4d1hOEgYWTm/7Nmw1sXoN1+tRly/Gy/po3yeahnP4jfnQWWAhQAqcNfH7ngOkA==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/long": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", + "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==", + "optional": true + }, "node_modules/@types/mime": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", - "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", - "dev": true + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" }, "node_modules/@types/node": { "version": "20.11.17", @@ -3299,20 +3418,43 @@ "node_modules/@types/qs": { "version": "6.9.11", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.11.tgz", - "integrity": "sha512-oGk0gmhnEJK4Yyk+oI7EfXsLayXatCWPHary1MtcmbAifkobT9cM9yutG/hZKIseOU0MqbIwQ/u2nn/Gb+ltuQ==", - "dev": true + "integrity": "sha512-oGk0gmhnEJK4Yyk+oI7EfXsLayXatCWPHary1MtcmbAifkobT9cM9yutG/hZKIseOU0MqbIwQ/u2nn/Gb+ltuQ==" }, "node_modules/@types/range-parser": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", - "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", - "dev": true + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" + }, + "node_modules/@types/request": { + "version": "2.48.12", + "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.12.tgz", + "integrity": "sha512-G3sY+NpsA9jnwm0ixhAFQSJ3Q9JkpLZpJbI3GMv0mIAT0y3mRabYeINzal5WOChIiaTEGQYlHOKgkaM9EisWHw==", + "optional": true, + "dependencies": { + "@types/caseless": "*", + "@types/node": "*", + "@types/tough-cookie": "*", + "form-data": "^2.5.0" + } + }, + "node_modules/@types/request/node_modules/form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "optional": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } }, "node_modules/@types/send": { "version": "0.17.4", "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", - "dev": true, "dependencies": { "@types/mime": "^1", "@types/node": "*" @@ -3322,7 +3464,6 @@ "version": "1.15.5", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.5.tgz", "integrity": "sha512-PDRk21MnK70hja/YF8AHfC7yIsiQHn1rcXx7ijCFBX/k+XQJhQT/gw3xekXKJvx+5SXaMMS8oqQy09Mzvz2TuQ==", - "dev": true, "dependencies": { "@types/http-errors": "*", "@types/mime": "*", @@ -3335,6 +3476,12 @@ "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true }, + "node_modules/@types/tough-cookie": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", + "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", + "optional": true + }, "node_modules/@types/yargs": { "version": "17.0.32", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", @@ -3356,6 +3503,18 @@ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "optional": true, + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -3389,6 +3548,18 @@ "node": ">=0.4.0" } }, + "node_modules/agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "optional": true, + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -3457,6 +3628,24 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "node_modules/arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/async-retry": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", + "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", + "optional": true, + "dependencies": { + "retry": "0.13.1" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -3694,6 +3883,26 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "optional": true + }, "node_modules/base64id": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", @@ -3702,6 +3911,15 @@ "node": "^4.5.0 || >= 5.9" } }, + "node_modules/bignumber.js": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "optional": true, + "engines": { + "node": "*" + } + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -4008,6 +4226,18 @@ "node": ">= 0.8" } }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "optional": true, + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -4306,6 +4536,18 @@ "url": "https://dotenvx.com" } }, + "node_modules/duplexify": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.2.tgz", + "integrity": "sha512-fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw==", + "optional": true, + "dependencies": { + "end-of-stream": "^1.4.1", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1", + "stream-shift": "^1.0.0" + } + }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -4350,6 +4592,15 @@ "node": ">= 0.8" } }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "optional": true, + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/engine.io": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.4.tgz", @@ -4399,6 +4650,12 @@ "node": ">= 0.6" } }, + "node_modules/ent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", + "integrity": "sha512-GHrMyVZQWvTIdDtpiEXdHZnFQKzeO09apj8Cbl4pKWy4i0Oprcq17usfDt5aO63swf0JOeMWjWQE/LzgSRuWpA==", + "optional": true + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -4479,6 +4736,15 @@ "node": ">= 0.6" } }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "optional": true, + "engines": { + "node": ">=6" + } + }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -4581,12 +4847,46 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "optional": true + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "optional": true + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, + "node_modules/fast-xml-parser": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.4.tgz", + "integrity": "sha512-utnwm92SyozgA3hhH2I8qldf2lBqm6qHOICawRNRFu1qMe3+oqr+GcXjGqTmXTMGE5T4eC03kr/rlh5C1IRdZA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + }, + { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" + } + ], + "optional": true, + "dependencies": { + "strnum": "^1.0.5" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, "node_modules/faye-websocket": { "version": "0.11.4", "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz", @@ -4695,6 +4995,39 @@ "@firebase/util": "1.9.4" } }, + "node_modules/firebase-admin": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/firebase-admin/-/firebase-admin-12.0.0.tgz", + "integrity": "sha512-wBrrSSsKV++/+O8E7O/C7/wL0nbG/x4Xv4yatz/+sohaZ+LsnWtYUcrd3gZutO86hLpDex7xgyrkKbgulmtVyQ==", + "dependencies": { + "@fastify/busboy": "^1.2.1", + "@firebase/database-compat": "^1.0.2", + "@firebase/database-types": "^1.0.0", + "@types/node": "^20.10.3", + "jsonwebtoken": "^9.0.0", + "jwks-rsa": "^3.0.1", + "node-forge": "^1.3.1", + "uuid": "^9.0.0" + }, + "engines": { + "node": ">=14" + }, + "optionalDependencies": { + "@google-cloud/firestore": "^7.1.0", + "@google-cloud/storage": "^7.7.0" + } + }, + "node_modules/firebase-admin/node_modules/@fastify/busboy": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-1.2.1.tgz", + "integrity": "sha512-7PQA7EH43S0CxcOa9OeAnaeA0oQ+e/DHNPZwSQM9CQHW76jle5+OvLdibRp/Aafs9KXbLhxyjOTkRjWUbQEd3Q==", + "dependencies": { + "text-decoding": "^1.0.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/follow-redirects": { "version": "1.15.5", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", @@ -4771,6 +5104,40 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", + "optional": true + }, + "node_modules/gaxios": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.2.0.tgz", + "integrity": "sha512-H6+bHeoEAU5D6XNc6mPKeN5dLZqEDs9Gpk6I+SZBEzK5So58JVrHPmevNi35fRl1J9Y5TaeLW0kYx3pCJ1U2mQ==", + "optional": true, + "dependencies": { + "extend": "^3.0.2", + "https-proxy-agent": "^7.0.1", + "is-stream": "^2.0.0", + "node-fetch": "^2.6.9" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/gcp-metadata": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-6.1.0.tgz", + "integrity": "sha512-Jh/AIwwgaxan+7ZUUmRLCjtchyDiqh4KjBJ5tW3plBZb5iL/BPcso8A5DlzeD9qlw0duCamnNdpFjxwaT0KyKg==", + "optional": true, + "dependencies": { + "gaxios": "^6.0.0", + "json-bigint": "^1.0.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -4873,6 +5240,80 @@ "node": ">=4" } }, + "node_modules/google-auth-library": { + "version": "9.6.3", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.6.3.tgz", + "integrity": "sha512-4CacM29MLC2eT9Cey5GDVK4Q8t+MMp8+OEdOaqD9MG6b0dOyLORaaeJMPQ7EESVgm/+z5EKYyFLxgzBJlJgyHQ==", + "optional": true, + "dependencies": { + "base64-js": "^1.3.0", + "ecdsa-sig-formatter": "^1.0.11", + "gaxios": "^6.1.1", + "gcp-metadata": "^6.1.0", + "gtoken": "^7.0.0", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/google-auth-library/node_modules/jwa": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", + "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", + "optional": true, + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/google-auth-library/node_modules/jws": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", + "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", + "optional": true, + "dependencies": { + "jwa": "^2.0.0", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/google-gax": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/google-gax/-/google-gax-4.3.1.tgz", + "integrity": "sha512-qpSfslpwqToIgQ+Tf3MjWIDjYK4UFIZ0uz6nLtttlW9N1NQA4PhGf9tlGo6KDYJ4rgL2w4CjXVd0z5yeNpN/Iw==", + "optional": true, + "dependencies": { + "@grpc/grpc-js": "~1.10.0", + "@grpc/proto-loader": "^0.7.0", + "@types/long": "^4.0.0", + "abort-controller": "^3.0.0", + "duplexify": "^4.0.0", + "google-auth-library": "^9.3.0", + "node-fetch": "^2.6.1", + "object-hash": "^3.0.0", + "proto3-json-serializer": "^2.0.0", + "protobufjs": "7.2.6", + "retry-request": "^7.0.0", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/google-gax/node_modules/@grpc/grpc-js": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.10.1.tgz", + "integrity": "sha512-55ONqFytZExfOIjF1RjXPcVmT/jJqFzbbDqxK9jmRV4nxiYWtL9hENSW1Jfx0SdZfrvoqd44YJ/GJTqfRrawSQ==", + "optional": true, + "dependencies": { + "@grpc/proto-loader": "^0.7.8", + "@types/node": ">=12.12.47" + }, + "engines": { + "node": "^8.13.0 || >=10.10.0" + } + }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -4890,6 +5331,40 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "node_modules/gtoken": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz", + "integrity": "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==", + "optional": true, + "dependencies": { + "gaxios": "^6.0.0", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/gtoken/node_modules/jwa": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", + "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", + "optional": true, + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/gtoken/node_modules/jws": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", + "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", + "optional": true, + "dependencies": { + "jwa": "^2.0.0", + "safe-buffer": "^5.0.1" + } + }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -4969,6 +5444,45 @@ "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz", "integrity": "sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==" }, + "node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "optional": true, + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "optional": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", + "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", + "optional": true, + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -5132,7 +5646,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, + "devOptional": true, "engines": { "node": ">=8" }, @@ -6843,6 +7357,14 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/jose": { + "version": "4.15.4", + "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.4.tgz", + "integrity": "sha512-W+oqK4H+r5sITxfxpSU+MMdr/YSWGvgZMQDIsNoBDGGy4i7GBPTtvFKibQzW06n3U3TqHjhvBJsirShsEJ6eeQ==", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -6874,6 +7396,15 @@ "node": ">=4" } }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "optional": true, + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -6953,6 +7484,22 @@ "safe-buffer": "^5.0.1" } }, + "node_modules/jwks-rsa": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jwks-rsa/-/jwks-rsa-3.1.0.tgz", + "integrity": "sha512-v7nqlfezb9YfHHzYII3ef2a2j1XnGeSE/bK3WfumaYCqONAIstJbrEGapz4kadScZzEt7zYCN7bucj8C0Mv/Rg==", + "dependencies": { + "@types/express": "^4.17.17", + "@types/jsonwebtoken": "^9.0.2", + "debug": "^4.3.4", + "jose": "^4.14.6", + "limiter": "^1.1.5", + "lru-memoizer": "^2.2.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/jws": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", @@ -6980,6 +7527,11 @@ "node": ">=6" } }, + "node_modules/limiter": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/limiter/-/limiter-1.1.5.tgz", + "integrity": "sha512-FWWMIEOxz3GwUI4Ts/IvgVy6LPvoMPgjMdQ185nN6psJyBJ4yOpzqm695/h5umdLJg2vW3GR5iG11MAkR2AzJA==" + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -7003,6 +7555,11 @@ "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" }, + "node_modules/lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==" + }, "node_modules/lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -7058,6 +7615,29 @@ "yallist": "^3.0.2" } }, + "node_modules/lru-memoizer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/lru-memoizer/-/lru-memoizer-2.2.0.tgz", + "integrity": "sha512-QfOZ6jNkxCcM/BkIPnFsqDhtrazLRsghi9mBwFAzol5GCvj4EkFT899Za3+QwikCg5sRX8JstioBDwOxEyzaNw==", + "dependencies": { + "lodash.clonedeep": "^4.5.0", + "lru-cache": "~4.0.0" + } + }, + "node_modules/lru-memoizer/node_modules/lru-cache": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.0.2.tgz", + "integrity": "sha512-uQw9OqphAGiZhkuPlpFGmdTU2tEuhxTourM/19qGJrxBPHAr/f8BT1a0i/lOclESnGatdJG/UCkP9kZB/Lh1iw==", + "dependencies": { + "pseudomap": "^1.0.1", + "yallist": "^2.0.0" + } + }, + "node_modules/lru-memoizer/node_modules/yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==" + }, "node_modules/make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -7231,6 +7811,34 @@ "node": ">= 0.6" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "optional": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-forge": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "engines": { + "node": ">= 6.13.0" + } + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -7348,6 +7956,15 @@ "node": ">=0.10.0" } }, + "node_modules/object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "optional": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/object-inspect": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", @@ -7371,7 +7988,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, + "devOptional": true, "dependencies": { "wrappy": "1" } @@ -7395,7 +8012,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, + "devOptional": true, "dependencies": { "yocto-queue": "^0.1.0" }, @@ -7623,6 +8240,18 @@ "node": ">= 6" } }, + "node_modules/proto3-json-serializer": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/proto3-json-serializer/-/proto3-json-serializer-2.0.1.tgz", + "integrity": "sha512-8awBvjO+FwkMd6gNoGFZyqkHZXCFd54CIYTb6De7dPaufGJ2XNW+QUNqbMr8MaAocMdb+KpsD4rxEOaTBDCffA==", + "optional": true, + "dependencies": { + "protobufjs": "^7.2.5" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/protobufjs": { "version": "7.2.6", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.6.tgz", @@ -7663,6 +8292,11 @@ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, + "node_modules/pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==" + }, "node_modules/pstree.remy": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", @@ -7727,6 +8361,20 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", "dev": true }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "optional": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -7865,6 +8513,29 @@ "node": ">=10" } }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "optional": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/retry-request": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-7.0.2.tgz", + "integrity": "sha512-dUOvLMJ0/JJYEn8NrpOaGNE7X3vpI5XlZS/u0ANjqtcZVKnIxP7IgCFwrKTxENw29emmwug53awKtaMm4i9g5w==", + "optional": true, + "dependencies": { + "@types/request": "^2.48.8", + "extend": "^3.0.2", + "teeny-request": "^9.0.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -8184,6 +8855,30 @@ "node": ">= 0.8" } }, + "node_modules/stream-events": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz", + "integrity": "sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==", + "optional": true, + "dependencies": { + "stubs": "^3.0.0" + } + }, + "node_modules/stream-shift": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.3.tgz", + "integrity": "sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ==", + "optional": true + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "optional": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -8251,6 +8946,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strnum": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==", + "optional": true + }, + "node_modules/stubs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", + "integrity": "sha512-PdHt7hHUJKxvTCgbKX9C1V/ftOcjJQgz8BZwNfV5c4B6dcGqlpelTbJ999jBGZ2jYiPAwcX5dP6oBwVlBlUbxw==", + "optional": true + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -8275,6 +8982,47 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/teeny-request": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-9.0.0.tgz", + "integrity": "sha512-resvxdc6Mgb7YEThw6G6bExlXKkv6+YbuzGg9xuXxSgxJF7Ozs+o8Y9+2R3sArdWdW8nOokoQb1yrpFB0pQK2g==", + "optional": true, + "dependencies": { + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.9", + "stream-events": "^1.0.5", + "uuid": "^9.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/teeny-request/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "optional": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/teeny-request/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "optional": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -8289,6 +9037,11 @@ "node": ">=8" } }, + "node_modules/text-decoding": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/text-decoding/-/text-decoding-1.0.0.tgz", + "integrity": "sha512-/0TJD42KDnVwKmDK6jj3xP7E2MG7SHAOG4tyTgyUCRPdHwvkquYNLEQltmdMa3owq3TkddCVcTsoctJI8VQNKA==" + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -8336,6 +9089,12 @@ "nodetouch": "bin/nodetouch.js" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "optional": true + }, "node_modules/ts-node": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", @@ -8530,6 +9289,12 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "optional": true + }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -8587,6 +9352,12 @@ "makeerror": "1.0.12" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "optional": true + }, "node_modules/websocket-driver": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", @@ -8608,6 +9379,16 @@ "node": ">=0.8.0" } }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "optional": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -8673,7 +9454,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "devOptional": true }, "node_modules/write-file-atomic": { "version": "4.0.2", @@ -8769,7 +9550,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, + "devOptional": true, "engines": { "node": ">=10" }, diff --git a/server/package.json b/server/package.json index bcabe0ad6..2c43f35b0 100644 --- a/server/package.json +++ b/server/package.json @@ -29,6 +29,7 @@ "dotenv": "^16.3.1", "express": "^4.18.2", "firebase": "^10.5.0", + "firebase-admin": "^12.0.0", "geofire-common": "^6.0.0", "passport": "^0.7.0", "passport-jwt": "^4.0.1", diff --git a/server/src/index.ts b/server/src/index.ts index 0a2d287cc..32444d759 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -13,6 +13,7 @@ import { deleteConnectedUserByIndex } from './actions/deleteConnectedUser' import {geohashForLocation} from 'geofire-common'; import { findNearbyUsers } from './actions/getConnectedUsers' import { ConnectedUser } from './types/User'; +import { adminApp } from './utilities/adminInit'; const { createServer } = require('http') const { Server } = require('socket.io') @@ -20,6 +21,8 @@ const passport = require('passport') const JWTStrategy = require('passport-jwt').Strategy const ExtractJWT = require('passport-jwt').ExtractJwt +adminApp.firestore() + const socket_port = process.env.socket_port const express_port = process.env.express_port @@ -28,6 +31,19 @@ const app = express() app.use(express.json()) app.use(express.urlencoded({ extended: true })) +// == Passport JWT Strategy == +const secret = 'secret' // TODO: Replace with process.env.JWT_SECRET +passport.use(new JWTStrategy({ + jwtFromRequest: ExtractJWT.fromAuthHeaderAsBearerToken(), + jsonWebTokenOptions: { + ignoreExpiration: false, + }, + secretOrKey: secret, + algorithims: ['HS256'], +}, (jwt_payload: any, done: any) => { + +})) + // === SOCKET API === const socketServer = createServer() diff --git a/server/src/tests/socketio.test.ts b/server/src/tests/socketio.test.ts index 4efb99a8e..878ec7f79 100644 --- a/server/src/tests/socketio.test.ts +++ b/server/src/tests/socketio.test.ts @@ -33,7 +33,7 @@ const connectClients = async () => { for (let i = 0; i < NUM_CLIENTS; i++) { const client = io(`http://localhost:${socket_test_client_port}`); - await new Promise(resolve => client.on('connect', resolve)); // Why is this an error? IDK + await new Promise(resolve => client.on('connect', resolve)); // Why is this an error? IDK clients.push(client); } diff --git a/server/src/utilities/adminInit.ts b/server/src/utilities/adminInit.ts new file mode 100644 index 000000000..a262efbd6 --- /dev/null +++ b/server/src/utilities/adminInit.ts @@ -0,0 +1,9 @@ +const { initializeApp } = require('firebase-admin/app'); +const admin = require('firebase-admin'); +const serviceAccount = require("../../src/private_key/.json"); + +export const adminApp = admin.initializeApp({ + credential: admin.credential.cert(serviceAccount) +}); + +console.log("[FIREBASE-ADMIN] Firebase admin SDK synced.") \ No newline at end of file From 4b69891c2eb10ec3e1fb833cb1670d1e4eb82517 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Sat, 17 Feb 2024 20:48:40 -0500 Subject: [PATCH 17/24] removed passport --- server/package-lock.json | 41 -------------------------------- server/package.json | 2 -- server/private_keys/private.json | 13 ++++++++++ server/src/index.ts | 15 ------------ 4 files changed, 13 insertions(+), 58 deletions(-) create mode 100644 server/private_keys/private.json diff --git a/server/package-lock.json b/server/package-lock.json index 2c941b895..d8bb07258 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -16,8 +16,6 @@ "firebase": "^10.5.0", "firebase-admin": "^12.0.0", "geofire-common": "^6.0.0", - "passport": "^0.7.0", - "passport-jwt": "^4.0.1", "socket.io": "^4.7.4", "uuid": "^9.0.1" }, @@ -8085,40 +8083,6 @@ "node": ">= 0.8" } }, - "node_modules/passport": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/passport/-/passport-0.7.0.tgz", - "integrity": "sha512-cPLl+qZpSc+ireUvt+IzqbED1cHHkDoVYMo30jbJIdOOjQ1MQYZBPiNvmi8UM6lJuOpTPXJGZQk0DtC4y61MYQ==", - "dependencies": { - "passport-strategy": "1.x.x", - "pause": "0.0.1", - "utils-merge": "^1.0.1" - }, - "engines": { - "node": ">= 0.4.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/jaredhanson" - } - }, - "node_modules/passport-jwt": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/passport-jwt/-/passport-jwt-4.0.1.tgz", - "integrity": "sha512-UCKMDYhNuGOBE9/9Ycuoyh7vP6jpeTp/+sfMJl7nLff/t6dps+iaeE0hhNkKN8/HZHcJ7lCdOyDxHdDoxoSvdQ==", - "dependencies": { - "jsonwebtoken": "^9.0.0", - "passport-strategy": "^1.0.0" - } - }, - "node_modules/passport-strategy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz", - "integrity": "sha512-CB97UUvDKJde2V0KDWWB3lyf6PC3FaZP7YxZ2G8OAtn9p4HI9j9JLP9qjOGZFvyl8uwNT8qM+hGnz/n16NI7oA==", - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -8157,11 +8121,6 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, - "node_modules/pause": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", - "integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg==" - }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", diff --git a/server/package.json b/server/package.json index 2c43f35b0..39f4fcfb7 100644 --- a/server/package.json +++ b/server/package.json @@ -31,8 +31,6 @@ "firebase": "^10.5.0", "firebase-admin": "^12.0.0", "geofire-common": "^6.0.0", - "passport": "^0.7.0", - "passport-jwt": "^4.0.1", "socket.io": "^4.7.4", "uuid": "^9.0.1" }, diff --git a/server/private_keys/private.json b/server/private_keys/private.json new file mode 100644 index 000000000..e66a7a5fc --- /dev/null +++ b/server/private_keys/private.json @@ -0,0 +1,13 @@ +{ + "type": "service_account", + "project_id": "fir-auth-89462", + "private_key_id": "0f8a62cb00e8b6172f5d7300378aa9fb4c733651", + "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCv3ZSGOHWG47LO\nogbYeJ7HeDNZwbTa7RTSGO/eNXAVukKML9+1o9H5PTZftzcIYgIweHNaLTFxSHQ6\nDdqlzd+lCMd7Wayjm7KH9sF5j8fm7BVL+BYK7QshCrurE+M+ENtQtaN3FmDaytqF\n9sc5pWN4Qb5XGWxq8PolKfI2LOrTNpU/c7pxtTT3wKDfdP90bFuD963yP8opfMOn\nFcgLH9WV8l7em9Np42+lA/fD487BS40+eadn9tkpxjYECmXqZHH5p7dYJeisgig3\n02EFAJn7TGvB9Y9rwhb1kJnnYqm3go5gwD3gLnRUXD1KO+50HjdyYSb6r3uSq6Tz\nrzQbf4CfAgMBAAECggEAC1dXFaocbNIlnM0MHfehXaxdu2MSM7AS+1LfsnfFvlD1\nq66xVuMKo8UTyuu4y9HuNuFS/F9qZIDPUKhwuj04N/SvUJVsMbIqZY7p09oMLSh6\nXcd7kcF5n0GJmrMR9isGHwKnrlgDb6NMoP5Uw13sDTxIIbvM/Gnaknz4Vrq3e16w\nC/4AqI9wVu2mfH2mr2+duRgHqOBlgSESAhU9XbXeZq7/X4x4JKKBMcDnfm5LchJx\nP2JRpo4eGkDzh8yDgHFgCkrsO5/Z6l8sIH2cfBexxiSjxmjq81imv0YBbzV95kNv\nBlb0vKYBot7J2izH2eokLwwPWewvh2V5qV50qPVoKQKBgQDU1tRqC5qLQtBsYzKX\nTF5/Ghwv2bS7r0VUZyU7uFb5lOIPsRqyGmkiv4xynRDf+hucXUXTfOR4SGQJSxaF\n0BEsAr69GIykyjVe9PioBvfTilEdZtMZSAsdSnBWi0mzLh92aAFYj1P9nvZWnB+i\nsfMLpyZXmf5I8XymHmq1b/bsEwKBgQDTh1RjADw/E6d+Jz9eGJwtQU8Ue61MIPAn\nCbZPiB1Z9jJy15TlPH/c+6FmtCcTV3pdhF70EdowE6fOTg88awkflOK6Fs7cAjdk\n31RLF1e/7fVQeRilpx7usG5WtbWENesFcz6t2vRKb/8bI2GRt9TUNvQT2JK+J1TZ\njMuhaeOSxQKBgCR0W1OCg0jg+8PkxbCGYxUQCs3jUwJmhdBsDkOJUlRTPNkFM5ZX\n0bQi7NJgtpg2RW5lx2Tu2k8DzyaMVuI6fgZ0veizgLtk6vlFqiVVdDMmWLhZeUS2\nQzkUG+Om3cuz1a25KKnber5Q8M5q1TxPkFppmbadaKFjwz7MrOhAsiFDAoGAbHYD\nqw+/1If7ZhAxycnMqtfF+LbB0TtCaIHuXTFp+2rly0UHL9OprGHKDKNrNduw/qqV\nFYjh26z4aixUW6J2dx8cclankuAAD1UEH8zETcFx++Vb4fSjQ7hrm0Jo5HXRIGZL\nSVHv2Qs8P2oQ6WrdUkMrO9HczGvWcgZjk0x8SBECgYEAtsHLGZIacFLtSqLL1QuA\n9fgjRlMEUpDYyEeNqfWg1hAXj5m8QZpPUjJT1gZfHQZ1ZSXm0/ALx2gkwISKbUvW\nyi7TQVbr6l+vPTWFnGwCL0INvGDf1wTv5PoIGWvfbD8EJfHQ1ejSMgBvupl62E5n\nmsMroEceDdTbtj3z68naRYQ=\n-----END PRIVATE KEY-----\n", + "client_email": "firebase-adminsdk-f0nzi@fir-auth-89462.iam.gserviceaccount.com", + "client_id": "102183968562626917121", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://oauth2.googleapis.com/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-f0nzi%40fir-auth-89462.iam.gserviceaccount.com", + "universe_domain": "googleapis.com" +} diff --git a/server/src/index.ts b/server/src/index.ts index 32444d759..926864984 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -17,9 +17,6 @@ import { adminApp } from './utilities/adminInit'; const { createServer } = require('http') const { Server } = require('socket.io') -const passport = require('passport') -const JWTStrategy = require('passport-jwt').Strategy -const ExtractJWT = require('passport-jwt').ExtractJwt adminApp.firestore() @@ -31,18 +28,6 @@ const app = express() app.use(express.json()) app.use(express.urlencoded({ extended: true })) -// == Passport JWT Strategy == -const secret = 'secret' // TODO: Replace with process.env.JWT_SECRET -passport.use(new JWTStrategy({ - jwtFromRequest: ExtractJWT.fromAuthHeaderAsBearerToken(), - jsonWebTokenOptions: { - ignoreExpiration: false, - }, - secretOrKey: secret, - algorithims: ['HS256'], -}, (jwt_payload: any, done: any) => { - -})) // === SOCKET API === From b8e07de84fa5d82920bc1b8cbad9e415d9b46c15 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Sat, 17 Feb 2024 20:54:36 -0500 Subject: [PATCH 18/24] added private key to gitignore --- server/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/.gitignore b/server/.gitignore index 16f6ab416..81da29c6f 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -133,7 +133,7 @@ dist build # Private Key JSON -private_key/ +./private_key/* # Other .env From 8d4373775018f3d8722a12c9ba72cd8b73060424 Mon Sep 17 00:00:00 2001 From: Alexander Wang <98280966+AlexanderWangY@users.noreply.github.com> Date: Sat, 17 Feb 2024 20:55:03 -0500 Subject: [PATCH 19/24] Delete server/private_keys/private.json --- server/private_keys/private.json | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 server/private_keys/private.json diff --git a/server/private_keys/private.json b/server/private_keys/private.json deleted file mode 100644 index e66a7a5fc..000000000 --- a/server/private_keys/private.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "type": "service_account", - "project_id": "fir-auth-89462", - "private_key_id": "0f8a62cb00e8b6172f5d7300378aa9fb4c733651", - "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCv3ZSGOHWG47LO\nogbYeJ7HeDNZwbTa7RTSGO/eNXAVukKML9+1o9H5PTZftzcIYgIweHNaLTFxSHQ6\nDdqlzd+lCMd7Wayjm7KH9sF5j8fm7BVL+BYK7QshCrurE+M+ENtQtaN3FmDaytqF\n9sc5pWN4Qb5XGWxq8PolKfI2LOrTNpU/c7pxtTT3wKDfdP90bFuD963yP8opfMOn\nFcgLH9WV8l7em9Np42+lA/fD487BS40+eadn9tkpxjYECmXqZHH5p7dYJeisgig3\n02EFAJn7TGvB9Y9rwhb1kJnnYqm3go5gwD3gLnRUXD1KO+50HjdyYSb6r3uSq6Tz\nrzQbf4CfAgMBAAECggEAC1dXFaocbNIlnM0MHfehXaxdu2MSM7AS+1LfsnfFvlD1\nq66xVuMKo8UTyuu4y9HuNuFS/F9qZIDPUKhwuj04N/SvUJVsMbIqZY7p09oMLSh6\nXcd7kcF5n0GJmrMR9isGHwKnrlgDb6NMoP5Uw13sDTxIIbvM/Gnaknz4Vrq3e16w\nC/4AqI9wVu2mfH2mr2+duRgHqOBlgSESAhU9XbXeZq7/X4x4JKKBMcDnfm5LchJx\nP2JRpo4eGkDzh8yDgHFgCkrsO5/Z6l8sIH2cfBexxiSjxmjq81imv0YBbzV95kNv\nBlb0vKYBot7J2izH2eokLwwPWewvh2V5qV50qPVoKQKBgQDU1tRqC5qLQtBsYzKX\nTF5/Ghwv2bS7r0VUZyU7uFb5lOIPsRqyGmkiv4xynRDf+hucXUXTfOR4SGQJSxaF\n0BEsAr69GIykyjVe9PioBvfTilEdZtMZSAsdSnBWi0mzLh92aAFYj1P9nvZWnB+i\nsfMLpyZXmf5I8XymHmq1b/bsEwKBgQDTh1RjADw/E6d+Jz9eGJwtQU8Ue61MIPAn\nCbZPiB1Z9jJy15TlPH/c+6FmtCcTV3pdhF70EdowE6fOTg88awkflOK6Fs7cAjdk\n31RLF1e/7fVQeRilpx7usG5WtbWENesFcz6t2vRKb/8bI2GRt9TUNvQT2JK+J1TZ\njMuhaeOSxQKBgCR0W1OCg0jg+8PkxbCGYxUQCs3jUwJmhdBsDkOJUlRTPNkFM5ZX\n0bQi7NJgtpg2RW5lx2Tu2k8DzyaMVuI6fgZ0veizgLtk6vlFqiVVdDMmWLhZeUS2\nQzkUG+Om3cuz1a25KKnber5Q8M5q1TxPkFppmbadaKFjwz7MrOhAsiFDAoGAbHYD\nqw+/1If7ZhAxycnMqtfF+LbB0TtCaIHuXTFp+2rly0UHL9OprGHKDKNrNduw/qqV\nFYjh26z4aixUW6J2dx8cclankuAAD1UEH8zETcFx++Vb4fSjQ7hrm0Jo5HXRIGZL\nSVHv2Qs8P2oQ6WrdUkMrO9HczGvWcgZjk0x8SBECgYEAtsHLGZIacFLtSqLL1QuA\n9fgjRlMEUpDYyEeNqfWg1hAXj5m8QZpPUjJT1gZfHQZ1ZSXm0/ALx2gkwISKbUvW\nyi7TQVbr6l+vPTWFnGwCL0INvGDf1wTv5PoIGWvfbD8EJfHQ1ejSMgBvupl62E5n\nmsMroEceDdTbtj3z68naRYQ=\n-----END PRIVATE KEY-----\n", - "client_email": "firebase-adminsdk-f0nzi@fir-auth-89462.iam.gserviceaccount.com", - "client_id": "102183968562626917121", - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "token_uri": "https://oauth2.googleapis.com/token", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-f0nzi%40fir-auth-89462.iam.gserviceaccount.com", - "universe_domain": "googleapis.com" -} From 17e6ba017e42cda12b72ef4752401b351feb4500 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Sat, 17 Feb 2024 21:37:52 -0500 Subject: [PATCH 20/24] initializing firestore in admin --- server/src/private_key/private.json | 13 +++++++++++++ server/src/utilities/adminInit.ts | 7 +++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 server/src/private_key/private.json diff --git a/server/src/private_key/private.json b/server/src/private_key/private.json new file mode 100644 index 000000000..02095340f --- /dev/null +++ b/server/src/private_key/private.json @@ -0,0 +1,13 @@ +{ + "type": "service_account", + "project_id": "fir-auth-89462", + "private_key_id": "770edc7187f5ef3d35359b9ad2304570d4f170ff", + "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDCS6oM6wYwCp7a\nCXauPpBDjLzqq5PrMZCWOoi2THjqTzLJQc/Xwg5XlOyRX1DB4Uzl1iutfLsQXNuv\nMRze3i2jIOLysnrkvSuLW9n19k/1gIYYm7oxZQPaJ5iNJ33GFiNJqULlmMTvv6vp\nhXOOUZxl9dNY3HRpICcaGNPXjAv3tG7W+iHsidphp88Q8OMMmkZcl3+h2Hc1yDEf\nmXPR0YynfakDi45tMf5F9x3jRT6y6O30PSpZUIVL2cfwWs+zojnK+vy+cGCjBIJE\n/uI+A7XJJ4BWNLH/jhy6Jta/jDkCj/JbUsxRTX2ZuUeVi8uSMkzdy/Pb+o5f4SaJ\nl3mTa7S5AgMBAAECggEAEIChdwMrxX8TbrC81TAga/JbVeHAmKp/LblXRQeSAhG7\nvisSMpDLi84M+UxzlSIUGFXkZBH65/kBGjxVR8subGN1zzgQVtcH6KhipwDWmgMi\ncJriecFLDleMXhnXdZCKCv6+vTZIbNYWbYlNjy4YlvLmEm84DnlCBPYMoStGlXFm\nRKEfLl4FHHmCRcRkuGWRyKk9LtKNykrlaFVZ3BL11/TC38BlK3us+1cyUO3dA1EW\njAYSRG3tAVGVS7VUoxDDcA1V+Wnccpt+ws/rzIVYcTXawXrpHXFx977FwarGHReL\nmRmjHYGo/4Ry+q8Nk1y7GkdPYxq5GVAtXuRqSx7EgQKBgQD86ru/bBxJZxNAuHTE\nx9j/n0MrH9ulAFEzAXzq12Yf2xSytrUbD31zPg+rrFTGDNYISUPKSa9sxpC/jiwB\nXmuNhFVvt1521naZOtyezo3RYztcwOIxscvULHMUt/ikaFVsytlxrqDn0MJXuKM/\n5OZbbolc5pR3Oi82FOz09xB+OQKBgQDEqf5ox6V8ZfrMdFvhKC0EklyfDjClrJa2\nCkE0HK9ePxCpnEqBYC8wj6pXNOnLONYNZIjJ7Nz2CiFd0gIt7Ep9KtDNve99dWHR\nObPbt9fC8vMuzotBN6P345hzdqXR7OUUfAPFBCZTysWrfHzqg1tFYkt5t+YVfWuu\nMRq/xpzqgQKBgQC00Af7eQnb/EHKYlSwngNn9G8rtHHty4VBhs3MgsOzAIgSoAZn\n2zIfon3HiMNud5zIfcBmLTmp9WdkWvrg26Tenn4KCTkSko5lS6yQKDFBQcUdsZPE\nXUzQWhrH9CJhP2nbBkZgPK0yLY/S8OBc/IMnWKYBcaMwfbtk2Z7yHnN/GQKBgClH\ndTsRDM87qJTZp59vC2P2RLKuC8/6lffH1z/U9YpWumyffZQCWGVdAmgjlx8s4uEU\nxRF9QjPylGZY+lQhUNFM9174CxjOVqXP8syfng4xaJHekKQzxZr2jr1NniieDMdr\n8G6eHF1iJnOEQcQHplS9+RGnZAgGt19styyhx7YBAoGBAN++OfEq6S8zW/+Q9E8x\nAxvdNrFOkHnJf+URwTZQNFebvRUDouYjHE1fOCSM7npkNFV/DyINTsP6cNGKwGXM\nox1ODGb2uLk3hEQLDbqocIoWnuzY2QU3lubrSdAnEUDBovjd4of47BwYo2HfA+Pu\nTuLU4vtbFvSH7e3OJ9A//cKD\n-----END PRIVATE KEY-----\n", + "client_email": "firebase-adminsdk-f0nzi@fir-auth-89462.iam.gserviceaccount.com", + "client_id": "102183968562626917121", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://oauth2.googleapis.com/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-f0nzi%40fir-auth-89462.iam.gserviceaccount.com", + "universe_domain": "googleapis.com" +} diff --git a/server/src/utilities/adminInit.ts b/server/src/utilities/adminInit.ts index a262efbd6..90092700e 100644 --- a/server/src/utilities/adminInit.ts +++ b/server/src/utilities/adminInit.ts @@ -1,9 +1,12 @@ const { initializeApp } = require('firebase-admin/app'); +const { getFirestore } = require('firebase-admin/firestore'); const admin = require('firebase-admin'); -const serviceAccount = require("../../src/private_key/.json"); +const serviceAccount = require("../../src/private_key/private.json"); export const adminApp = admin.initializeApp({ - credential: admin.credential.cert(serviceAccount) + credential: admin.credential.cert(serviceAccount), }); +export const db = admin.firestore(); + console.log("[FIREBASE-ADMIN] Firebase admin SDK synced.") \ No newline at end of file From d63af3bbb6c30bf4b67e631ff3e7e4ac8d58ddbb Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Sun, 18 Feb 2024 21:06:22 -0500 Subject: [PATCH 21/24] finished most of action refactoring --- server/src/actions/createConnectedUser.ts | 7 +++---- server/src/actions/createMessage.ts | 4 ++-- server/src/actions/deleteConnectedUser.ts | 15 +++------------ server/src/actions/getConnectedUsers.ts | 5 +++-- server/src/actions/updateConnectedUser.ts | 12 +++--------- server/src/index.ts | 8 +++----- server/src/utilities/adminInit.ts | 2 ++ 7 files changed, 19 insertions(+), 34 deletions(-) diff --git a/server/src/actions/createConnectedUser.ts b/server/src/actions/createConnectedUser.ts index 218606f46..2d6f49490 100644 --- a/server/src/actions/createConnectedUser.ts +++ b/server/src/actions/createConnectedUser.ts @@ -2,13 +2,12 @@ import { doc, setDoc } from '@firebase/firestore' import { connectedUsers } from '../utilities/firebaseInit' import { ConnectedUser } from '../types/User' +import { connectedUsersCollection } from '../utilities/adminInit'; export const createUser = async (connectedUser: ConnectedUser) => { try { - const ref = doc(connectedUsers, connectedUser.socketId) // Use the socketid as the index - await setDoc(ref, connectedUser) - return true - + await connectedUsersCollection.doc(connectedUser.socketId).set(connectedUser) + console.log('User added to the database') } catch (error) { console.error(error.message) return false diff --git a/server/src/actions/createMessage.ts b/server/src/actions/createMessage.ts index 944e6c1e9..00d863ce9 100644 --- a/server/src/actions/createMessage.ts +++ b/server/src/actions/createMessage.ts @@ -2,11 +2,11 @@ import { doc, setDoc } from '@firebase/firestore' import { messages } from '../utilities/firebaseInit' import { Message } from '../types/Message' +import { messagesCollection } from '../utilities/adminInit' export const createMessage = async (msg : Message) => { try { - const ref = doc(messages, msg.msgId) - const status = await setDoc(ref, msg) + await messagesCollection.doc(msg.msgId).set(msg) return true } catch (error) { diff --git a/server/src/actions/deleteConnectedUser.ts b/server/src/actions/deleteConnectedUser.ts index 6cf469360..08baee8e0 100644 --- a/server/src/actions/deleteConnectedUser.ts +++ b/server/src/actions/deleteConnectedUser.ts @@ -1,20 +1,11 @@ // Delete a ConnectedUser document given a document's index. This should typically be a socketId, but it can also be something else. import { doc, getDoc, deleteDoc } from '@firebase/firestore' import { connectedUsers } from '../utilities/firebaseInit' +import { connectedUsersCollection } from '../utilities/adminInit' -export const deleteConnectedUserByIndex = async (index: string) => { +export const deleteConnectedUserByUID = async (userID: string) => { try { - const userRef = doc(connectedUsers, index) - - // The promise returned by deleteDoc will be fulfilled (aka return 'true') both if the document requested for deletion exists or doesn't exist. It is rejected if the program is unable to send this request to Firestore. - // Therefore, we need to check to see if the document exists first, to most accurately know if it will be deleted. - // However, technically, there could be some kind of failure by deleteDoc after this check is performed, where the status of the deletion would then be inaccurately returned. - // TODO: find a way to assuredly know if a document is deleted after deleteDoc is called. - - const userDoc = await getDoc(userRef) - if (!userDoc.exists()) throw Error("[FIREBASE] User does not exist.") - - await deleteDoc(userRef) + await connectedUsersCollection.doc(userID).delete() return true } catch (error) { diff --git a/server/src/actions/getConnectedUsers.ts b/server/src/actions/getConnectedUsers.ts index a3258abe6..038785e03 100644 --- a/server/src/actions/getConnectedUsers.ts +++ b/server/src/actions/getConnectedUsers.ts @@ -1,6 +1,7 @@ import { doc, endAt, getDocs, orderBy, query, startAt } from 'firebase/firestore' import { connectedUsers } from '../utilities/firebaseInit' import { distanceBetween, geohashForLocation, geohashQueryBounds } from 'geofire-common' +import { connectedUsersCollection } from '../utilities/adminInit' export const findNearbyUsers = async (centerLat: number, centerLon: number, radius: number) => { // Return an array of nearby userIds (which are also socket ids) given a center latitude and longitude. @@ -19,13 +20,13 @@ export const findNearbyUsers = async (centerLat: number, centerLon: number, radi for (const b of bounds) { const q = query( - connectedUsers, + connectedUsersCollection, // This is the collection of connected users (does this work?) orderBy('location.geohash'), startAt(b[0]), endAt(b[1]) ) - promises.push(getDocs(q)) + promises.push(connectedUsersCollection.getDocs(q)) } // Collect query results and append into a single array diff --git a/server/src/actions/updateConnectedUser.ts b/server/src/actions/updateConnectedUser.ts index c151a4d47..e061d7e3a 100644 --- a/server/src/actions/updateConnectedUser.ts +++ b/server/src/actions/updateConnectedUser.ts @@ -1,22 +1,16 @@ import { doc, getDoc, updateDoc } from '@firebase/firestore' import { connectedUsers } from '../utilities/firebaseInit' import { geohashForLocation} from 'geofire-common' +import { connectedUsersCollection } from '../utilities/adminInit' export const toggleUserConnectionStatus = async (index: string) => { try { - const userRef = doc(connectedUsers, index) - const userDoc = await getDoc(userRef) - - if (!userDoc.exists()) throw Error("[FIREBASE] User does not exist.") - - let status = userDoc.data()['isConnected'] - + let status = connectedUsersCollection.doc(index).isConnected // Flip the connection status status = !status - updateDoc(userRef, { isConnected: status }) + await connectedUsersCollection.doc(index).update({ isConnected: status }) return true - } catch (error) { console.error(error.message) return false diff --git a/server/src/index.ts b/server/src/index.ts index 926864984..0c8499244 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -5,11 +5,9 @@ import 'geofire-common' import { Message } from './types/Message'; import { createMessage } from './actions/createMessage' -// import { deleteMessageById } from './actions/deleteMessage' -// import { getUserById } from './actions/getUsers' import { createUser } from './actions/createConnectedUser' import { toggleUserConnectionStatus, updateUserLocation } from './actions/updateConnectedUser' -import { deleteConnectedUserByIndex } from './actions/deleteConnectedUser' +import { deleteConnectedUserByUID } from './actions/deleteConnectedUser' import {geohashForLocation} from 'geofire-common'; import { findNearbyUsers } from './actions/getConnectedUsers' import { ConnectedUser } from './types/User'; @@ -60,7 +58,7 @@ io.on('connection', (socket: any) => { socket.on('disconnect', () => { console.log(`[WS] User <${socket.id}> exited.`); - deleteConnectedUserByIndex(socket.id) + deleteConnectedUserByUID(socket.id) }) socket.on('ping', (ack) => { // The (ack) parameter stands for "acknowledgement." This function sends a message back to the originating socket. @@ -217,7 +215,7 @@ app.delete('/users', async (req, res) => { const userId = req.query.userId if (typeof userId != "string") throw Error(" [userId] is not a string.") - const success = await deleteConnectedUserByIndex(userId) + const success = await deleteConnectedUserByUID(userId) if (!success) throw Error(" deleteUserById() failed.") console.log(`[EXP] Request returned successfully.`) diff --git a/server/src/utilities/adminInit.ts b/server/src/utilities/adminInit.ts index 90092700e..77b725ec9 100644 --- a/server/src/utilities/adminInit.ts +++ b/server/src/utilities/adminInit.ts @@ -8,5 +8,7 @@ export const adminApp = admin.initializeApp({ }); export const db = admin.firestore(); +export const connectedUsersCollection = db.collection('users'); +export const messagesCollection = db.collection('messages'); console.log("[FIREBASE-ADMIN] Firebase admin SDK synced.") \ No newline at end of file From 1dc43e97482e57c79cbddfc63ce78fbbf831bfcd Mon Sep 17 00:00:00 2001 From: Mohammed Ali <146048575+Phantom0110@users.noreply.github.com> Date: Tue, 20 Feb 2024 18:28:06 -0500 Subject: [PATCH 22/24] Made error case for email in use display correctly in front end (#158) --- .../Auth/AuthenticationResponse.tsx | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/client/src/components/Auth/AuthenticationResponse.tsx b/client/src/components/Auth/AuthenticationResponse.tsx index cb74702f5..c2955772b 100644 --- a/client/src/components/Auth/AuthenticationResponse.tsx +++ b/client/src/components/Auth/AuthenticationResponse.tsx @@ -27,23 +27,22 @@ export const inValidEmailResponse = new CustomError("Invalid Email", "Please pro //Function that decodes the error code const decodeFirebaseError = (error: FirebaseError) => { - if(error.code === "auth/missing-email" || error.code === "auth/invalid-email") { - return "Please provide a valid email address"; + switch (error.code) { + case "auth/missing-email" || "auth/invalid-email": + return "Please provide a valid email address"; + case "auth/weak-password": + return "Password must be 6 characters or more"; + case "auth/missing-password": + return "Please provide a password"; + case "auth/invalid-credential": + return "The password or email is incorrect"; + case "auth/too-many-requests": + return "Too many requests, please try again later"; + case "auth/email-already-in-use": + return "Email already in use"; + default: + return "Unknown error"; } - - if(error.code === "auth/weak-password") { - return "Password must be 6 characters or more"; - } - - if(error.code === "auth/missing-password") { - return "Please provide a password"; - } - - if(error.code === "auth/invalid-credential") { - return "The password or email is incorrect"; - } - - return "Unknown error" } const decodeCustomError = (error: CustomError) => { From e3a223cef65dc96136c03392485c99dbf3cc1c28 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 20 Feb 2024 18:33:14 -0500 Subject: [PATCH 23/24] changed getConnectedUsers to admin --- server/src/actions/getConnectedUsers.ts | 27 ++++++++++--------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/server/src/actions/getConnectedUsers.ts b/server/src/actions/getConnectedUsers.ts index 038785e03..cae0b7792 100644 --- a/server/src/actions/getConnectedUsers.ts +++ b/server/src/actions/getConnectedUsers.ts @@ -19,21 +19,21 @@ export const findNearbyUsers = async (centerLat: number, centerLon: number, radi const promises = [] for (const b of bounds) { - const q = query( - connectedUsersCollection, // This is the collection of connected users (does this work?) - orderBy('location.geohash'), - startAt(b[0]), - endAt(b[1]) - ) - - promises.push(connectedUsersCollection.getDocs(q)) + const q = connectedUsersCollection + .orderBy('location.geohash') + .startAt(b[0]) + .endAt(b[1]) + + promises.push(q.get()) } // Collect query results and append into a single array const snapshots = await Promise.all(promises) const matchingDocs = [] + for (const snap of snapshots) { + for (const doc of snap.docs) { const lat = doc.get('location.lat') const lon = doc.get('location.lon') @@ -43,18 +43,13 @@ export const findNearbyUsers = async (centerLat: number, centerLon: number, radi const distanceInKm = distanceBetween([lat, lon], [centerLat, centerLon]) const distanceInM = distanceInKm * 1000 if (distanceInM <= radius) { - matchingDocs.push(doc) + matchingDocs.push(doc.get()) } } } - // Extract userIds from matched documents - const userSocketIds = [] - for (const doc of matchingDocs) { - userSocketIds.push(doc.data()['socketId']) - } - console.log(`getNearbyUsers(): ${userSocketIds.length} users found within ${radius} meters of ${centerLat}, ${centerLon}`) - return userSocketIds + console.log(`getNearbyUsers(): ${matchingDocs.length} users found within ${radius} meters of ${centerLat}, ${centerLon}`) + return matchingDocs } catch (error) { console.error("getNearbyUsers() failed.", error.message) } From e8cba5075e1bf79a54521eecc6ebb93a0c16f703 Mon Sep 17 00:00:00 2001 From: AlexanderWangY Date: Tue, 20 Feb 2024 22:04:28 -0500 Subject: [PATCH 24/24] migrated to firebase-admin --- server/package-lock.json | 535 ++-------------------- server/package.json | 1 - server/src/actions/createConnectedUser.ts | 2 - server/src/actions/createMessage.ts | 2 - server/src/actions/deleteConnectedUser.ts | 6 +- server/src/actions/getConnectedUsers.ts | 5 +- server/src/actions/updateConnectedUser.ts | 17 +- server/src/index.ts | 21 +- server/src/utilities/adminInit.ts | 2 - server/src/utilities/firebaseInit.ts | 28 -- 10 files changed, 60 insertions(+), 559 deletions(-) delete mode 100644 server/src/utilities/firebaseInit.ts diff --git a/server/package-lock.json b/server/package-lock.json index d8bb07258..7b3cba48b 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -13,7 +13,6 @@ "cors": "^2.8.5", "dotenv": "^16.3.1", "express": "^4.18.2", - "firebase": "^10.5.0", "firebase-admin": "^12.0.0", "geofire-common": "^6.0.0", "socket.io": "^4.7.4", @@ -1805,169 +1804,21 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "node_modules/@fastify/busboy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", - "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", - "engines": { - "node": ">=14" - } - }, - "node_modules/@firebase/analytics": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.10.1.tgz", - "integrity": "sha512-5mnH1aQa99J5lZMJwTNzIoRc4yGXHf+fOn+EoEWhCDA3XGPweGHcylCbqq+G1wVJmfILL57fohDMa8ftMZ+44g==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/installations": "0.6.5", - "@firebase/logger": "0.4.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app": "0.x" - } - }, - "node_modules/@firebase/analytics-compat": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/@firebase/analytics-compat/-/analytics-compat-0.2.7.tgz", - "integrity": "sha512-17VCly4P0VFBDqaaal7m1nhyYQwsygtaTpSsnc51sFPRrr9XIYtnD8ficon9fneEGEoJQ2g7OtASvhwX9EbK8g==", - "dependencies": { - "@firebase/analytics": "0.10.1", - "@firebase/analytics-types": "0.8.0", - "@firebase/component": "0.6.5", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app-compat": "0.x" - } - }, - "node_modules/@firebase/analytics-types": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@firebase/analytics-types/-/analytics-types-0.8.0.tgz", - "integrity": "sha512-iRP+QKI2+oz3UAh4nPEq14CsEjrjD6a5+fuypjScisAh9kXKFvdJOZJDwk7kikLvWVLGEs9+kIUS4LPQV7VZVw==" - }, - "node_modules/@firebase/app": { - "version": "0.9.27", - "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.9.27.tgz", - "integrity": "sha512-p2Dvl1ge4kRsyK5+wWcmdAIE9MSwZ0pDKAYB51LZgZuz6wciUZk4E1yAEdkfQlRxuHehn+Ol9WP5Qk2XQZiHGg==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/logger": "0.4.0", - "@firebase/util": "1.9.4", - "idb": "7.1.1", - "tslib": "^2.1.0" - } - }, - "node_modules/@firebase/app-check": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/@firebase/app-check/-/app-check-0.8.2.tgz", - "integrity": "sha512-A2B5+ldOguYAeqW1quFN5qNdruSNRrg4W59ag1Eq6QzxuHNIkrE+TrapfrW/z5NYFjCxAYqr/unVCgmk80Dwcg==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/logger": "0.4.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app": "0.x" - } - }, - "node_modules/@firebase/app-check-compat": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@firebase/app-check-compat/-/app-check-compat-0.3.9.tgz", - "integrity": "sha512-7LxyupQ8XeEHRh72mO+tqm69kHT6KbWi2KtFMGedJ6tNbwzFzojcXESMKN8RpADXbYoQgY3loWMJjMx4r2Zt7w==", - "dependencies": { - "@firebase/app-check": "0.8.2", - "@firebase/app-check-types": "0.5.0", - "@firebase/component": "0.6.5", - "@firebase/logger": "0.4.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app-compat": "0.x" - } - }, "node_modules/@firebase/app-check-interop-types": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@firebase/app-check-interop-types/-/app-check-interop-types-0.3.0.tgz", "integrity": "sha512-xAxHPZPIgFXnI+vb4sbBjZcde7ZluzPPaSK7Lx3/nmuVk4TjZvnL8ONnkd4ERQKL8WePQySU+pRcWkh8rDf5Sg==" }, - "node_modules/@firebase/app-check-types": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@firebase/app-check-types/-/app-check-types-0.5.0.tgz", - "integrity": "sha512-uwSUj32Mlubybw7tedRzR24RP8M8JUVR3NPiMk3/Z4bCmgEKTlQBwMXrehDAZ2wF+TsBq0SN1c6ema71U/JPyQ==" - }, - "node_modules/@firebase/app-compat": { - "version": "0.2.27", - "resolved": "https://registry.npmjs.org/@firebase/app-compat/-/app-compat-0.2.27.tgz", - "integrity": "sha512-SYlqocfUDKPHR6MSFC8hree0BTiWFu5o8wbf6zFlYXyG41w7TcHp4wJi4H/EL5V6cM4kxwruXTJtqXX/fRAZtw==", - "dependencies": { - "@firebase/app": "0.9.27", - "@firebase/component": "0.6.5", - "@firebase/logger": "0.4.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - } - }, "node_modules/@firebase/app-types": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/@firebase/app-types/-/app-types-0.9.0.tgz", "integrity": "sha512-AeweANOIo0Mb8GiYm3xhTEBVCmPwTYAu9Hcd2qSkLuga/6+j9b1Jskl5bpiSQWy9eJ/j5pavxj6eYogmnuzm+Q==" }, - "node_modules/@firebase/auth": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@firebase/auth/-/auth-1.6.0.tgz", - "integrity": "sha512-Qhl35eJTV6BwvuueTPCY6x8kUlYyzALtjp/Ws0X3fw3AnjVVfuVb7oQ3Xh5VPVfMFhaIuUAd1KXwcAuIklkSDw==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/logger": "0.4.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0", - "undici": "5.26.5" - }, - "peerDependencies": { - "@firebase/app": "0.x", - "@react-native-async-storage/async-storage": "^1.18.1" - }, - "peerDependenciesMeta": { - "@react-native-async-storage/async-storage": { - "optional": true - } - } - }, - "node_modules/@firebase/auth-compat": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@firebase/auth-compat/-/auth-compat-0.5.2.tgz", - "integrity": "sha512-pRgje5BPCNR1vXyvGOVXwOHtv88A2WooXfklI8sV7/jWi03ExFqNfpJT26GUo/oD39NoKJ3Kt6rD5gVvdV7lMw==", - "dependencies": { - "@firebase/auth": "1.6.0", - "@firebase/auth-types": "0.12.0", - "@firebase/component": "0.6.5", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0", - "undici": "5.26.5" - }, - "peerDependencies": { - "@firebase/app-compat": "0.x" - } - }, "node_modules/@firebase/auth-interop-types": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/@firebase/auth-interop-types/-/auth-interop-types-0.2.1.tgz", "integrity": "sha512-VOaGzKp65MY6P5FI84TfYKBXEPi6LmOCSMMzys6o2BN2LOsqy7pCuZCup7NYnfbk5OkkQKzvIfHOzTm0UDpkyg==" }, - "node_modules/@firebase/auth-types": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@firebase/auth-types/-/auth-types-0.12.0.tgz", - "integrity": "sha512-pPwaZt+SPOshK8xNoiQlK5XIrS97kFYc3Rc7xmy373QsOJ9MmqXxLaYssP5Kcds4wd2qK//amx/c+A8O2fVeZA==", - "peerDependencies": { - "@firebase/app-types": "0.x", - "@firebase/util": "1.x" - } - }, "node_modules/@firebase/component": { "version": "0.6.5", "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.5.tgz", @@ -2013,125 +1864,6 @@ "@firebase/util": "1.9.4" } }, - "node_modules/@firebase/firestore": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-4.4.2.tgz", - "integrity": "sha512-YaX6ypa/RzU6OkxzUQlpSxwhOIWdTraCNz7sMsbaSEjjl/pj/QvX6TqjkdWGzuBYh2S6rz7ErhDO0g39oZZw/g==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/logger": "0.4.0", - "@firebase/util": "1.9.4", - "@firebase/webchannel-wrapper": "0.10.5", - "@grpc/grpc-js": "~1.9.0", - "@grpc/proto-loader": "^0.7.8", - "tslib": "^2.1.0", - "undici": "5.26.5" - }, - "engines": { - "node": ">=10.10.0" - }, - "peerDependencies": { - "@firebase/app": "0.x" - } - }, - "node_modules/@firebase/firestore-compat": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@firebase/firestore-compat/-/firestore-compat-0.3.25.tgz", - "integrity": "sha512-+xI7WmsgZCBhMn/+uhDKcg+lsOUJ9FJyt5PGTzkFPbCsozWfeQZ7eVnfPh0rMkUOf0yIQ924RIe04gwvEIbcoQ==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/firestore": "4.4.2", - "@firebase/firestore-types": "3.0.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app-compat": "0.x" - } - }, - "node_modules/@firebase/firestore-types": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@firebase/firestore-types/-/firestore-types-3.0.0.tgz", - "integrity": "sha512-Meg4cIezHo9zLamw0ymFYBD4SMjLb+ZXIbuN7T7ddXN6MGoICmOTq3/ltdCGoDCS2u+H1XJs2u/cYp75jsX9Qw==", - "peerDependencies": { - "@firebase/app-types": "0.x", - "@firebase/util": "1.x" - } - }, - "node_modules/@firebase/functions": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/@firebase/functions/-/functions-0.11.1.tgz", - "integrity": "sha512-3uUa1hB79Gmy6E1gHTfzoHeZolBeHc/I/n3+lOCDe6BOos9AHmzRjKygcFE/7VA2FJjitCE0K+OHI6+OuoY8fQ==", - "dependencies": { - "@firebase/app-check-interop-types": "0.3.0", - "@firebase/auth-interop-types": "0.2.1", - "@firebase/component": "0.6.5", - "@firebase/messaging-interop-types": "0.2.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0", - "undici": "5.26.5" - }, - "peerDependencies": { - "@firebase/app": "0.x" - } - }, - "node_modules/@firebase/functions-compat": { - "version": "0.3.7", - "resolved": "https://registry.npmjs.org/@firebase/functions-compat/-/functions-compat-0.3.7.tgz", - "integrity": "sha512-uXe6Kmku5lNogp3OpPBcOJbSvnaCOn+YxS3zlXKNU6Q/NLwcvO3RY1zwYyctCos2RemEw3KEQ7YdzcECXjHWLw==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/functions": "0.11.1", - "@firebase/functions-types": "0.6.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app-compat": "0.x" - } - }, - "node_modules/@firebase/functions-types": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@firebase/functions-types/-/functions-types-0.6.0.tgz", - "integrity": "sha512-hfEw5VJtgWXIRf92ImLkgENqpL6IWpYaXVYiRkFY1jJ9+6tIhWM7IzzwbevwIIud/jaxKVdRzD7QBWfPmkwCYw==" - }, - "node_modules/@firebase/installations": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@firebase/installations/-/installations-0.6.5.tgz", - "integrity": "sha512-0xxnQWw8rSRzu0ZOCkZaO+MJ0LkDAfwwTB2Z1SxRK6FAz5xkxD1ZUwM0WbCRni49PKubCrZYOJ6yg7tSjU7AKA==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/util": "1.9.4", - "idb": "7.1.1", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app": "0.x" - } - }, - "node_modules/@firebase/installations-compat": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@firebase/installations-compat/-/installations-compat-0.2.5.tgz", - "integrity": "sha512-usvoIaog5CHEw082HXLrKAZ1qd4hIC3N/LDe2NqBgI3pkGE/7auLVM4Gn5gvyryp0x8z/IP1+d9fkGUj2OaGLQ==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/installations": "0.6.5", - "@firebase/installations-types": "0.5.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app-compat": "0.x" - } - }, - "node_modules/@firebase/installations-types": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@firebase/installations-types/-/installations-types-0.5.0.tgz", - "integrity": "sha512-9DP+RGfzoI2jH7gY4SlzqvZ+hr7gYzPODrbzVD82Y12kScZ6ZpRg/i3j6rleto8vTFC8n6Len4560FnV1w2IRg==", - "peerDependencies": { - "@firebase/app-types": "0.x" - } - }, "node_modules/@firebase/logger": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", @@ -2140,151 +1872,6 @@ "tslib": "^2.1.0" } }, - "node_modules/@firebase/messaging": { - "version": "0.12.6", - "resolved": "https://registry.npmjs.org/@firebase/messaging/-/messaging-0.12.6.tgz", - "integrity": "sha512-IORsPp9IPWq4j4yEhTOZ6GAGi3gQwGc+4yexmTAlya+qeBRSdRnJg2iIU/aj+tcKDQYr9RQuQPgHHOdFIx//vA==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/installations": "0.6.5", - "@firebase/messaging-interop-types": "0.2.0", - "@firebase/util": "1.9.4", - "idb": "7.1.1", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app": "0.x" - } - }, - "node_modules/@firebase/messaging-compat": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/@firebase/messaging-compat/-/messaging-compat-0.2.6.tgz", - "integrity": "sha512-Q2xC1s4L7Vpss7P7Gy6GuIS+xmJrf/vm9+gX76IK1Bo1TjoKwleCLHt1LHkPz5Rvqg5pTgzzI8qqPhBpZosFCg==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/messaging": "0.12.6", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app-compat": "0.x" - } - }, - "node_modules/@firebase/messaging-interop-types": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@firebase/messaging-interop-types/-/messaging-interop-types-0.2.0.tgz", - "integrity": "sha512-ujA8dcRuVeBixGR9CtegfpU4YmZf3Lt7QYkcj693FFannwNuZgfAYaTmbJ40dtjB81SAu6tbFPL9YLNT15KmOQ==" - }, - "node_modules/@firebase/performance": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@firebase/performance/-/performance-0.6.5.tgz", - "integrity": "sha512-OzAGcWhOqEFH9GdwUuY0oC5FSlnMejcnmSAhR+EjpI7exdDvixyLyCR4txjSHYNTbumrFBG+EP8GO11CNXRaJA==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/installations": "0.6.5", - "@firebase/logger": "0.4.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app": "0.x" - } - }, - "node_modules/@firebase/performance-compat": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@firebase/performance-compat/-/performance-compat-0.2.5.tgz", - "integrity": "sha512-jJwJkVyDcIMBaVGrZ6CRGs4m5FCZsWB5QCWYI3FdsHyIa9/TfteNDilxj9wGciF2naFIHDW7TgE69U5dAH9Ktg==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/logger": "0.4.0", - "@firebase/performance": "0.6.5", - "@firebase/performance-types": "0.2.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app-compat": "0.x" - } - }, - "node_modules/@firebase/performance-types": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@firebase/performance-types/-/performance-types-0.2.0.tgz", - "integrity": "sha512-kYrbr8e/CYr1KLrLYZZt2noNnf+pRwDq2KK9Au9jHrBMnb0/C9X9yWSXmZkFt4UIdsQknBq8uBB7fsybZdOBTA==" - }, - "node_modules/@firebase/remote-config": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/@firebase/remote-config/-/remote-config-0.4.5.tgz", - "integrity": "sha512-rGLqc/4OmxrS39RA9kgwa6JmgWytQuMo+B8pFhmGp3d++x2Hf9j+MLQfhOLyyUo64fNw20J19mLXhrXvKHsjZQ==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/installations": "0.6.5", - "@firebase/logger": "0.4.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app": "0.x" - } - }, - "node_modules/@firebase/remote-config-compat": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@firebase/remote-config-compat/-/remote-config-compat-0.2.5.tgz", - "integrity": "sha512-ImkNnLuGrD/bylBHDJigSY6LMwRrwt37wQbsGZhWG4QQ6KLzHzSf0nnFRRFvkOZodEUE57Ib8l74d6Yn/6TDUQ==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/logger": "0.4.0", - "@firebase/remote-config": "0.4.5", - "@firebase/remote-config-types": "0.3.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app-compat": "0.x" - } - }, - "node_modules/@firebase/remote-config-types": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@firebase/remote-config-types/-/remote-config-types-0.3.0.tgz", - "integrity": "sha512-RtEH4vdcbXZuZWRZbIRmQVBNsE7VDQpet2qFvq6vwKLBIQRQR5Kh58M4ok3A3US8Sr3rubYnaGqZSurCwI8uMA==" - }, - "node_modules/@firebase/storage": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/@firebase/storage/-/storage-0.12.1.tgz", - "integrity": "sha512-KJ5NV7FUh54TeTlEjdkTTX60ciCKOp9EqlbLnpdcXUYRJg0Z4810TXbilPc1z7fTIG4iPjtdi95bGE9n4dBX8A==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0", - "undici": "5.26.5" - }, - "peerDependencies": { - "@firebase/app": "0.x" - } - }, - "node_modules/@firebase/storage-compat": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@firebase/storage-compat/-/storage-compat-0.3.4.tgz", - "integrity": "sha512-Y0m5e2gS/wB9Ioth2X/Sgz76vcxvqgQrCmfa9qwhss/N31kxY2Gks6Frv0nrE18AjVfcSmcfDitqUwxcMOTRSg==", - "dependencies": { - "@firebase/component": "0.6.5", - "@firebase/storage": "0.12.1", - "@firebase/storage-types": "0.8.0", - "@firebase/util": "1.9.4", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@firebase/app-compat": "0.x" - } - }, - "node_modules/@firebase/storage-types": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@firebase/storage-types/-/storage-types-0.8.0.tgz", - "integrity": "sha512-isRHcGrTs9kITJC0AVehHfpraWFui39MPaU7Eo8QfWlqW7YPymBmRgjDrlOgFdURh6Cdeg07zmkLP5tzTKRSpg==", - "peerDependencies": { - "@firebase/app-types": "0.x", - "@firebase/util": "1.x" - } - }, "node_modules/@firebase/util": { "version": "1.9.4", "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.4.tgz", @@ -2293,11 +1880,6 @@ "tslib": "^2.1.0" } }, - "node_modules/@firebase/webchannel-wrapper": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@firebase/webchannel-wrapper/-/webchannel-wrapper-0.10.5.tgz", - "integrity": "sha512-eSkJsnhBWv5kCTSU1tSUVl9mpFu+5NXXunZc83le8GMjMlsWwQArSc7cJJ4yl+aDFY0NGLi0AjZWMn1axOrkRg==" - }, "node_modules/@google-cloud/firestore": { "version": "7.3.0", "resolved": "https://registry.npmjs.org/@google-cloud/firestore/-/firestore-7.3.0.tgz", @@ -2393,22 +1975,11 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/@grpc/grpc-js": { - "version": "1.9.14", - "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.14.tgz", - "integrity": "sha512-nOpuzZ2G3IuMFN+UPPpKrC6NsLmWsTqSsm66IRfnBt1D4pwTqE27lmbpcPM+l2Ua4gE7PfjRHI6uedAy7hoXUw==", - "dependencies": { - "@grpc/proto-loader": "^0.7.8", - "@types/node": ">=12.12.47" - }, - "engines": { - "node": "^8.13.0 || >=10.10.0" - } - }, "node_modules/@grpc/proto-loader": { "version": "0.7.10", "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.10.tgz", "integrity": "sha512-CAqDfoaQ8ykFd9zqBDn4k6iWT9loLAlc2ETmDFS9JCD70gDcnA4L3AFEo2iV7KyAtAAHFW9ftq1Fz+Vsgq80RQ==", + "optional": true, "dependencies": { "lodash.camelcase": "^4.3.0", "long": "^5.0.0", @@ -3126,27 +2697,32 @@ "node_modules/@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "optional": true }, "node_modules/@protobufjs/base64": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "optional": true }, "node_modules/@protobufjs/codegen": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "optional": true }, "node_modules/@protobufjs/eventemitter": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "optional": true }, "node_modules/@protobufjs/fetch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "optional": true, "dependencies": { "@protobufjs/aspromise": "^1.1.1", "@protobufjs/inquire": "^1.1.0" @@ -3155,27 +2731,32 @@ "node_modules/@protobufjs/float": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "optional": true }, "node_modules/@protobufjs/inquire": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "optional": true }, "node_modules/@protobufjs/path": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "optional": true }, "node_modules/@protobufjs/pool": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "optional": true }, "node_modules/@protobufjs/utf8": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "optional": true }, "node_modules/@sinclair/typebox": { "version": "0.27.8", @@ -3577,6 +3158,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "devOptional": true, "engines": { "node": ">=8" } @@ -4173,6 +3755,7 @@ "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "devOptional": true, "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", @@ -4580,7 +4163,8 @@ "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "devOptional": true }, "node_modules/encodeurl": { "version": "1.0.2", @@ -4686,6 +4270,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "devOptional": true, "engines": { "node": ">=6" } @@ -4960,39 +4545,6 @@ "node": ">=8" } }, - "node_modules/firebase": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/firebase/-/firebase-10.8.0.tgz", - "integrity": "sha512-UJpC24vw8JFuHEOQyArBGKTUd7+kohLISCzHyn0M/prP0KOTx2io1eyLliEid330QqnWI7FOlPxoU97qecCSfQ==", - "dependencies": { - "@firebase/analytics": "0.10.1", - "@firebase/analytics-compat": "0.2.7", - "@firebase/app": "0.9.27", - "@firebase/app-check": "0.8.2", - "@firebase/app-check-compat": "0.3.9", - "@firebase/app-compat": "0.2.27", - "@firebase/app-types": "0.9.0", - "@firebase/auth": "1.6.0", - "@firebase/auth-compat": "0.5.2", - "@firebase/database": "1.0.3", - "@firebase/database-compat": "1.0.3", - "@firebase/firestore": "4.4.2", - "@firebase/firestore-compat": "0.3.25", - "@firebase/functions": "0.11.1", - "@firebase/functions-compat": "0.3.7", - "@firebase/installations": "0.6.5", - "@firebase/installations-compat": "0.2.5", - "@firebase/messaging": "0.12.6", - "@firebase/messaging-compat": "0.2.6", - "@firebase/performance": "0.6.5", - "@firebase/performance-compat": "0.2.5", - "@firebase/remote-config": "0.4.5", - "@firebase/remote-config-compat": "0.2.5", - "@firebase/storage": "0.12.1", - "@firebase/storage-compat": "0.3.4", - "@firebase/util": "1.9.4" - } - }, "node_modules/firebase-admin": { "version": "12.0.0", "resolved": "https://registry.npmjs.org/firebase-admin/-/firebase-admin-12.0.0.tgz", @@ -5154,6 +4706,7 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "devOptional": true, "engines": { "node": "6.* || 8.* || >= 10.*" } @@ -5501,11 +5054,6 @@ "node": ">=0.10.0" } }, - "node_modules/idb": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz", - "integrity": "sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==" - }, "node_modules/ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", @@ -5606,6 +5154,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "devOptional": true, "engines": { "node": ">=8" } @@ -7551,7 +7100,8 @@ "node_modules/lodash.camelcase": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "optional": true }, "node_modules/lodash.clonedeep": { "version": "4.5.0", @@ -7602,7 +7152,8 @@ "node_modules/long": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", + "optional": true }, "node_modules/lru-cache": { "version": "5.1.1", @@ -8216,6 +7767,7 @@ "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.6.tgz", "integrity": "sha512-dgJaEDDL6x8ASUZ1YqWciTRrdOuYNzoOf27oHNfdyvKqHr5i0FV7FSLU+aIeFjyFgVxrpTOtQUi0BLLBymZaBw==", "hasInstallScript": true, + "optional": true, "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -8421,6 +7973,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "devOptional": true, "engines": { "node": ">=0.10.0" } @@ -8855,6 +8408,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "devOptional": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -8868,6 +8422,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "devOptional": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -9154,17 +8709,6 @@ "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", "dev": true }, - "node_modules/undici": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.26.5.tgz", - "integrity": "sha512-cSb4bPFd5qgR7qr2jYAi0hlX9n5YKK2ONKkLFkxl+v/9BvC0sOpZjBHDBSXc5lWAf5ty9oZdRXytBIHzgUcerw==", - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=14.0" - } - }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -9367,6 +8911,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "devOptional": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -9383,6 +8928,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "devOptional": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -9397,6 +8943,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "devOptional": true, "dependencies": { "color-name": "~1.1.4" }, @@ -9407,7 +8954,8 @@ "node_modules/wrap-ansi/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "devOptional": true }, "node_modules/wrappy": { "version": "1.0.2", @@ -9461,6 +9009,7 @@ "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "devOptional": true, "engines": { "node": ">=10" } @@ -9475,6 +9024,7 @@ "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "devOptional": true, "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -9492,6 +9042,7 @@ "version": "21.1.1", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "devOptional": true, "engines": { "node": ">=12" } diff --git a/server/package.json b/server/package.json index 39f4fcfb7..9af60ca12 100644 --- a/server/package.json +++ b/server/package.json @@ -28,7 +28,6 @@ "cors": "^2.8.5", "dotenv": "^16.3.1", "express": "^4.18.2", - "firebase": "^10.5.0", "firebase-admin": "^12.0.0", "geofire-common": "^6.0.0", "socket.io": "^4.7.4", diff --git a/server/src/actions/createConnectedUser.ts b/server/src/actions/createConnectedUser.ts index 2d6f49490..d06cf6854 100644 --- a/server/src/actions/createConnectedUser.ts +++ b/server/src/actions/createConnectedUser.ts @@ -1,6 +1,4 @@ // Uploads a new document in the ConnectedUsers collection. -import { doc, setDoc } from '@firebase/firestore' -import { connectedUsers } from '../utilities/firebaseInit' import { ConnectedUser } from '../types/User' import { connectedUsersCollection } from '../utilities/adminInit'; diff --git a/server/src/actions/createMessage.ts b/server/src/actions/createMessage.ts index 00d863ce9..8494db672 100644 --- a/server/src/actions/createMessage.ts +++ b/server/src/actions/createMessage.ts @@ -1,6 +1,4 @@ // Uploads a new document in the Messages collection. -import { doc, setDoc } from '@firebase/firestore' -import { messages } from '../utilities/firebaseInit' import { Message } from '../types/Message' import { messagesCollection } from '../utilities/adminInit' diff --git a/server/src/actions/deleteConnectedUser.ts b/server/src/actions/deleteConnectedUser.ts index 08baee8e0..a6a968780 100644 --- a/server/src/actions/deleteConnectedUser.ts +++ b/server/src/actions/deleteConnectedUser.ts @@ -1,11 +1,9 @@ // Delete a ConnectedUser document given a document's index. This should typically be a socketId, but it can also be something else. -import { doc, getDoc, deleteDoc } from '@firebase/firestore' -import { connectedUsers } from '../utilities/firebaseInit' import { connectedUsersCollection } from '../utilities/adminInit' -export const deleteConnectedUserByUID = async (userID: string) => { +export const deleteConnectedUserByUID = async (socketID: string) => { try { - await connectedUsersCollection.doc(userID).delete() + await connectedUsersCollection.doc(socketID).delete() return true } catch (error) { diff --git a/server/src/actions/getConnectedUsers.ts b/server/src/actions/getConnectedUsers.ts index cae0b7792..c2567abd0 100644 --- a/server/src/actions/getConnectedUsers.ts +++ b/server/src/actions/getConnectedUsers.ts @@ -1,5 +1,3 @@ -import { doc, endAt, getDocs, orderBy, query, startAt } from 'firebase/firestore' -import { connectedUsers } from '../utilities/firebaseInit' import { distanceBetween, geohashForLocation, geohashQueryBounds } from 'geofire-common' import { connectedUsersCollection } from '../utilities/adminInit' @@ -43,12 +41,13 @@ export const findNearbyUsers = async (centerLat: number, centerLon: number, radi const distanceInKm = distanceBetween([lat, lon], [centerLat, centerLon]) const distanceInM = distanceInKm * 1000 if (distanceInM <= radius) { - matchingDocs.push(doc.get()) + matchingDocs.push(doc.get('socketId')) } } } console.log(`getNearbyUsers(): ${matchingDocs.length} users found within ${radius} meters of ${centerLat}, ${centerLon}`) + console.log(matchingDocs) return matchingDocs } catch (error) { console.error("getNearbyUsers() failed.", error.message) diff --git a/server/src/actions/updateConnectedUser.ts b/server/src/actions/updateConnectedUser.ts index e061d7e3a..c935ae7c6 100644 --- a/server/src/actions/updateConnectedUser.ts +++ b/server/src/actions/updateConnectedUser.ts @@ -1,15 +1,13 @@ -import { doc, getDoc, updateDoc } from '@firebase/firestore' -import { connectedUsers } from '../utilities/firebaseInit' import { geohashForLocation} from 'geofire-common' import { connectedUsersCollection } from '../utilities/adminInit' -export const toggleUserConnectionStatus = async (index: string) => { +export const toggleUserConnectionStatus = async (socketID: string) => { try { - let status = connectedUsersCollection.doc(index).isConnected + let status = connectedUsersCollection.doc(socketID).isConnected // Flip the connection status status = !status - await connectedUsersCollection.doc(index).update({ isConnected: status }) + await connectedUsersCollection.doc(socketID).update({ isConnected: status }) return true } catch (error) { console.error(error.message) @@ -17,16 +15,11 @@ export const toggleUserConnectionStatus = async (index: string) => { } } -export const updateUserLocation = async (userIndex: string, lat: number, lon: number) => { +export const updateUserLocation = async (socketID: string, lat: number, lon: number) => { try { - const ref = doc(connectedUsers, userIndex) - const userDoc = await getDoc(ref) - - if (!userDoc.exists()) throw Error("[FIREBASE] User does not exist.") - const newHash = geohashForLocation([lat, lon]) - updateDoc(ref, { "location.lat": lat, "location.lon": lon, "location.geohash": newHash }) + await connectedUsersCollection.doc(socketID).update({ "location.lat": lat, "location.lon": lon, "location.geohash": newHash }) return true } catch (error) { console.error(error.message) diff --git a/server/src/index.ts b/server/src/index.ts index 0c8499244..e835cc56a 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -1,9 +1,7 @@ import express from 'express' import 'dotenv/config' import 'geofire-common' - import { Message } from './types/Message'; - import { createMessage } from './actions/createMessage' import { createUser } from './actions/createConnectedUser' import { toggleUserConnectionStatus, updateUserLocation } from './actions/updateConnectedUser' @@ -11,18 +9,15 @@ import { deleteConnectedUserByUID } from './actions/deleteConnectedUser' import {geohashForLocation} from 'geofire-common'; import { findNearbyUsers } from './actions/getConnectedUsers' import { ConnectedUser } from './types/User'; -import { adminApp } from './utilities/adminInit'; + const { createServer } = require('http') const { Server } = require('socket.io') - -adminApp.firestore() - - const socket_port = process.env.socket_port const express_port = process.env.express_port const app = express() +// Middleware app.use(express.json()) app.use(express.urlencoded({ extended: true })) @@ -37,7 +32,7 @@ const io = new Server(socketServer, { }, }); -io.on('connection', (socket: any) => { +io.on('connection', async (socket: any) => { console.log(`[WS] User <${socket.id}> connected.`); const defaultConnectedUser: ConnectedUser = { uid: "UID", @@ -53,8 +48,8 @@ io.on('connection', (socket: any) => { geohash: "F" } } // TODO: Send this info from client on connection - createUser(defaultConnectedUser) - toggleUserConnectionStatus(socket.id) + await createUser(defaultConnectedUser) + await toggleUserConnectionStatus(socket.id) socket.on('disconnect', () => { console.log(`[WS] User <${socket.id}> exited.`); @@ -101,11 +96,11 @@ io.on('connection', (socket: any) => { console.error("[WS] Error sending message:", error.message) } }) - socket.on('updateLocation', async (message, ack) => { + socket.on('updateLocation', async (location, ack) => { console.log(`[WS] Recieved new location from user <${socket.id}>.`) try { - const lat = Number(message.lat) - const lon = Number(message.lon) + const lat = Number(location.lat) + const lon = Number(location.lon) const success = await updateUserLocation(socket.id, lat, lon) if (success) { console.log("[WS] Location updated in database successfully.") diff --git a/server/src/utilities/adminInit.ts b/server/src/utilities/adminInit.ts index 77b725ec9..a96ac473c 100644 --- a/server/src/utilities/adminInit.ts +++ b/server/src/utilities/adminInit.ts @@ -1,5 +1,3 @@ -const { initializeApp } = require('firebase-admin/app'); -const { getFirestore } = require('firebase-admin/firestore'); const admin = require('firebase-admin'); const serviceAccount = require("../../src/private_key/private.json"); diff --git a/server/src/utilities/firebaseInit.ts b/server/src/utilities/firebaseInit.ts deleted file mode 100644 index bc5a2b351..000000000 --- a/server/src/utilities/firebaseInit.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { initializeApp } from 'firebase/app' -import { getFirestore, CollectionReference, collection, DocumentData } from 'firebase/firestore' -import 'dotenv/config'; - -export const firebaseApp = initializeApp({ - apiKey: process.env.API_KEY, - authDomain: process.env.AUTH_DOMAIN, - projectId: process.env.PROJECT_ID, - storageBucket: process.env.STORAGE_BUCKET, - messagingSenderId: process.env.MESSAGING_SENDER_ID, - appId: process.env.APP_ID -}) - -export const firestore = getFirestore() - -const createCollection = (collectionName: string) => { - return collection(firestore, collectionName) as CollectionReference; -} - -import { Message } from '../types/Message' -import { ConnectedUser, UserConfig } from '../types/User' - -export const messages = createCollection('Messages') -export const connectedUsers = createCollection('ConnectedUsers') -export const userConfigs = createCollection('UserConfigs') - -console.log("[FIRESTORE] Database synced.") -