vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

yubikey.rs (1500B)


      1 use crate::{api::PasswordOrOtpData, auth::Headers, error::Error};
      2 use rocket::{serde::json::Json, Route};
      3 
      4 pub fn routes() -> Vec<Route> {
      5     routes![activate_yubikey, activate_yubikey_put, generate_yubikey]
      6 }
      7 
      8 #[derive(Deserialize)]
      9 #[serde(rename_all = "camelCase")]
     10 struct EnableYubikeyData {
     11     #[allow(dead_code)]
     12     key1: Option<String>,
     13     #[allow(dead_code)]
     14     key2: Option<String>,
     15     #[allow(dead_code)]
     16     key3: Option<String>,
     17     #[allow(dead_code)]
     18     key4: Option<String>,
     19     #[allow(dead_code)]
     20     key5: Option<String>,
     21     #[allow(dead_code)]
     22     nfc: bool,
     23     #[allow(dead_code)]
     24     master_password_hash: Option<String>,
     25     #[allow(dead_code)]
     26     otp: Option<String>,
     27 }
     28 const YUBI_DISABLED_MSG: &str = "Yubico OTP is disabled.";
     29 #[allow(unused_variables, clippy::needless_pass_by_value)]
     30 #[post("/two-factor/get-yubikey", data = "<data>")]
     31 fn generate_yubikey(data: Json<PasswordOrOtpData>, _headers: Headers) -> Error {
     32     Error::new(YUBI_DISABLED_MSG, YUBI_DISABLED_MSG)
     33 }
     34 
     35 #[allow(unused_variables, clippy::needless_pass_by_value)]
     36 #[post("/two-factor/yubikey", data = "<data>")]
     37 fn activate_yubikey(data: Json<EnableYubikeyData>, _headers: Headers) -> Error {
     38     Error::new(YUBI_DISABLED_MSG, YUBI_DISABLED_MSG)
     39 }
     40 
     41 #[allow(unused_variables, clippy::needless_pass_by_value)]
     42 #[put("/two-factor/yubikey", data = "<data>")]
     43 fn activate_yubikey_put(data: Json<EnableYubikeyData>, _headers: Headers) -> Error {
     44     Error::new(YUBI_DISABLED_MSG, YUBI_DISABLED_MSG)
     45 }