Skip to content

Commit 772d60d

Browse files
teovlclaude
andcommitted
feat(dataexchange): add data_b64 field to inbox messages
Store the raw payload as standard base64 alongside the existing `data` string field. The string representation mangles bytes > 0x7F (Go's json.Marshal replaces invalid UTF-8 with U+FFFD), making binary payloads (zlib-compressed HealthKit envelopes, etc.) impossible to recover. `data_b64` is the lossless counterpart. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent de6db86 commit 772d60d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

plugins/dataexchange/service.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package dataexchange
77

88
import (
99
"context"
10+
"encoding/base64"
1011
"encoding/json"
1112
"fmt"
1213
"log/slog"
@@ -239,6 +240,7 @@ func (s *Service) saveInboxMessage(frame *internaldx.Frame, from protocol.Addr)
239240
"type": internaldx.TypeName(frame.Type),
240241
"from": from.String(),
241242
"data": string(frame.Payload),
243+
"data_b64": base64.StdEncoding.EncodeToString(frame.Payload),
242244
"bytes": len(frame.Payload),
243245
"received_at": ts.Format(time.RFC3339Nano),
244246
}

0 commit comments

Comments
 (0)