Repository navigation
Add your own new device to every DM now, and say where it went in (GRYT-1484) - #28
Merged
Merged
Conversation
…YT-1484) The pairing flow's approving device needs to add the newly linked device to every DM straight away, and the history transfer needs each group's add position to work out the tail. addOwnDevice does the adds, refusing a device that isn't under your own person key, and reports each group's position as it goes. groupPositions gives the snapshot's starting point, and decrypted messages now carry their epoch for the late old-epoch ones. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of GRYT-1484 (linking a device). It's item 8 of the build plan in crypto's
docs/pairing-design.md. The approving device adds the new one to every DM group straight away, instead of waiting for somebody's next send. And it says where in each group's log the device went in, which the history transfer (item 9) needs to work out the tail.What's new on the DM driver:
addOwnDevice(deviceId, { order, onProgress }). It checks the server lists the device as yours, then goes through every group this device holds. In each one it claims a KeyPackage for that device and checks the certificate names that device id under your own person key. Then it commits an Add with the usual stale_epoch retry. It only adds the device id it was given.orderputs the most recently active conversations first.onProgressfires after each group with done and total, for the "40 of 112" line.added,added_by_otherwhen another member's commit put the device in first (the lazy add on their next send), orfailedwith a reason. A failed group doesn't stop the rest. A device under somebody else's person key throwsnot_own_deviceand stops everything, since then the server is passing off somebody else's device as yours.addin each result is the seq of the commit that put the device in, and the epoch it starts in. The driver notes this in memory for every commit it applies or makes, so it knows the place when a peer's commit did the add too.groupPositions()gives each group's cursor and epoch. That's what the snapshot covers when A takes it at approval.MlsDecryptedMessagenow carriesepoch. With it, the tail is the messages withsnap.seq < seq < add.seq, plus the ones afteradd.seqwithepoch < add.epoch(sent in the old epoch, landed after the add).Tests, in a new
addOwnDevice.test.tsagainst the fake delivery service:I mutation-checked three of them: dropping the person-key check, the join recording on applied commits, or the message epoch each fails its test.
Where to look:
addcomes back null for that group. Pairing sessions don't survive a restart, so I left it there.noteJoinsrunsmlsGroupMemberstwice per commit. Commits are rare, but it's on every one.device()helper instead of the one indmDriver.test.ts, because GRYT-1555 (Stop for good when the server says device_removed (GRYT-1555) #27) changes that one. Merging with Stop for good when the server says device_removed (GRYT-1555) #27 is clean (checked withgit merge-tree). Both add a code toMlsDriverErrorCode, in different places.packages/coreis normal review. No release here: core 0.13.0 goes out together with GRYT-1555.🤖 Generated with Claude Code