Fix shared collection deserialization

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Manav Rathi
2025-08-30 10:49:54 +05:30
parent 82e1a0e358
commit ac68b99ecf
3 changed files with 12 additions and 3 deletions

View File

@@ -98,7 +98,7 @@ The project has completed foundational components (crypto, storage, models) and
## Commit Guidelines
### Pre-commit Checklist
### Pre-commit Checklist (RUN BEFORE EVERY COMMIT!)
**CRITICAL: CI will fail if ANY of these checks fail. Run ALL commands and ensure they ALL pass.**

View File

@@ -170,7 +170,7 @@ pub struct Collection {
pub id: i64,
pub owner: CollectionUser,
pub encrypted_key: String,
pub key_decryption_nonce: String,
pub key_decryption_nonce: Option<String>,
pub name: Option<String>,
pub encrypted_name: Option<String>,
pub name_decryption_nonce: Option<String>,

View File

@@ -181,9 +181,18 @@ async fn export_account(storage: &Storage, account: &Account, filter: &ExportFil
);
// Decrypt collection key
// Shared collections don't have key_decryption_nonce - they use a different mechanism
let Some(ref key_nonce) = collection.key_decryption_nonce else {
log::warn!(
"Collection {} appears to be shared (no key_decryption_nonce), skipping for now",
collection.id
);
continue;
};
let collection_key = match decrypt_collection_key(
&collection.encrypted_key,
&collection.key_decryption_nonce,
key_nonce,
master_key,
secret_key,
) {