use pubky_common::auth::jws::GrantId;
use pubky_common::capabilities::Capabilities;
use pubky_common::crypto::PublicKey;
#[cfg(test)]
use super::crypto::session_token::SessionBearer;
use super::crypto::session_token::SessionTokenHash;
#[derive(Clone, Debug)]
pub struct GrantSession {
pub user_key: PublicKey,
pub capabilities: Capabilities,
pub grant_id: GrantId,
pub token_expires_at: u64,
pub(super) token_hash: SessionTokenHash,
}
#[cfg(test)]
impl GrantSession {
pub(crate) fn test(
user_key: PublicKey,
capabilities: Capabilities,
grant_id: GrantId,
token_expires_at: u64,
) -> Self {
Self {
user_key,
capabilities,
grant_id,
token_expires_at,
token_hash: SessionBearer::generate().hash(),
}
}
}