use poem_openapi::{
ApiRequest, Object,
payload::{Json, PlainText},
};
#[derive(ApiRequest)]
pub enum CreateUser {
WithName(PlainText<String>),
}
#[derive(ApiRequest)]
pub enum PrepareLogin {
WithName(PlainText<String>),
}
#[derive(Object)]
pub struct AuthenticationChallengeResponse {
pub username: String,
pub password: Option<String>,
pub totp: Option<u32>,
pub pubkey_credential: Option<serde_json::Value>,
pub existing_jwt: Option<String>,
}
#[derive(ApiRequest)]
pub enum FinishLogin {
WithName(Json<AuthenticationChallengeResponse>),
}
#[derive(ApiRequest)]
pub enum SetPassword {
NewPassword(PlainText<String>),
}
#[derive(Object)]
pub struct TotpLabel {
pub label: String,
pub issuer: String,
}
#[derive(ApiRequest)]
pub enum NewTotp {
WithLabel(Json<TotpLabel>),
}
#[derive(ApiRequest)]
pub enum ConfirmNewTotp {
CurrentTotp(PlainText<String>),
}
#[derive(Object)]
pub struct WebauthnRegisterChallengeResponse {
pub key_name: String,
pub register_credential: serde_json::Value,
}
#[derive(ApiRequest)]
pub enum ConfirmNewWebauthnCredential {
ChallengeResponse(Json<WebauthnRegisterChallengeResponse>),
}
#[derive(ApiRequest)]
pub enum DeleteWebAuthnCredential {
WithKeyName(PlainText<String>),
}