fix: admin keys showing as [object Object] in security config UI#2408
fix: admin keys showing as [object Object] in security config UI#2408
Conversation
Protobuf bytes fields serialize to plain objects with numeric keys when
JSON-encoded (e.g., {"0": 72, "1": 101, ...}). Both server and frontend
key conversion code only handled Uint8Array, Buffer, and plain arrays —
not these generic objects.
- Server: extracted bytesToBase64 helper with generic object fallback
- Frontend: added Object.values() conversion for generic byte objects
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @Yeraze's task —— View job Code Review FeedbackSummary: This PR effectively fixes the "[object Object]" display issue for admin keys by properly handling protobuf byte serialization. The implementation is solid with good error handling and consistent patterns across both server and frontend. Todo List
✅ Code Quality & Best PracticesServer Changes (
Frontend Changes (
✅ Bug AnalysisRoot cause correctly identified: Protobuf bytes fields serialize to Fix addresses the issue: Both server and frontend now handle these generic objects via Edge cases handled:
✅ Performance ConsiderationsMinimal impact:
Efficient approach:
|
Summary
Remote Admin keys on the Device Configuration page displayed as
[object Object]instead of base64 strings, on both SQLite and PostgreSQL backends.Root cause: Protobuf
bytesfields serialize to plain objects with numeric keys when JSON-encoded (e.g.,{"0": 72, "1": 101, ...}). Both server and frontend key conversion code only handledUint8Array,Buffer, and plain arrays — not these generic objects, so they fell through toString(key)which produced[object Object].Fix:
bytesToBase64()helper with generic object fallback viaObject.values()Object.values()conversion for generic byte objects inConfigurationTab.tsxChanges
src/server/server.tsbytesToBase64()helper, replaced inline conversion in both local and remote config pathssrc/components/ConfigurationTab.tsxTest plan
npx vitest run— 3070 tests passnpm run build— no TypeScript errors🤖 Generated with Claude Code