Files
giza-kmp/composeApp
Kgothatso NgakoandClaude Opus 5 a68cad06a4 feat(marmot): read both Marmot profiles (v2 Phase 1)
After this the app can be a member of a current-profile group and can invite a
current-profile peer -- an Amethyst 1.15.2 user -- into one of its own legacy
rooms. Nothing it sends changes. docs/marmot-v2.md, Phase 1.

Seventeen sites read `currentMarmotData()`, which is the legacy 0xF2EE
extension and is null on a current-profile group: ten for the room id, and the
Welcome path threw MarmotMissingNostrGroupDataExtension on that null, so a v2
Welcome was not a room the app could not read but an exception it could not get
past. The others read the admins -- SubgroupManager's "only an admin can make a
subgroup" and processGroupMembershipChanges' adminAt stamp both saw no admins at
all on a v2 group -- the relays, the name and the retention. MlsGroupProfile.kt
writes the fallback once per field (current profile first, 0xF2EE second) and
the sites read roomId(), roomName(), roomDescription(), roomRelays(),
retentionSeconds() and the library's currentAdminIdentities(). The retention
one is the bug the library's own outbound processor had: read only 0xF2EE and
disappearing messages simply did not disappear in v2 groups.

A current-profile kind:30443 frames its KeyPackage in an MLSMessage, and the
invite decoded whatever the ingest stored as a bare KeyPackage, taking the
frame's version and wire-format words for the package's own. The ingest now
validates with KeyPackageUtils.isCryptographicallyValid -- the check a
conformant peer runs on ours, covering tags, signature, lifetime and on the
current profile the identity proof; nothing checked any of it before -- and
stores the package bare, so MlsGroup.proposeAdd and every other consumer of the
row read the same bytes whichever way it was published.

The inbound author check decodes the canonical payload strictly first
(MarmotAppEvent: six members, no sig, an id that rehashes) and falls back to
Event.fromJsonOrNull only for the legacy rumor shape every build before Phase 2
sends. The fallback would accept the canonical shape too, but by defaulting the
signature rather than checking anything.

A Welcome is matched to this device's bundle by the KeyPackageRef the Welcome
itself names, in RFC 9420 order, before the `e` tag is consulted: the tag is
what the inviter thinks it used, and MDK stamps the id of a cached copy, so a
peer who rotated while an inviter kept inviting from cache was unjoinable by
the tag alone. WelcomeBundleMatch is pure and scans the handful of bundle rows
rather than adding a column. The exception the tag-only path threw when the tag
was missing has no caller left and goes.

Tests: MarmotKeyPackageIngestJvmTest runs both published shapes through the
sync funnel, invites a current-profile package into a legacy room and sees the
member in the tree, and refuses a tampered package; WelcomeBundleMatchJvmTest
picks the addressed bundle in either candidate order, none when none is ours,
and survives an unreadable row; MarmotAppPayloadTest pins that the legacy rumor
and its canonical form share an id, that the strict decoder refuses a sig
member and a forged id, and that the fallback reads both. The KeyPackage test
fixture's lifetime drops from 90 days to the app's own 30 because 1.15.2 caps
it at 84 and the ingest now checks. Full JVM suite: 1,140 tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 22:15:13 +02:00
..