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

commit bdc1cd13a7140e50cba530d5f018602f3ff69100
parent 53da073274f739478175cfb15c323001ad77e626
Author: Daniel GarcĂ­a <dani-garcia@users.noreply.github.com>
Date:   Wed,  9 Nov 2022 22:37:53 +0100

Merge branch 'BlackDex-add-knowndevice-endpoint'

Diffstat:
Msrc/api/core/accounts.rs | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/api/core/accounts.rs b/src/api/core/accounts.rs @@ -36,6 +36,7 @@ pub fn routes() -> Vec<rocket::Route> { verify_password, api_key, rotate_api_key, + get_known_device, ] } @@ -739,3 +740,16 @@ async fn api_key(data: JsonUpcase<SecretVerificationRequest>, headers: Headers, async fn rotate_api_key(data: JsonUpcase<SecretVerificationRequest>, headers: Headers, conn: DbConn) -> JsonResult { _api_key(data, true, headers, conn).await } + +#[get("/devices/knowndevice/<email>/<uuid>")] +async fn get_known_device(email: String, uuid: String, mut conn: DbConn) -> String { + // This endpoint doesn't have auth header + if let Some(user) = User::find_by_mail(&email, &mut conn).await { + match Device::find_by_uuid_and_user(&uuid, &user.uuid, &mut conn).await { + Some(_) => String::from("true"), + _ => String::from("false"), + } + } else { + String::from("false") + } +}