A plug-and-play middleware to allow for automatic Ed25519 Authentication for incoming requests on your actix-web server. Simply provide the public key to authenticate the signatures against during registration of the middleware, optionally specify custom header names for the signature and timestamp headers, should they differ from X-Signature-Ed25519
or X-Signature-Timestamp
respectively.
You can use the Ed25519 Authentication Middleware by wrapping them around your app like this:
With a provided Ed25519 &public_key
of &str
, you can initalize the middleware thusly:
``` // App::new() .wrap(Ed25519Authenticator { data: MiddlewareData::new(&public_key), }) })
```
This previous example assumes the requests you receive to include the headers X-Signature-Ed25519
and X-Signature-Timestamp
, should they differ from that default, you can initalize the middleware with custom headers like this:
``` // App::new() .wrap(Ed25519Authenticator { data: MiddlewareData::newwithcustomheaders( &publickey, "customsig", "customtimestamp", ), })
```
This crate is passively maintained, should you run into any edge-cases or issues while using this crate, or develop any ideas for useful extension, feel free to start discussions, open issues or open PRs!
The work on this crate would've been impossible without these useful write-ups: