Browse Source

Add authType field to Send API responses

Fixes #6976 - Sends were incorrectly showing as password protected in the web UI even when no password was set.

The web-vault recently changed to use the authType field to determine protection status instead of just checking for the presence of the password field. This change adds the authType field to Send API responses:
- authType: 0 = no authentication required
- authType: 1 = password protected

This aligns Vaultwarden's API with the updated web-vault expectations.
pull/7045/head
Jalen Francis 2 weeks ago
parent
commit
f3ecc8c7bd
  1. 4
      src/db/models/send.rs

4
src/db/models/send.rs

@ -131,6 +131,9 @@ impl Send {
data["size"] = Value::String(size.to_string());
}
// Determine authType based on Bitwarden's AuthType enum: Email=0, Password=1, None=2
let auth_type = if self.password_hash.is_some() { 1 } else { 2 };
json!({
"id": self.uuid,
"accessId": BASE64URL_NOPAD.encode(Uuid::parse_str(&self.uuid).unwrap_or_default().as_bytes()),
@ -145,6 +148,7 @@ impl Send {
"maxAccessCount": self.max_access_count,
"accessCount": self.access_count,
"password": self.password_hash.as_deref().map(|h| BASE64URL_NOPAD.encode(h)),
"authType": auth_type,
"disabled": self.disabled,
"hideEmail": self.hide_email,

Loading…
Cancel
Save