Files
ui/pkg/auth/server/stub-server.ts
zeekay ce8cf94ef8 feat(auth): make Firebase optional, add @hanzo/auth-firebase package
- Create @hanzo/auth-firebase v1.0.0 as optional Firebase provider
- Update @hanzo/auth v2.6.0 with pluggable auth provider system
- Update @hanzo/commerce v7.4.0 with optional Firebase peer dependency
- Add StubAuthService for graceful failures when no provider configured
- Add registerAuthProvider() for runtime provider registration

BREAKING CHANGE: Firebase is no longer bundled with @hanzo/auth.
Install @hanzo/auth-firebase and register it if you need Firebase auth:

  import { FirebaseAuthService } from '@hanzo/auth-firebase'
  import { registerAuthProvider } from '@hanzo/auth'
  registerAuthProvider('firebase', FirebaseAuthService)
2026-01-24 13:14:08 -08:00

29 lines
1.1 KiB
TypeScript

/**
* Stub Server-side Authentication
*
* Used when Firebase Admin is not configured.
* All functions return null/false gracefully.
*/
import type { HanzoUserInfoValue } from '../types'
export async function getUserServerSide(): Promise<HanzoUserInfoValue | null> {
console.warn('Server-side auth not configured. Install @hanzo/auth-firebase for Firebase support.')
return null
}
export async function generateCustomToken(): Promise<{success: boolean, token: string | null}> {
console.warn('Server-side auth not configured. Install @hanzo/auth-firebase for Firebase support.')
return { success: false, token: null }
}
export async function createSessionCookie(_idToken: string, _sessionCookieOptions: any): Promise<string> {
console.warn('Server-side auth not configured. Install @hanzo/auth-firebase for Firebase support.')
throw new Error('Auth provider not configured')
}
export async function revokeAllSessions(_session: string): Promise<void> {
console.warn('Server-side auth not configured. Install @hanzo/auth-firebase for Firebase support.')
throw new Error('Auth provider not configured')
}