Skip to content

Commit e770357

Browse files
committed
Ensure KeyObfuscator backwards compatibility with v0.3.1
We add a simple test that ensures we can still deobfuscate v0.3.1-obfuscated keys. Co-authored by Claude AI.
1 parent f879b51 commit e770357

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/util/key_obfuscator.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,21 @@ mod tests {
175175
);
176176
}
177177

178+
#[test]
179+
fn deobfuscate_v031_key() {
180+
// This test ensures backward compatibility with v0.3.1 obfuscated keys.
181+
// The obfuscated key was generated using v0.3.1 with:
182+
// - obfuscation_master_key: [0xAB; 32]
183+
// - original key: "my_storage_key_v031_compat"
184+
let obfuscation_master_key = [0xAB; 32];
185+
let key_obfuscator = KeyObfuscator::new(obfuscation_master_key);
186+
187+
let v031_obfuscated_key = "nxrixRQPGawY+a9JFLThii0RgeADtEdSjh2YDgpZhBKOuw6GKr5UAIIwsQCathJlZsmuSku+RGB1/JuxFUMQGoAwa+M8tg";
188+
189+
let deobfuscated_key = key_obfuscator.deobfuscate(v031_obfuscated_key).unwrap();
190+
assert_eq!(deobfuscated_key, "my_storage_key_v031_compat");
191+
}
192+
178193
use proptest::prelude::*;
179194

180195
proptest! {

0 commit comments

Comments
 (0)