-
Notifications
You must be signed in to change notification settings - Fork 69
Implement secure ephemeral key generation for OpenAI Realtime API #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Replace direct API key exposure with secure ephemeral key generation - Make server-side POST request to OpenAI /v1/realtime/sessions endpoint - Return temporary ephemeral key that expires after 1-2 hours - Keep API key secure on server, never expose to frontend - Return session ID and expiration timestamp with ephemeral key This follows OpenAI's security best practices for client-side applications Co-Authored-By: Claude <[email protected]>
Claude finished @vijaythecoder's task —— View job Code Review for Ephemeral Key ImplementationI'll review this PR for code quality, security, performance, and potential issues. Todo List:
Review Findings✅ StrengthsSecurity Improvements:
Code Quality:
|
- Add null checks for nested response data before accessing - Validate client_secret structure exists in response - Add default values for optional fields (sessionId, model) - Improve error logging with response data for debugging - Prevent potential runtime errors from missing response keys Co-Authored-By: Claude <[email protected]>
Claude finished @vijaythecoder's task —— View job Code Review for Ephemeral Key ImplementationI'll provide a comprehensive review of this PR focusing on code quality, security, performance, and potential issues. Todo List:
Review Findings✅ Excellent Improvements MadeResponse Validation Fixed:
✅ StrengthsSecurity Implementation:
Code Quality:
|
Summary
/v1/realtime/sessions
endpointChanges
RealtimeController::generateEphemeralKey()
to call OpenAI APISecurity Benefits
Technical Details
The ephemeral key generation flow:
/api/realtime/ephemeral-key
https://api.openai.com/v1/realtime/sessions
This ensures the actual API key is never exposed to client-side code.
🤖 Generated with Claude Code