(account_id: AccountId)
| 89 | } |
| 90 | |
| 91 | fn issue_token(account_id: AccountId) -> String { |
| 92 | let key = make_key(); |
| 93 | |
| 94 | let exp = (Utc::now() + chrono::Duration::days(1)).to_rfc3339(); |
| 95 | |
| 96 | PasetoBuilder::<V4, PasetoLocal>::default() |
| 97 | .set_claim(ExpirationClaim::try_from(exp.as_str()).unwrap()) |
| 98 | .set_claim(CustomClaim::try_from(("account_id", serde_json::json!(account_id))).unwrap()) |
| 99 | .build(&key) |
| 100 | .expect("Failed to construct paseto token w/ builder!") |
| 101 | } |
| 102 | |
| 103 | pub fn auth() -> impl Filter<Extract = (Session,), Error = warp::Rejection> + Clone { |
| 104 | warp::header::<String>("Authorization").and_then(|token: String| { |
no test coverage detected