Skip to main content

Module client

Module client 

Source
Expand description

The Vaultwarden HTTP client. Stateless about auth: every authed call takes the access token the workspaceโ€™s VaultSession holds, so the session is the one owner of the tokens and the client can be shared across seats.

Re-exportsยง

use std::time::Duration; ๐Ÿ”’
use futures::StreamExt; ๐Ÿ”’
use serde::de::DeserializeOwned; ๐Ÿ”’
use serde_json::Value; ๐Ÿ”’
use zeroize::Zeroize; ๐Ÿ”’
use zeroize::Zeroize; ๐Ÿ”’
use crate::vault::VaultError; ๐Ÿ”’
use crate::vault::models::AttachmentMeta; ๐Ÿ”’
use crate::vault::models::Folder; ๐Ÿ”’
use crate::vault::models::FolderList; ๐Ÿ”’
use crate::vault::models::Prelogin; ๐Ÿ”’
use crate::vault::models::SyncData; ๐Ÿ”’
use crate::vault::models::TokenResponse; ๐Ÿ”’
use crate::vault::models::TwoFactorCode; ๐Ÿ”’

Structsยง

VaultClient

Enumsยง

ErrorFields ๐Ÿ”’
Which fields of an error body a route may surface.

Constantsยง

API_ERROR_POINTERS ๐Ÿ”’
CLIENT_ID
The OAuth client id Vaultwardenโ€™s token endpoint expects for a password grant. There is no secret: the password grant is a public client.
CLIENT_VERSION
The client version every request carries. GET /api/sync omits SSH keys unless this is at least 2024.12.0, so the value is load-bearing rather than decorative.
CONNECT_TIMEOUT
Bounds for one ordinary vault call. A stalled server must fail the call rather than hold the unlock or refresh gate for ever, which would queue every later vault call behind it.
DOWNLOAD_READ_TIMEOUT
A download is opaque ciphertext up to the attachment cap, so its idle read bound and total bound are longer than an API callโ€™s.
DOWNLOAD_TIMEOUT
OAUTH_ERROR_POINTERS ๐Ÿ”’
READ_TIMEOUT
REQUEST_TIMEOUT

Functionsยง

api_error ๐Ÿ”’
Map a non-2xx response to the error the facade branches on.
path_segment ๐Ÿ”’
Percent-encode one id for a path segment. An empty id is refused rather than sent as a route with a hole in it.
retry_after ๐Ÿ”’
The serverโ€™s Retry-After hint, when it sends a whole number of seconds.
safe_error ๐Ÿ”’
The serverโ€™s own error text and nothing else. Vaultwarden states an API refusal in message, Rocketโ€™s catcher nests its reason under error, and the identity endpoint uses the OAuth error pair. A body that does not parse contributes nothing.
send_request ๐Ÿ”’
Send one request, dropping the URL from any transport error: a signed download URL carries its token in the query string.
user_agent
The user agent every vault request carries.