feat(keyring-controller): add filter selector callback to withKeyring#8348
Merged
feat(keyring-controller): add filter selector callback to withKeyring#8348
filter selector callback to withKeyring#8348Conversation
7dd1631 to
e6c2af1
Compare
e6c2af1 to
f5e25d2
Compare
danroc
approved these changes
Mar 31, 2026
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.
Explanation
Adding a new way to filter out keyring instances with
withKeyring.The idea is to be able to filter by keyring instance logic/property. Since
KeyringObjectdata are pretty limited, we cannot do things like:Here, the
useSpecificMethodOrPropis specific toMyKeyringtype.References
N/A
Checklist
Note
Medium Risk
Touches keyring selection logic in
withKeyring, so incorrect predicate handling or selection order could affect any caller using the new variant, though coverage is strong and the change is localized.Overview
Extends
KeyringController.withKeyringto support selecting a keyring via a newKeyringSelectorvariant{ filter: ({ keyring, metadata }) => boolean }, which picks the first keyring matching the predicate.Adds a focused test suite covering filter-based selection (result passthrough, metadata availability, first-match behavior, and error cases like
KeyringNotFound/UnsafeDirectKeyringAccess) and documents the addition in the package changelog.Written by Cursor Bugbot for commit f5e25d2. This will update automatically on new commits. Configure here.