bitwarden_importers/
lib.rs1#![doc = include_str!("../README.md")]
2
3use bitwarden_collections::collection::CollectionId;
4use bitwarden_core::OrganizationId;
5use bitwarden_vault::{CipherType as VaultCipherType, FolderId};
6
7#[cfg(feature = "uniffi")]
8uniffi::setup_scaffolding!();
9#[cfg(feature = "uniffi")]
10mod uniffi_support;
11
12mod error;
13pub use error::ImportError;
14mod import;
15mod importer_client;
16pub use importer_client::{ImporterClient, ImporterClientExt};
17mod importers;
18pub(crate) use importers::keeper;
19mod pipeline;
20
21#[cfg(feature = "test-utils")]
27pub use importers::onepassword::access as onepassword_access;
28
29#[allow(missing_docs)]
38#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
39#[cfg_attr(
40 feature = "wasm",
41 derive(serde::Serialize, serde::Deserialize, tsify::Tsify),
42 tsify(from_wasm_abi)
43)]
44pub struct ImportOptions {
45 pub organization_id: Option<OrganizationId>,
46 pub target_folder: Option<ImportTargetFolder>,
47 pub target_collection: Option<ImportTargetCollection>,
48 #[cfg_attr(feature = "wasm", tsify(type = "CipherType[]"))]
51 pub restricted_types: Vec<VaultCipherType>,
52}
53
54#[allow(missing_docs)]
56#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
57#[cfg_attr(
58 feature = "wasm",
59 derive(serde::Serialize, serde::Deserialize, tsify::Tsify),
60 tsify(from_wasm_abi)
61)]
62pub struct ImportTargetFolder {
63 pub id: FolderId,
64 pub name: String,
65}
66
67#[allow(missing_docs)]
69#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
70#[cfg_attr(
71 feature = "wasm",
72 derive(serde::Serialize, serde::Deserialize, tsify::Tsify),
73 tsify(from_wasm_abi)
74)]
75pub struct ImportTargetCollection {
76 pub id: CollectionId,
77 pub name: String,
78}
79
80#[allow(missing_docs)]
83#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
84#[cfg_attr(
85 feature = "wasm",
86 derive(serde::Serialize, serde::Deserialize, tsify::Tsify),
87 tsify(into_wasm_abi)
88)]
89pub struct ImportSummary {
90 pub ciphers: Vec<CipherTypeCount>,
91 pub folders: u32,
92 pub collections: u32,
93}
94
95#[allow(missing_docs)]
97#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
98#[cfg_attr(
99 feature = "wasm",
100 derive(serde::Serialize, serde::Deserialize, tsify::Tsify),
101 tsify(into_wasm_abi)
102)]
103pub struct CipherTypeCount {
104 #[cfg_attr(feature = "wasm", tsify(type = "CipherType"))]
105 pub r#type: VaultCipherType,
106 pub count: u32,
107}