Skip to content

Commit 1973143

Browse files
committed
docs: streamline README to focus on architecture and development workflow
- Reorganized content into a clear table of contents with sections for architecture, repository layout, and daily tasks - Removed marketing-focused language in favor of technical documentation style - Consolidated setup instructions into a single Quick Start section with numbered steps - Added comprehensive environment variable reference table and testing checklist - Simplified badge links and removed redundant feature descriptions
1 parent 0fe5437 commit 1973143

24 files changed

+752
-419
lines changed

README.md

Lines changed: 150 additions & 394 deletions
Large diffs are not rendered by default.

backend/src/auth.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use std::env;
1515
use std::sync::OnceLock;
1616
use time::{Duration as TimeDuration, OffsetDateTime};
1717

18+
/// Lazily initialized JWT signing secret sourced from the `JWT_SECRET` environment variable.
1819
pub static JWT_SECRET: OnceLock<String> = OnceLock::new();
1920

2021
const SECRET_BLACKLIST: &[&str] = &[

backend/src/csrf.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ fn get_secret() -> &'static [u8] {
6969
/// Issues a new CSRF token for a given username.
7070
///
7171
/// The token embeds the username, expiry, and a nonce, signed with HMAC-SHA256.
72+
///
73+
/// # Arguments
74+
///
75+
/// * `username` - Authenticated username the token should be bound to.
76+
///
77+
/// # Returns
78+
///
79+
/// A base64-encoded token string or an error if generation fails.
7280
pub fn issue_csrf_token(username: &str) -> Result<String, String> {
7381
if username.is_empty() {
7482
return Err("Username required for CSRF token".to_string());
@@ -168,6 +176,15 @@ fn subtle_equals(a: &[u8], b: &[u8]) -> bool {
168176
}
169177

170178
/// Appends a `Set-Cookie` header for the CSRF token to a `HeaderMap`.
179+
///
180+
/// # Arguments
181+
///
182+
/// * `headers` - Outgoing response headers to mutate.
183+
/// * `token` - Freshly issued CSRF token string.
184+
///
185+
/// # Returns
186+
///
187+
/// Nothing. Any serialization error is logged.
171188
pub fn append_csrf_cookie(headers: &mut HeaderMap, token: &str) {
172189
let cookie = build_csrf_cookie(token);
173190
if let Ok(value) = HeaderValue::from_str(&cookie.to_string()) {
@@ -178,6 +195,14 @@ pub fn append_csrf_cookie(headers: &mut HeaderMap, token: &str) {
178195
}
179196

180197
/// Appends a `Set-Cookie` header to clear the CSRF cookie.
198+
///
199+
/// # Arguments
200+
///
201+
/// * `headers` - Outgoing response headers to mutate.
202+
///
203+
/// # Returns
204+
///
205+
/// Nothing. Any serialization error is logged.
181206
pub fn append_csrf_removal(headers: &mut HeaderMap) {
182207
let cookie = build_csrf_removal();
183208
if let Ok(value) = HeaderValue::from_str(&cookie.to_string()) {
@@ -287,11 +312,19 @@ where
287312
}
288313

289314
/// Returns the name of the CSRF cookie.
315+
///
316+
/// # Returns
317+
///
318+
/// Static string slice with the cookie name.
290319
pub fn csrf_cookie_name() -> &'static str {
291320
CSRF_COOKIE_NAME
292321
}
293322

294323
/// Returns the name of the CSRF header.
324+
///
325+
/// # Returns
326+
///
327+
/// Static string slice with the header name.
295328
pub fn csrf_header_name() -> &'static str {
296329
CSRF_HEADER_NAME
297330
}

0 commit comments

Comments
 (0)