From 50d1f99198b79d017edbeba1b410c14b5d1b03e8 Mon Sep 17 00:00:00 2001 From: Will Pfleger Date: Thu, 26 Mar 2026 19:56:26 -0400 Subject: [PATCH] feat(auth): add StoredCredentials::new() constructor 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 349e6506..3f9b06e3 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