Repository navigation
Key asks are saved, and an unused key hands over (GRYT-2014) - #363
Merged
Merged
Conversation
An ask to use a device's key now starts the 30-day reset by itself and is handed to the device with the key even after the asker disconnects. If no device with the current key has connected for 30 days, the ask finishes at once. The asker is told which device holds the key and when it was last here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Sivert and Pingy couldn't DM on pp.sivert.io. The account key there came from an old Windows install. The phone asked to take over, but the ask lived in memory, only reached devices that were online right then, and never went anywhere on its own. This makes that heal by itself.
What changes
dm:key:handover:asknow also starts the 30-day reset (dm_key_reset_binding/at), with the same rule asdm:key:reset:request: asking again doesn't restart the clock. It acks{ at, holder, seenAt }so the asker can say who it's waiting for.dm:key:handover:pendinghands out asks even after the asker has disconnected. Approving only publishes the asker's binding with a handover note, so the asker doesn't need to be online.dm_key_seen_atanddm_key_holder. Publishing with the current identity updates them, at most once an hour unless the name changes. The migration setsseen_atto now on existing rows, so nothing counts as unused on the day this ships.keyResetDueAt). The member list'skeyResetAtuses the same value, so contacts and your devices see the real date.dm:key:handover:denychecks the ask exists for this account rather than that the asker is online.Look closely at
keyResetDueAtinservices/personKeyBinding.ts). This is the change from GRYT-1886 you agreed to: a key nobody has used for 30 days hands over as soon as someone asks. Contacts still get the key-changed pause (GRYT-1877).seen_atis only ever moved forward by a client sending the current identity's binding. A binding is public, so anyone could resend it. That only keeps the key looking used, which slows a takeover and never speeds one up.Client half: Gryt-chat/client#1155. Server goes out first.
Tests:
dmKeys.test.ts19/19, three new ones (ask outlives the asker, unused key hands over at once, a returning device keeps the full 30 days).🤖 Generated with Claude Code