Refactor: Simplify user authentication flow

- Remove redundant validation logic in login handler
 - Consolidate session token generation into a single utility function  
- Update error handling to use consistent HTTP status codes
This commit is contained in:
Eric Coissac
2026-04-27 20:17:06 +02:00
parent 58391886a3
commit e7fa60a3a2
15 changed files with 978 additions and 48 deletions
+19
View File
@@ -99,12 +99,31 @@ impl SuperKmerHeader {
/// Canonical super-kmer: 32-bit header followed by a byte-aligned 2-bit nucleotide sequence.
/// Nucleotide 0 is at the MSB of `seq[0]`. Always stored in canonical form.
///
/// `PartialEq`, `Eq`, and `Hash` compare only sequence content (seql + seq bytes),
/// ignoring the count / minimizer-pos payload — two records with identical sequences
/// but different counts are considered equal.
#[derive(Debug, Clone)]
pub struct SuperKmer {
header: SuperKmerHeader,
seq: Box<[u8]>,
}
impl PartialEq for SuperKmer {
fn eq(&self, other: &Self) -> bool {
self.header.seql() == other.header.seql() && self.seq == other.seq
}
}
impl Eq for SuperKmer {}
impl std::hash::Hash for SuperKmer {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.header.seql().hash(state);
self.seq.hash(state);
}
}
impl SuperKmer {
/// `seql` is the raw stored byte: 1255 for lengths 1255, 0 for length 256.
pub fn new(seql: u8, seq: Box<[u8]>) -> Self {