File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
crates/rpc/rpc-builder/src Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,30 @@ impl AuthRpcModule {
221
221
self . module_mut ( ) . merge ( other. into ( ) ) . map ( |_| true )
222
222
}
223
223
224
+ /// Removes the method with the given name from the configured authenticated methods.
225
+ ///
226
+ /// Returns `true` if the method was found and removed, `false` otherwise.
227
+ pub fn remove_auth_method ( & mut self , method_name : & ' static str ) -> bool {
228
+ self . module_mut ( ) . remove_method ( method_name) . is_some ( )
229
+ }
230
+
231
+ /// Removes the given methods from the configured authenticated methods.
232
+ pub fn remove_auth_methods ( & mut self , methods : impl IntoIterator < Item = & ' static str > ) {
233
+ for name in methods {
234
+ self . remove_auth_method ( name) ;
235
+ }
236
+ }
237
+
238
+ /// Replace the given [Methods] in the configured authenticated methods.
239
+ pub fn replace_auth_methods (
240
+ & mut self ,
241
+ other : impl Into < Methods > ,
242
+ ) -> Result < bool , RegisterMethodError > {
243
+ let other = other. into ( ) ;
244
+ self . remove_auth_methods ( other. method_names ( ) ) ;
245
+ self . merge_auth_methods ( other)
246
+ }
247
+
224
248
/// Convenience function for starting a server
225
249
pub async fn start_server (
226
250
self ,
You can’t perform that action at this time.
0 commit comments