Skip to main content

Module receive

Module receive 

Source
Expand description

bw receive / bw send receive — access a Bitwarden Send from a url.

This is the only Send flow that runs without a logged-in user: the send’s content is decrypted with a key derived purely from the URL fragment ([bitwarden_send::SendAccessKey]), never from the account key store. Because the link can point at any deployment, the command builds its own [PasswordManagerClient] per invocation from URLs derived off the link itself (see resolve_urls) rather than reusing the session client — a self-hosted receive link must not have its password hash sent to Bitwarden cloud identity, and vice versa.

Both bw receive <url> and bw send receive <url> are the same command; their arg structs are field-identical and both funnel into run_receive.

Structs§

CloudRegion 🔒
ReceiveInputs 🔒
The flags bw receive and bw send receive share, normalized into one struct so the two entry points cannot drift apart.

Constants§

CLOUD_HOSTS 🔒
The Bitwarden cloud deployments whose Send links do not carry their API host.

Functions§

access_with_email_otp 🔒
Email-OTP-protected Sends: the email request is what makes the server send the code, so the expected outcome of the first call is an email_and_otp_required error, not a token.
access_with_password 🔒
Password-protected Sends: resolve the password from flags/env/file/prompt, run it through the same PBKDF2 recipe bw send create --password used, and exchange it for a token.
attempt_access 🔒
Negotiate a send-access token, prompting for whatever credential the server says the Send needs. Mirrors the legacy attemptAccess: ask with no credentials first and branch on the typed send_access_error_type the server returns.
can_interact 🔒
Whether we may prompt the user.
download_bytes 🔒
GET a pre-signed blob URL with the client’s shared HTTP stack (so proxy and TLS settings apply), mirroring legacy’s apiService.nativeFetch.
invalid_grant_type 🔒
The send_access_error_type of an invalid_grant response, if that’s what this is.
invalid_request_type 🔒
The send_access_error_type of an invalid_request response, if that’s what this is.
parse_send_url 🔒
Extract (send_id, url_b64_key) from the last two #-fragment segments.
password_from_args 🔒
Non-interactive half of resolve_password, split out so the precedence is unit-testable.
prompt_email 🔒
prompt_otp 🔒
prompt_password 🔒
Prompt for the Send’s password. inquire renders to stderr, so bw receive <url> > out.txt still captures only the Send’s content — the same reason legacy passes output: process.stderr to inquirer.
render_access 🔒
Fetch the Send with the negotiated token, decrypt it with the URL key, and render it.
request_token 🔒
resolve_password 🔒
Resolve the Send’s password, prompting when it wasn’t supplied and the session is interactive. Mirrors legacy’s handlePasswordAuth precedence exactly.
resolve_urls 🔒
Resolve the API and identity base URLs to talk to for a given Send link.
run_receive 🔒
Entry point shared by super::ReceiveArgs and super::send::SendReceiveArgs.
same_origin 🔒
true when configured denotes the same origin as origin (already an ASCII origin serialization). Falls back to a string compare for values that aren’t parseable URLs, so a hand-edited config.json still matches.
save_file_send 🔒
Download, decrypt, and save a file-type Send’s blob.
token_error 🔒
Surface a token-negotiation failure we have no specific message for. The error’s Debug carries the server’s error_description, which is diagnostic and never contains send content or credentials.
trimmed 🔒