Skip to content

Commit 6ecf465

Browse files
AnnatarHeclaude
andcommitted
fix(daemon): base64 encode encrypted track data for JSON transport
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 <noreply@anthropic.com>
1 parent a30e94b commit 6ecf465

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

daemon/handlers.sync.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package daemon
22

33
import (
44
"context"
5+
"encoding/base64"
56
"encoding/json"
67
"log/slog"
78
"time"
@@ -79,9 +80,9 @@ func handlePubSubSync(ctx context.Context, socketMsgPayload interface{}) error {
7980
}
8081

8182
realPayload = model.PostTrackArgs{
82-
Encrypted: string(encryptedData),
83-
AesKey: string(encodedKey),
84-
Nonce: string(nonce),
83+
Encrypted: base64.StdEncoding.EncodeToString(encryptedData),
84+
AesKey: base64.StdEncoding.EncodeToString(encodedKey),
85+
Nonce: base64.StdEncoding.EncodeToString(nonce),
8586
}
8687
}
8788
}

0 commit comments

Comments
 (0)