Persist gateway trust across bridge restarts - #189
Merged
Merged
Conversation
Add loadGatewayTrust/saveGatewayTrust, storing a slot's trusted-gateway allowlist in its own sibling JSON file alongside the identity file, owner-only permissions. Unlike loadRoomTokens/saveRoomToken, this has no dependency on the slot's identity already existing, since the trusted set carries no key material of its own.
…e slot Constructing GatewayTrust with an IdentitySlot loads the previously trusted device-id set from that slot's own storage into the initial in-memory set, and every add/remove writes the updated set back. The in-memory Set stays the live source of truth isTrusted/hasAny read at runtime; persistence is purely load-on-construct, save-on-mutate. Constructing with no slot keeps the prior in-memory-only behaviour unchanged, so every existing call site is unaffected until it opts in.
MeshStore's constructor now accepts an optional IdentitySlot, passed straight to GatewayTrust so its allowlist loads and persists per bridge slot instead of staying in-memory only. createBridgeMesh and createBridgeMeshSync now pass their own slot through, so every real bridge gets restart-surviving gateway trust for free; every other construction site (tests, test-transport.ts) keeps the prior in-memory-only behaviour by simply omitting the new parameter.
Mearman
marked this pull request as ready for review
September 18, 2026 08:06
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
🎉 This PR is included in version 3.15.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Closes #186
Persists GatewayTrust's trusted device-id set to a sibling JSON file alongside the existing per-slot identity storage, owner-only permissions, loaded on construction and written on every add/remove. The in-memory Set remains the live source of truth during a process's lifetime; persistence is load-on-start/save-on-mutate only.
Work in progress.