feat: reorganize with remote

This commit is contained in:
Jet Pham 2026-03-10 19:43:24 -07:00 committed by Jet
parent a74e5753fa
commit dc7b8cbadd
28 changed files with 622 additions and 3024 deletions

View file

@ -0,0 +1,8 @@
[package]
name = "noisebell-common"
version = "0.1.0"
edition = "2021"
[dependencies]
axum = "0.8"
serde = { version = "1.0", features = ["derive"] }

View file

@ -0,0 +1,24 @@
use axum::http::HeaderMap;
use serde::{Deserialize, Serialize};
pub fn validate_bearer(headers: &HeaderMap, expected: &str) -> bool {
headers
.get("authorization")
.and_then(|v| v.to_str().ok())
.map(|v| v.strip_prefix("Bearer ").unwrap_or("") == expected)
.unwrap_or(false)
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WebhookPayload {
pub status: String,
pub timestamp: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct HistoryEntry {
pub id: i64,
pub status: String,
pub timestamp: u64,
pub recorded_at: u64,
}