fix(marmot): send SelfRemove as standalone PublicMessage proposal
Reverts the SelfRemove-as-commit approach. openmls rejects a
commit whose only proposal is a SelfRemove from the committer with
RequiredPathNotFound — the spec model is that the removing member
publishes a STANDALONE proposal, and an admin receiver
(wn's mdk auto-commit path) folds it into their next commit.
Add `MlsGroup.buildSelfRemoveProposalMessage()` which frames
Proposal.SelfRemove as `MlsMessage(PublicMessage{proposal})` with
the proper FramedContent / signature / membership_tag and returns
the ready-to-publish bytes + the pre-commit exporter key for outer
encryption. Rewire `MlsGroupManager.leaveGroup` and
`MarmotManager.leaveGroup` to use it.
Target: test 11 (amy leave → B auto-commits SelfRemove →
removes amy from member list).
https://claude.ai/code/session_1469d7f4-bb66-4ffa-a44d-1dfa4b526484
This commit is contained in:
+7
-7
@@ -290,16 +290,16 @@ class MarmotManager(
|
||||
* Returns proposal bytes to publish (as a GroupEvent).
|
||||
*/
|
||||
suspend fun leaveGroup(nostrGroupId: HexKey): OutboundGroupEvent {
|
||||
// leaveGroup() builds a SelfRemove-only commit (MIP-03 non-admin
|
||||
// exception) and removes local state. It must run BEFORE we tear
|
||||
// down the subscriptions so the pre-commit exporter key is still
|
||||
// reachable for outer encryption.
|
||||
val commitResult = groupManager.leaveGroup(nostrGroupId)
|
||||
// leaveGroup() returns the framed standalone SelfRemove proposal
|
||||
// (PublicMessage{Proposal}) plus the pre-commit exporter key for
|
||||
// outer encryption. Runs BEFORE we tear down the subscriptions so
|
||||
// the pre-commit exporter is still derivable.
|
||||
val (framedBytes, exporterKey) = groupManager.leaveGroup(nostrGroupId)
|
||||
val outboundEvent =
|
||||
outboundProcessor.buildCommitEvent(
|
||||
nostrGroupId = nostrGroupId,
|
||||
commitBytes = commitResult.framedCommitBytes,
|
||||
exporterKey = commitResult.preCommitExporterSecret,
|
||||
commitBytes = framedBytes,
|
||||
exporterKey = exporterKey,
|
||||
)
|
||||
|
||||
subscriptionManager.unsubscribeGroup(nostrGroupId)
|
||||
|
||||
Reference in New Issue
Block a user