Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Refactor and remove unnecessary fallbacks (#2159)

Leendert de Borstb9e479908f98
diff --git a/core/rust/src/ffi.rs b/core/rust/src/ffi.rs
index b57bce9e0..1fe06653e 100644
--- a/core/rust/src/ffi.rs
+++ b/core/rust/src/ffi.rs
@@ -7,7 +7,7 @@ use std::ffi::{c_char, CStr, CString};
use std::ptr;
use crate::credential_matcher::{filter_credentials, CredentialMatcherInput};
-use crate::vault_merge::{merge_vaults, MergeInput, SYNCABLE_TABLE_NAMES};
+use crate::vault_merge::{merge_vaults, MergeInput};
use crate::vault_pruner::{prune_vault, PruneInput};
/// Merge two vaults using LWW strategy.
diff --git a/core/rust/src/uniffi_api.rs b/core/rust/src/uniffi_api.rs
index f879b4ead..e94796d17 100644
--- a/core/rust/src/uniffi_api.rs
+++ b/core/rust/src/uniffi_api.rs
@@ -4,7 +4,6 @@
//! All functions use JSON strings for input/output to simplify cross-language marshalling.
use crate::error::VaultError;
-use crate::vault_merge::SYNCABLE_TABLE_NAMES;
/// Get the version of the aliasvault-core library.
#[uniffi::export]
diff --git a/core/rust/src/vault_codec/manifest.rs b/core/rust/src/vault_codec/manifest.rs
index 257c1a4c1..d21e8242d 100644
--- a/core/rust/src/vault_codec/manifest.rs
+++ b/core/rust/src/vault_codec/manifest.rs
@@ -102,7 +102,6 @@ pub struct CanonicalizedManifest {
#[serde(rename_all = "camelCase")]
pub struct CanonicalizedVault {
pub manifests: Vec<CanonicalizedManifest>,
- #[serde(default)]
pub data_buckets: Vec<DataBucket>,
}
@@ -116,11 +115,6 @@ impl CanonicalizedVault {
pub fn rest(&self) -> Vec<&CanonicalizedManifest> {
self.manifests.iter().skip(1).collect()
}
-
- /// Every manifest, in spec order, ready to hand back to [`crate::vault_codec::materialize_as_sqlite`].
- pub fn to_manifests(&self) -> Vec<Manifest> {
- self.manifests.iter().map(|m| m.manifest.clone()).collect()
- }
}
/// A single table's rows for reassembly.
@@ -187,7 +181,6 @@ impl CodecOverflow {
#[serde(rename_all = "camelCase")]
pub struct MaterializedTables {
pub tables: Vec<CodecTableData>,
- #[serde(default)]
pub overflow: CodecOverflow,
}
@@ -212,7 +205,6 @@ pub struct CanonicalizeInput {
#[serde(rename_all = "camelCase")]
pub struct MaterializeInput {
pub manifests: Vec<Manifest>,
- #[serde(default)]
pub data_buckets: Vec<DataBucket>,
pub schema_columns: HashMap<String, Vec<String>>,
}
diff --git a/core/rust/src/vault_codec/mod.rs b/core/rust/src/vault_codec/mod.rs
index 0d05b149e..0b78f6018 100644
--- a/core/rust/src/vault_codec/mod.rs
+++ b/core/rust/src/vault_codec/mod.rs
@@ -23,7 +23,6 @@ use serde_json::json;
use crate::error::{VaultError, VaultResult};
-pub use hash::{canonical_json, content_hash};
pub use manifest::{
BlobEntry, BucketLayoutEntry, CanonicalizeInput, CanonicalizedManifest, CanonicalizedVault, CodecOverflow, DataBucket,
Manifest, MaterializeInput, MaterializedTables, CodecRecord, CodecTableData, ManifestSpec,
@@ -32,7 +31,7 @@ pub use scoped_assets::{KIND_BUILTIN as LOGO_KIND_BUILTIN, KIND_CUSTOM as LOGO_K
pub use sharing::{active_encryption_key, extract_encryption_key_for_public_key};
pub use types::{
bucket_categories, bucket_category_for, is_bucketed_table, is_personal_table, tables_for_category, BLOB_COLUMNS, BUCKET_TABLES,
- ENCRYPTION_KEYS_TABLE, MANIFESTS_TABLE, MANIFEST_ID_COL, OVERFLOW_ROW_ID, OVERFLOW_TABLE, PERSONAL_TABLES, SCHEMA_VERSION, SKIP_TABLES,
+ ENCRYPTION_KEYS_TABLE, MANIFESTS_TABLE, MANIFEST_ID_COL, OVERFLOW_TABLE, PERSONAL_TABLES, SCHEMA_VERSION, SKIP_TABLES,
};
pub use validate::ValidationResult;
@@ -163,12 +162,6 @@ pub fn extract_encryption_key_for_public_key_json(manifest_json: &str, public_ke
Ok(serde_json::to_string(&extract_encryption_key_for_public_key(&m, public_key))?)
}
-/// Extract the manifest's active (primary, manifest-scoped) encryption key row.
-pub fn active_encryption_key_json(manifest_json: &str) -> VaultResult<String> {
- let m: Manifest = serde_json::from_str(manifest_json)?;
- Ok(serde_json::to_string(&active_encryption_key(&m))?)
-}
-
/// SHA-256 (lowercase hex) of a base64 ciphertext string — storage-layer integrity.
pub fn compute_ciphertext_hash(base64_ciphertext: &str) -> String {
match BASE64.decode(base64_ciphertext) {
@@ -220,7 +213,6 @@ pub fn extract_bucket_json(input_json: &str) -> VaultResult<String> {
struct Input {
manifest_id: String,
category: String,
- #[serde(default)]
tables: std::collections::HashMap<String, Vec<CodecRecord>>,
}
let input: Input = serde_json::from_str(input_json)?;
diff --git a/core/rust/src/wasm.rs b/core/rust/src/wasm.rs
index 0de9a5801..df1414776 100644
--- a/core/rust/src/wasm.rs
+++ b/core/rust/src/wasm.rs
@@ -172,7 +172,6 @@ pub fn vault_codec_extract_bucket_js(input: JsValue) -> Result<JsValue, JsValue>
struct Input {
manifest_id: String,
category: String,
- #[serde(default)]
tables: std::collections::HashMap<String, Vec<CodecRecord>>,
}
let input: Input = serde_wasm_bindgen::from_value(input)