import * as admin from 'firebase-admin' ; let firebasePrivateKey = process . env . FIREBASE_PRIVATE_KEY ! ; if ( ! admin . apps . length ) { admin . initializeApp ( { credential : admin . credential . cert ( { projectId : process . env . NEXT_PUBLIC_FIREBASE_PROJECT_ID , clientEmail : process . env . FIREBASE_CLIENT_EMAIL , privateKey : firebasePrivateKey . replace ( /\\n/g , '\n' ) , } ) , databaseURL : process . env . NEXT_PUBLIC_FIREBASE_DATABASE_URL , } ) ; } export const verifyIdToken = ( token ) => { return admin . auth ( ) . verifyIdToken ( token ) . catch ( ( error ) => { throw error ; } ) ; } ; export default admin ;