core: type user and auth session timestamps
This commit is contained in:
@@ -50,7 +50,7 @@ pub struct AuthenticatedSession {
|
||||
pub struct SessionCookie {
|
||||
pub session_id: UserSessionId,
|
||||
pub value: String,
|
||||
pub expires_at: String,
|
||||
pub expires_at: OffsetDateTime,
|
||||
}
|
||||
|
||||
pub fn hash_password(password: &str, pepper: &str) -> Result<String, ApiError> {
|
||||
@@ -100,11 +100,7 @@ pub fn create_session_cookie(settings: &AuthSettings) -> Result<SessionCookie, A
|
||||
Ok(SessionCookie {
|
||||
session_id,
|
||||
value: format!("{secret}.{}", expires_at.unix_timestamp_nanos()),
|
||||
expires_at: expires_at
|
||||
.format(&time::format_description::well_known::Rfc3339)
|
||||
.map_err(|error| {
|
||||
ApiError::internal(format!("failed to format session expiration: {error}"))
|
||||
})?,
|
||||
expires_at,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user