pub mod signer;
pub mod status;
pub use signer::{SessionKey, SessionRefusal, may_sign};
pub use status::{Status, status};
use df_hyperliquid_core::utils::Address;
use crate::trade::intent::{Refusal, RegisterSessionKey, deadline};
pub const SESSION_TTL_MS: u64 = 2_592_000_000;
pub const RENEW_BEFORE_MS: u64 = 3_660_000;
#[must_use]
pub const fn expiry(now_ms: u64) -> u64 {
(now_ms + SESSION_TTL_MS) / 1000
}
pub fn registration(
user: Address,
key: Address,
held_until_ms: u64,
nonce: u128,
now_ms: u64,
) -> Result<RegisterSessionKey, Refusal> {
RegisterSessionKey::new(user, key, held_until_ms / 1000, nonce, deadline(now_ms))
}
#[cfg(test)]
#[path = "tests/session_key.rs"]
mod tests;