1use crate::mfa::MFAMethod;
2use serde::Deserialize;
3
4#[derive(Deserialize, Debug, Clone)]
6#[cfg_attr(feature = "schemas", derive(JsonSchema))]
7pub struct WebPushSubscription {
8 pub endpoint: String,
9 pub p256dh: String,
10 pub auth: String,
11}
12
13#[derive(Deserialize, Debug, Clone)]
15pub struct Session {
16 #[serde(rename = "_id")]
18 pub id: String,
19 pub user_id: String,
21 pub token: String,
23 pub name: String,
25 pub subscription: Option<WebPushSubscription>,
27}
28
29#[derive(Deserialize, Debug, Clone)]
31pub struct SessionInfo {
32 #[serde(rename = "_id")]
33 pub id: String,
34 pub name: String,
35}
36
37#[derive(Deserialize, Debug, Clone)]
39#[serde(tag = "result")]
40pub enum LoginResponse {
41 Success(Session),
42 MFA {
43 ticket: String,
44 allowed_methods: Vec<MFAMethod>,
45 },
46 Disabled {
47 user_id: String,
48 },
49}