Something went wrong. Try again.
Chris’s PDS implementation
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031use rusqlite::params;
use crate::{ database::{Database, now}, error::Result,};
impl Database { /// Atomically consume a one-time token or proof identifier. pub(crate) fn consume_space_auth_jti( &self, kind: &str, issuer: &str, jti: &str, expires_at: i64, ) -> Result<bool> { self.transaction(|transaction| { transaction.execute( "DELETE FROM space_auth_replays WHERE expires_at < ?1", params![now()], )?; let inserted = transaction.execute( "INSERT OR IGNORE INTO space_auth_replays (kind, issuer, jti, expires_at) VALUES (?1, ?2, ?3, ?4)", params![kind, issuer, jti, expires_at], )?; Ok(inserted == 1) }) }}