diff --git a/atuin-client/src/history/store.rs b/atuin-client/src/history/store.rs index 73166de1..442da45d 100644 --- a/atuin-client/src/history/store.rs +++ b/atuin-client/src/history/store.rs @@ -164,7 +164,16 @@ impl HistoryStore { for record in records.into_iter() { let hist = match record.version.as_str() { HISTORY_VERSION => { - let decrypted = record.decrypt::(&self.encryption_key)?; + let decrypted = record.decrypt::(&self.encryption_key); + + let decrypted = match decrypted { + Ok(d) => d, + Err(e) => { + println!("failed to decrypt history: {e}"); + continue; + } + }; + HistoryRecord::deserialize(&decrypted.data, HISTORY_VERSION) } version => bail!("unknown history version {version:?}"), diff --git a/atuin-client/src/record/encryption.rs b/atuin-client/src/record/encryption.rs index c2cdaa6a..ca49660c 100644 --- a/atuin-client/src/record/encryption.rs +++ b/atuin-client/src/record/encryption.rs @@ -128,6 +128,7 @@ impl PASETO_V4 { // For now though we will only support the one key and key rotation will // have to be a hard reset let current_kid = wrapping_key.to_id(); + ensure!( current_kid == kid, "attempting to decrypt with incorrect key. currently using {current_kid}, expecting {kid}"