From 6ecf4652414ba87a907a378b6df3e0002650a5c6 Mon Sep 17 00:00:00 2001 From: AnnatarHe Date: Sat, 13 Dec 2025 01:36:04 +0800 Subject: [PATCH] fix(daemon): base64 encode encrypted track data for JSON transport MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Raw binary ciphertext was being stored as strings and JSON-serialized, causing data corruption due to invalid UTF-8 sequences. This fix adds base64 encoding for the Encrypted, AesKey, and Nonce fields before sending to the server. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- daemon/handlers.sync.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/daemon/handlers.sync.go b/daemon/handlers.sync.go index 3660390..b93866c 100644 --- a/daemon/handlers.sync.go +++ b/daemon/handlers.sync.go @@ -2,6 +2,7 @@ package daemon import ( "context" + "encoding/base64" "encoding/json" "log/slog" "time" @@ -79,9 +80,9 @@ func handlePubSubSync(ctx context.Context, socketMsgPayload interface{}) error { } realPayload = model.PostTrackArgs{ - Encrypted: string(encryptedData), - AesKey: string(encodedKey), - Nonce: string(nonce), + Encrypted: base64.StdEncoding.EncodeToString(encryptedData), + AesKey: base64.StdEncoding.EncodeToString(encodedKey), + Nonce: base64.StdEncoding.EncodeToString(nonce), } } }