bitwarden_importers/
lib.rs1#![doc = include_str!("../README.md")]
2
3use bitwarden_collections::collection::{CollectionId, CollectionType};
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;
19pub use importers::onepassword::access::{
20 Credentials, SignInAddress, SignInDomain, SignInMethods as OnePasswordSignInMethods,
21 TotpResult as OnePasswordTotpResult, TwoFactorUi as OnePasswordTwoFactorUi,
22 model::{ItemCategory, SkippedItem, SkippedReason, SkippedVault},
23};
24mod pipeline;
25#[cfg(feature = "wasm")]
26mod wasm;
27
28#[allow(missing_docs)]
37#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
38#[cfg_attr(
39 feature = "wasm",
40 derive(serde::Serialize, serde::Deserialize, tsify::Tsify),
41 tsify(from_wasm_abi)
42)]
43pub struct ImportOptions {
44 pub organization_id: Option<OrganizationId>,
45 pub target_folder: Option<ImportTargetFolder>,
46 pub target_collection: Option<ImportTargetCollection>,
47 #[cfg_attr(feature = "wasm", tsify(type = "CipherType[]"))]
50 pub restricted_types: Vec<VaultCipherType>,
51}
52
53#[allow(missing_docs)]
55#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
56#[cfg_attr(
57 feature = "wasm",
58 derive(serde::Serialize, serde::Deserialize, tsify::Tsify),
59 tsify(from_wasm_abi)
60)]
61pub struct ImportTargetFolder {
62 pub id: FolderId,
63 pub name: String,
64}
65
66#[allow(missing_docs)]
70#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
71#[cfg_attr(
72 feature = "wasm",
73 derive(serde::Serialize, serde::Deserialize, tsify::Tsify),
74 tsify(from_wasm_abi)
75)]
76pub struct ImportTargetCollection {
77 pub id: CollectionId,
78 pub name: String,
79 pub r#type: CollectionType,
80}
81
82#[allow(missing_docs)]
85#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
86#[cfg_attr(
87 feature = "wasm",
88 derive(serde::Serialize, serde::Deserialize, tsify::Tsify),
89 tsify(into_wasm_abi)
90)]
91pub struct ImportSummary {
92 pub ciphers: Vec<CipherTypeCount>,
93 pub folders: u32,
94 pub collections: u32,
95}
96
97#[allow(missing_docs)]
99#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
100#[cfg_attr(
101 feature = "wasm",
102 derive(serde::Serialize, serde::Deserialize, tsify::Tsify),
103 tsify(into_wasm_abi)
104)]
105pub struct OnePasswordImportSummary {
106 pub imported: ImportSummary,
107 pub skipped_vaults: Vec<SkippedVault>,
108 pub skipped_items: Vec<SkippedItem>,
109}
110
111#[allow(missing_docs)]
113#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
114#[cfg_attr(
115 feature = "wasm",
116 derive(serde::Serialize, serde::Deserialize, tsify::Tsify),
117 tsify(into_wasm_abi)
118)]
119pub struct CipherTypeCount {
120 #[cfg_attr(feature = "wasm", tsify(type = "CipherType"))]
121 pub r#type: VaultCipherType,
122 pub count: u32,
123}