mirror of
https://github.com/aljazceru/pubky-core.git
synced 2026-01-31 03:44:19 +01:00
feat(js): return Session class from auth methods
This commit is contained in:
@@ -12,13 +12,13 @@ use crate::{auth::AuthToken, capabilities::Capability, timestamp::Timestamp};
|
||||
// and get more informations from the user-agent.
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Eq, PartialEq)]
|
||||
pub struct Session {
|
||||
pub version: usize,
|
||||
pub pubky: PublicKey,
|
||||
pub created_at: u64,
|
||||
version: usize,
|
||||
pubky: PublicKey,
|
||||
created_at: u64,
|
||||
/// User specified name, defaults to the user-agent.
|
||||
pub name: String,
|
||||
pub user_agent: String,
|
||||
pub capabilities: Vec<Capability>,
|
||||
name: String,
|
||||
user_agent: String,
|
||||
capabilities: Vec<Capability>,
|
||||
}
|
||||
|
||||
impl Session {
|
||||
@@ -33,6 +33,16 @@ impl Session {
|
||||
}
|
||||
}
|
||||
|
||||
// === Getters ===
|
||||
|
||||
pub fn pubky(&self) -> &PublicKey {
|
||||
&self.pubky
|
||||
}
|
||||
|
||||
pub fn capabilities(&self) -> &Vec<Capability> {
|
||||
&self.capabilities
|
||||
}
|
||||
|
||||
// === Setters ===
|
||||
|
||||
pub fn set_user_agent(&mut self, user_agent: String) -> &mut Self {
|
||||
|
||||
Reference in New Issue
Block a user