diff options
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | README.md | 6 |
2 files changed, 4 insertions, 4 deletions
@@ -1,6 +1,6 @@ [package] name = "sputnik" -version = "0.1.0" +version = "0.1.1" authors = ["Martin Fischer <martin@push-f.com>"] license = "MIT" description = "A lightweight layer on top of hyper to facilitate building web applications." @@ -26,7 +26,7 @@ Sputnik does **not**: ## CsrfToken example -```rs +```rust use std::convert::Infallible; use hyper::service::{service_fn, make_service_fn}; use hyper::{Method, Server}; @@ -92,7 +92,7 @@ async fn main() { After a successful authentication you can build a session id cookie for example as follows: -```rs +```rust let expiry_date = OffsetDateTime::now_utc() + Duration::hours(24); let mut cookie = Cookie::new("userid", key.sign( @@ -106,7 +106,7 @@ resp.set_cookie(cookie); This session id cookie can then be retrieved and verified as follows: -```rs +```rust let userid = req.cookies().get("userid") .ok_or_else(|| Error::unauthorized("expected userid cookie".to_owned())) .and_then(|cookie| key.verify(cookie.value()).map_err(Error::unauthorized)) |