Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

feat(dm): 2-byte TLV for DMs with backward compatibility - Cashu token support
Summary
Implements backward-compatible 2-byte TLV encoding for Direct Messages to support Cashu ecash token transmission, which can exceed the 255-byte limit of the legacy 1-byte format.
Motivation
This change enables integration with bitpoints.me, a Cashu ecash wallet that uses the bitchat protocol for offline peer-to-peer Bitcoin payments over Bluetooth mesh. Cashu tokens frequently exceed 255 bytes and require the extended TLV format.
Changes
DM_TLV_2BYTEfeature bit in announcementsdocs/dm_tlv.mdTechnical Details
Formats
[type:u8][length:u8][value](max 255 bytes)[type:u16][length:u16][value](max 65535 bytes)Feature Negotiation
ProtocolFeatures.DM_TLV_2BYTEconstant (bit 0x01)IdentityAnnouncementincludes optionalFEATURESTLV field (type 0x04)PeerManager.peerHasFeature()checks capability before encodingImplementation Flow
DM_TLV_2BYTEfeature bit in identity packetspeerManager.peerHasFeature()verifies support before encodingprivateMessage.encode2B()used when peer has feature;encode()otherwisePrivateMessagePacket.decode()tries 2B first, falls back to 1BSecurity
Integration
Enables bitpoints.me - A Cashu.me + Bitchat wallet for:
About bitpoints.me
bitpoints.me is a full-featured Cashu ecash wallet with:
Testing
Files Changed
BluetoothMeshService.kt- Adaptive DM encoding based on peer capabilitiesMessageHandler.kt- Feature flag propagation from announcementsPeerManager.kt- Peer feature tracking and capability queriesIdentityAnnouncement.kt- Feature bitmask in announcements (optional TLV)NoiseEncrypted.kt- Dual TLV parsers (1B/2B) with automatic fallbackProtocolFeatures.kt- NEW Feature bit constantsPrivateMessagePacketTest.kt- NEW Unit tests for both formatsdocs/dm_tlv.md- NEW Technical documentationCHANGELOG.md- Release notesBackward Compatibility
✅ Fully backward compatible:
FEATURESTLV in announcementsChecklist
./gradlew :app:lintDebug)PrivateMessagePacketTest.kt)References
docs/dm_tlv.md