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, adding AuthenticationInfo to the request extensions.

Implementations

Creates a new AuthenticatorBuilder with default values. Without a public key, the builder will panic on build.

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.

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.

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.

Sets whether or not to reject requests that are not signed. If not set, the default value is false. optional

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

Returns the “default value” for a type. Read more
Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more