You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(general): decode TXT records as raw bytes per RFC 6763 §6 (#3671)
* fix(general): decode TXT records as raw bytes per RFC 6763 §6
decodeTxtRecord/encodeTxtRecord/TxtRecord now operate on Bytes[] so
arbitrary 8-bit values (Thread BR meshcop xa, xp, at, pt, sb, dd) survive
encode/decode losslessly. encodeTxtRecord and the TxtRecord factory accept
(Bytes | string)[] so ASCII-only senders pass strings as before.
Internal Matter consumers are unchanged: TXT values are still surfaced as
Map<string, string> via DnssdName.parameters, which now splits each entry
on byte 0x3D and decodes both halves with Bytes.toString. DnssdName.keyOf
projects entries via Bytes.toHex for content-stable dedup.
A Phase B follow-up will introduce a DnssdParameters façade exposing the
raw bytes via .raw(key) for non-Matter consumers (Thread Border Router
enrichment in matterjs-server #406).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(general): expose raw TXT bytes via DnssdParameters façade
DnssdName.parameters and IpService.parameters now return a DnssdParameters
instance — a ReadonlyMap<string, string> with a `.raw(key): Bytes`
accessor that surfaces the original TXT byte sequence. Existing string
consumers (DiscoveryData, CommissionableMdnsScanner, Peer) are unaffected
because DnssdParameters implements ReadonlyMap<string, string>.
The escape hatch enables external consumers to recover binary TXT values
like the Thread MeshCoP xa, xp, at, pt, sb, dd fields (driver:
matterjs-server #406 Thread Border Router enrichment).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs(changelog): note TXT decode shape change and DnssdParameters.raw()
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(general): correct Uint8Array constructor argument order in Bytes.of
Bytes.of swapped byteOffset and byteLength when wrapping a non-Uint8Array
view, producing a slice into the wrong region of the underlying buffer.
Latent because every existing call site passes a Uint8Array and hits the
early-return branch — but Bytes.of accepts any AllowSharedBufferSource and
the bug fires on DataView/Int8Array/etc.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(general): RFC 6763 §6.4/§6.5 conformance in DnssdName.parameters
§6.4: Duplicate keys within or across TXT records now first-wins instead
of the previous last-wins semantics from Map.set.
§6.5: Zero-length TXT entries are now silently ignored on receive
instead of producing a parameter with an empty key.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore(general): post-greg-review polish
- TxtRecord/encodeTxtRecord: document the (Bytes | string)[] dual shape so
future readers don't unify the union and break ASCII senders.
- DnssdName.parameters: ignore TXT entries with empty keys per RFC 6763 §6.4
(the spec requires "key MUST be at least one character"); add tests for
empty-key and empty-value (key=) cases.
- DnssdName.parameters: trim the RFC §6.4/§6.5 comments to one line each.
- MdnsTest expectMessage: sort TXT entries by hex (lossless on binary)
instead of round-tripping bytes → string → bytes; normalize string-array
fixtures to Bytes[] before sorting so deep.equals matches actual decoded
records.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(general): address Copilot review feedback on TXT record handling
- encodeTxtRecord: warn and truncate to 255 bytes when an entry exceeds
the RFC 6763 §6.1 length-octet limit, instead of silently wrapping
via writeUInt8 and producing invalid wire data.
- DnssdName.parameters: order TXT records newest-first (by installedAt)
before applying RFC 6763 §6.4 first-wins so an updated record's keys
take precedence over the not-yet-expired older copy. First-wins still
applies to entries within each record in their wire order.
- MdnsTest expectMessage sortKey: project TXT entries through Bytes.toHex
(lossless) instead of Bytes.toString (lossy on binary), normalizing
both string and Uint8Array fixtures to the same hex form.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs(general): drop broken {@link key} in DnssdParameters.raw JSDoc
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,9 @@ The main work (all changes without a GitHub username in brackets in the below li
22
22
23
23
-@matter/general
24
24
- Breaking: Blob/File-related storage methods were removed from the normal Storage implementation
25
+
- Breaking: `DnsCodec.decodeTxtRecord`/`encodeTxtRecord` and the `TxtRecord` factory now operate on `Bytes[]` per RFC 6763 §6 so binary TXT values (e.g. Thread MeshCoP `xa`, `xp`, `at`, `pt`, `sb`, `dd`) survive encode/decode losslessly; `encodeTxtRecord` and `TxtRecord` accept `(Bytes | string)[]` so ASCII-only senders are unchanged
25
26
- Feature: Added a new `wal`-based storage engine (not yet the default) to optimize persistence
27
+
- Feature: `DnssdName.parameters` and `IpService.parameters` now return a `DnssdParameters` instance — a `ReadonlyMap<string, string>` plus a `.raw(key): Bytes` accessor for binary TXT consumers (e.g. Thread Border Router enrichment)
26
28
- Enhancement: Added locking to storage implementations to prevent concurrent access issues and data corruption
27
29
- Enhancement: Split out Blob-Storage into its own `dir`-based BlobStorage implementation
28
30
- Enhancement: Added Storage Migration logic that can generically migrate between different storage engines
0 commit comments