pub struct SiwePlugin { /* private fields */ }Expand description
Sign-In with Ethereum. The required verifier must authenticate the signature.
Implementations§
Source§impl SiwePlugin
impl SiwePlugin
Sourcepub fn new<N, NF, V, VF>(domain: impl Into<String>, nonce: N, verify: V) -> Selfwhere
N: Fn() -> NF + Send + Sync + 'static,
NF: Future<Output = AuthResult<String>> + Send + 'static,
V: Fn(SiweVerification) -> VF + Send + Sync + 'static,
VF: Future<Output = AuthResult<bool>> + Send + 'static,
pub fn new<N, NF, V, VF>(domain: impl Into<String>, nonce: N, verify: V) -> Selfwhere
N: Fn() -> NF + Send + Sync + 'static,
NF: Future<Output = AuthResult<String>> + Send + 'static,
V: Fn(SiweVerification) -> VF + Send + Sync + 'static,
VF: Future<Output = AuthResult<bool>> + Send + 'static,
Configure the expected domain, nonce generator, and signature verifier.
Sourcepub fn anonymous(self, anonymous: bool) -> Self
pub fn anonymous(self, anonymous: bool) -> Self
Permit verification without email; enabled by default.
Sourcepub fn email_domain_name(self, domain: impl Into<String>) -> Self
pub fn email_domain_name(self, domain: impl Into<String>) -> Self
Use this domain for generated wallet placeholder emails.
Sourcepub fn ens_lookup<F, Fut>(self, callback: F) -> Selfwhere
F: Fn(String) -> Fut + Send + Sync + 'static,
Fut: Future<Output = AuthResult<EnsProfile>> + Send + 'static,
pub fn ens_lookup<F, Fut>(self, callback: F) -> Selfwhere
F: Fn(String) -> Fut + Send + Sync + 'static,
Fut: Future<Output = AuthResult<EnsProfile>> + Send + 'static,
Resolve display attributes for a newly registered checksum address.
Trait Implementations§
Source§impl<S: AuthSchema> AuthPlugin<S> for SiwePlugin
impl<S: AuthSchema> AuthPlugin<S> for SiwePlugin
Source§fn on_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<AuthResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<AuthResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called for each request - return Some(response) to handle, None to pass through
Source§fn telemetry_plugin_id(&self) -> Option<&'static str>
fn telemetry_plugin_id(&self) -> Option<&'static str>
Return the upstream plugin ID; core option wrappers have no plugin ID.
Source§fn openapi(&self) -> Result<OpenApiPluginMetadata, AuthError>
fn openapi(&self) -> Result<OpenApiPluginMetadata, AuthError>
Document this configured plugin without invoking application field policies.
Source§fn password_hasher(&self) -> Option<Arc<dyn PasswordHasher>>
fn password_hasher(&self) -> Option<Arc<dyn PasswordHasher>>
Select the base password hasher before plugin initialization wraps it.
Source§fn telemetry(&self, _options: &mut PluginTelemetry)
fn telemetry(&self, _options: &mut PluginTelemetry)
Report configured options without invoking callbacks or initializing the plugin.
Source§fn rate_limits(&self) -> Result<Vec<PluginRateLimit>, AuthError>
fn rate_limits(&self) -> Result<Vec<PluginRateLimit>, AuthError>
Default endpoint limits, overridden by explicit application limits.
Source§fn on_init<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut AuthInitContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn on_init<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut AuthInitContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Called when the plugin is initialized
Source§fn on_http_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn on_http_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Inspect an HTTP request after rate limiting and before endpoint middleware.
Native API calls do not run this hook. A response skips endpoint hooks.
Source§fn on_http_response<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_response: &'life2 mut AuthResponse,
_ctx: &'life3 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn on_http_response<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_response: &'life2 mut AuthResponse,
_ctx: &'life3 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Inspect the HTTP router response, including route misses and body errors.
Early HTTP request responses and native endpoint calls skip this hook.
A replacement response stops the remaining HTTP response hooks.
Source§fn before_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<BeforeRequestAction>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn before_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<BeforeRequestAction>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Called for a registered endpoint after HTTP body decoding and origin checks. Read more
Source§fn after_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_response: &'life2 mut AuthResponse,
_ctx: &'life3 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn after_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_response: &'life2 mut AuthResponse,
_ctx: &'life3 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Inspect or extend the final route response after session cookies are applied.
Auto Trait Implementations§
impl !RefUnwindSafe for SiwePlugin
impl !UnwindSafe for SiwePlugin
impl Freeze for SiwePlugin
impl Send for SiwePlugin
impl Sync for SiwePlugin
impl Unpin for SiwePlugin
impl UnsafeUnpin for SiwePlugin
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more