pub struct AuthenticatorBuilder { /* private fields */ }Expand description
AuthenticatorBuilder is a builder struct that holds the public key, signature header, timestamp header,
and a boolean value that indicates whether or not to reject requests.
Properties:
public_key: The public key that will be used to verify the signature. For a successful build of the authenticator, a public key will be required.signature_header: The name of the header that contains the signature.timestamp_header: The name of the header that contains the timestamp.reject: If true, the middleware will reject the request if it is not signed. If false, the middleware will allow the request to continue.
Implementations
sourceimpl AuthenticatorBuilder
impl AuthenticatorBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new AuthenticatorBuilder with default values.
Without a public key, the builder will panic on build.
sourcepub fn public_key(self, public_key: &str) -> Self
pub fn public_key(self, public_key: &str) -> Self
Sets the public key that will be used to verify the signature. Required.
Arguments
public_key: The public key that will be used to verify the signature. Must be a valid ed25519 public key for successful validation. Must be a hex-encoded string.
sourcepub fn signature_header(self, header: &str) -> Self
pub fn signature_header(self, header: &str) -> Self
Sets the name of the header that contains the signature.
If not set, the default value is X-Signature-Ed25519.
optional
Arguments
header: The name of the header that contains the signature.
sourcepub fn timestamp_header(self, header: &str) -> Self
pub fn timestamp_header(self, header: &str) -> Self
Sets the name of the header that contains the timestamp.
If not set, the default value is X-Signature-Timestamp.
optional
Arguments
header: The name of the header that contains the timestamp.
sourcepub fn reject(self) -> Self
pub fn reject(self) -> Self
Sets whether or not to reject requests that are not signed.
If not set, the default value is true.
optional
sourcepub fn build(self) -> Ed25519Authenticator
pub fn build(self) -> Ed25519Authenticator
Converts the builder into the service factory Ed25519Authenticator, as expected
by actix-web’s wrap function.
Panics
If the builder is missing a public key, this function will panic.
If the public key is not a valid ed25519 public key provided as a hex string, this function will panic.
Trait Implementations
sourceimpl Default for AuthenticatorBuilder
impl Default for AuthenticatorBuilder
sourcefn default() -> AuthenticatorBuilder
fn default() -> AuthenticatorBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for AuthenticatorBuilder
impl Send for AuthenticatorBuilder
impl Sync for AuthenticatorBuilder
impl Unpin for AuthenticatorBuilder
impl UnwindSafe for AuthenticatorBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more