Repository navigation
crypto: cache verified member identities per group session + batch identity lookups - #88
Merged
Merged
Conversation
…ntity lookups (POST /keys/identity/batch, 404 -> deduped Promise.all)
smallacc551collabagents
force-pushed
the
perf/group-identity-cache
branch
from
October 30, 2026 11:14
d00a909 to
5dc951b
Compare
…DENTITY_BATCH_MAX; missing => null
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.
Group sends re-fetched every member's identity on every send (
/keys/identityper member for the device re-query, plus the revocation check), andsafety()ran a per-memberverifier.refreshloop.What changed (crypto + minimal frontend glue)
groups.ts: per-session cache of theGroupInfoand of the membership version whose member devices were verified.send()reuses the cached group and callsshareGroupKey({ requery: false })unless one of these happens: the membership version changed, a 409membership_changed(cache dropped, refetch + rotate), a member has apendingChange(re-checked every send until accepted), or a to-device message arrives from a device other than the verified one. There's also an explicitmarkIdentitiesChanged().refreshMembers(id, { force })defaults to force.backend-bridge.ts:fetchIdentities()makes onePOST /keys/identity/batch {usernames}(Backend). On 404 it falls back to dedupedPromise.allGETs and remembers that per client, so the client works before and after the deploy.keys.queryuses it.revocation.ts:prime(userIds)batch-refreshes stale entries.assertTrustedstill compares against the exact device and recordspendingChange(fails closed).olm-adapter.ts: honoursrequery:falseand callsgate.primeonce per share.live.ts: the per-memberverifier.refreshloop insafety()is gone. It now callsrefreshMembers(id, { force })with the existing 60s throttle.Security: a replaced device still goes to
pendingChangeand gets no room keys untilacceptMemberIdentity(test:identity-cache.test.ts, "identity gate keeps its security").Call counts (fake backend, group of 4, 5 sends, revocation maxAge 0 so every send re-confirms):
/keys/identityTests: 91/91 pass (4 new). tsc and eslint are clean.