Expand description
§Bitwarden Exporters
Contains the export and import functionality for Bitwarden Password Manager.
§Supported formats
| Format | Export | Import | Source |
|---|---|---|---|
| CSV | Yes | No | src/csv.rs |
| JSON | Yes | No | src/json.rs |
| Encrypted JSON | Yes | No | src/encrypted_json.rs |
| Credential Exchange | Yes | Yes | src/cxf/ |
- CSV — Flat export of Login and SecureNote items only. Cards, identities, and SSH keys are excluded.
- JSON — Unencrypted JSON containing all cipher types (Login, SecureNote, Card, Identity, SshKey) and folders.
- Encrypted JSON — Same structure as JSON, but password-protected using the account’s KDF settings (PBKDF2 or Argon2id).
- CXF (Credential Exchange Format) — FIDO Alliance standard for transferring credentials between providers. This is the only format that supports both export and import.
§Crate structure
src/
├── lib.rs # Public types and re-exports
├── exporter_client.rs # ExporterClient + ExporterClientExt trait (entry point)
├── export.rs # Orchestrates decrypt → format → output
├── models.rs # Conversions between vault models and export types
├── error.rs # ExportError (aggregates per-format errors)
├── csv.rs # CSV formatter
├── json.rs # JSON formatter
├── encrypted_json.rs # Password-protected JSON formatter
├── uniffi_support.rs # UniFFI mobile bindings support
└── cxf/ # Credential Exchange Format
├── mod.rs
├── export.rs # build_cxf()
├── import.rs # parse_cxf()
└── *.rs # Per-credential-type converters (login, card, identity, etc.)§Data flow
§Export (CSV & JSON)
ExporterClient::export_vault decrypts ciphers and folders via the KeyStore, passes them
through the chosen format module (csv, json, or encrypted_json), and returns the result as a
String.
use bitwarden_core::Client;
use bitwarden_exporters::{ExporterClientExt, ExportFormat};
fn export(client: &Client, folders: Vec<Folder>, ciphers: Vec<Cipher>) {
let export = client
.exporters()
.export_vault(folders, ciphers, ExportFormat::Json)
.unwrap();
}§Credential Exchange
§Import
ExporterClient::import_cxf parses a CXF JSON string into ImportingCipher values, encrypts
each one via the KeyStore, and returns Vec<Cipher> ready for storage.
use bitwarden_core::Client;
use bitwarden_exporters::ExporterClientExt;
fn import(client: &Client, cxf_payload: String) {
let ciphers = client
.exporters()
.import_cxf(cxf_payload)
.unwrap();
}§Export
ExporterClient::export_cxf decrypts ciphers and converts them to the Credential Exchange
Format.
use bitwarden_core::Client;
use bitwarden_exporters::{Account, ExporterClientExt};
fn export_cxf(client: &Client, account: Account, ciphers: Vec<Cipher>) {
let cxf_json = client
.exporters()
.export_cxf(account, ciphers)
.unwrap();
}§Testing
Run the crate tests with:
cargo test -p bitwarden-exportersTest fixtures live in the resources/ directory (sample JSON exports, CXF payloads from Dashlane,
1Password, and Devolutions).
Modules§
- csv 🔒
- cxf 🔒
- Credential Exchange Format (CXF)
- encrypted_
json 🔒 - error 🔒
- export 🔒
- exporter_
client 🔒 - json 🔒
- models 🔒
- uniffi_
support 🔒
Structs§
- Account
- Temporary struct to hold metadata related to current account
- Card
- Cipher
- Export representation of a Bitwarden cipher.
- Exporter
Client - Fido2
Credential - Field
- Folder
- Export representation of a Bitwarden folder.
- Identity
- Importing
Cipher - Import representation of a Bitwarden cipher.
- Login
- Login
Uri - Secure
Note - SshKey
Enums§
Constants§
- UNIFFI_
META_ 🔒CONST_ BITWARDEN_ EXPORTERS_ ENUM_ EXPORTFORMAT - UNIFFI_
META_ 🔒CONST_ NAMESPACE_ BITWARDEN_ EXPORTERS - Export namespace metadata.
Traits§
Functions§
- sanitize_
uri 🔒 - Sanitizes a single URI string by ensuring it has a proper scheme.