From b74f5ca35b8d92cb5e86c69f04a53f0c8936f2be Mon Sep 17 00:00:00 2001 From: Will Pfleger Date: Fri, 27 Mar 2026 14:47:41 -0400 Subject: [PATCH] feat(auth): add StoredCredentials::new() constructor (#778) StoredCredentials is #[non_exhaustive] but has no constructor, making it impossible for external crates implementing CredentialStore to construct instances without a serde roundtrip workaround. Add a new() constructor matching the pattern used for other #[non_exhaustive] types in this crate. Fixes #777 --- crates/rmcp/src/transport/auth.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/rmcp/src/transport/auth.rs b/crates/rmcp/src/transport/auth.rs index 349e650..3f9b06e 100644 --- a/crates/rmcp/src/transport/auth.rs +++ b/crates/rmcp/src/transport/auth.rs @@ -84,6 +84,23 @@ impl std::fmt::Debug for StoredCredentials { } } +impl StoredCredentials { + /// Create a new `StoredCredentials` instance. + pub fn new( + client_id: String, + token_response: Option, + granted_scopes: Vec, + token_received_at: Option, + ) -> Self { + Self { + client_id, + token_response, + granted_scopes, + token_received_at, + } + } +} + /// Trait for storing and retrieving OAuth2 credentials /// /// Implementations of this trait can provide custom storage backends