//! Utility functions for the vault crate

// Add serialization helpers, random salt generation, etc.

/// Returns the current unix timestamp as u64 (seconds since epoch)
pub fn now() -> u64 {
    #[cfg(target_arch = "wasm32")]
    {
        // Use JS Date.now() in milliseconds, convert to seconds
        
        let date = js_sys::Date::new_0();
        (date.get_time() / 1000.0) as u64
    }
    #[cfg(not(target_arch = "wasm32"))]
    {
        use std::time::{SystemTime, UNIX_EPOCH};
        SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs()
    }
}
