feat(chat): Validate and cache remote user public keys for encryption
- Add validation to check if cached users have valid public keys (PEM format) - Fetch remote public keys when local cache has placeholder/invalid keys - Update existing cached users with real public keys instead of creating duplicates - Include public key in user profile API response for E2E encrypted chat support - Improve error handling to reject recipients without valid encryption keys - Ensure remote user data is properly extracted from API responses This prevents sending encrypted messages to users with placeholder keys and ensures the chat system always has access to valid public keys for encryption operations.
This commit is contained in:
@@ -94,6 +94,7 @@ export async function GET(request: Request, context: RouteContext) {
|
||||
website: user.website,
|
||||
movedTo: user.movedTo,
|
||||
isBot: user.isBot,
|
||||
publicKey: user.publicKey, // Needed for E2E encrypted chat
|
||||
};
|
||||
|
||||
// If this is a bot, include owner info
|
||||
|
||||
Reference in New Issue
Block a user