use crate::filesystem::Filesystem;
const OWNER_FILE: &str = ".lh_owner";
pub(crate) async fn current_owner() -> Option<String> {
let fs = super::shared_opfs();
let bytes = fs.read(OWNER_FILE).await.ok()?;
let s = String::from_utf8(bytes).ok()?.trim().to_string();
if s.is_empty() { None } else { Some(s) }
}
pub(crate) async fn claim() -> Result<String, String> {
let id = uuid::Uuid::new_v4().to_string();
let fs = super::shared_opfs();
fs.write_atomic(OWNER_FILE, id.as_bytes())
.await
.map_err(|e| e.to_string())?;
Ok(id)
}
#[allow(dead_code)]
pub(crate) async fn release() {
let fs = super::shared_opfs();
let _ = fs.delete(OWNER_FILE).await;
}