chore: linting

This commit is contained in:
zhom
2026-04-11 17:49:36 +04:00
parent cff3f521c1
commit 2b583d1844
4 changed files with 21 additions and 23 deletions
+1 -1
View File
@@ -95,7 +95,7 @@
"path-to-regexp@>=8.0.0 <8.4.0": ">=8.4.0" "path-to-regexp@>=8.0.0 <8.4.0": ">=8.4.0"
} }
}, },
"packageManager": "pnpm@10.30.1", "packageManager": "pnpm@10.33.0",
"lint-staged": { "lint-staged": {
"**/*.{js,jsx,ts,tsx,json,css}": [ "**/*.{js,jsx,ts,tsx,json,css}": [
"biome check --fix" "biome check --fix"
+5 -17
View File
@@ -497,7 +497,7 @@ dependencies = [
"serde_json", "serde_json",
"serde_path_to_error", "serde_path_to_error",
"serde_urlencoded", "serde_urlencoded",
"sha1 0.10.6", "sha1",
"sync_wrapper", "sync_wrapper",
"tokio", "tokio",
"tokio-tungstenite 0.28.0", "tokio-tungstenite 0.28.0",
@@ -1816,19 +1816,18 @@ dependencies = [
"objc2", "objc2",
"objc2-app-kit", "objc2-app-kit",
"once_cell", "once_cell",
"pbkdf2",
"playwright", "playwright",
"quick-xml 0.39.2", "quick-xml 0.39.2",
"rand 0.10.0", "rand 0.10.0",
"regex-lite", "regex-lite",
"reqwest 0.13.2", "reqwest 0.13.2",
"resvg", "resvg",
"ring",
"rusqlite", "rusqlite",
"serde", "serde",
"serde_json", "serde_json",
"serde_yaml", "serde_yaml",
"serial_test", "serial_test",
"sha1 0.11.0",
"sha2 0.11.0", "sha2 0.11.0",
"smoltcp", "smoltcp",
"sys-locale", "sys-locale",
@@ -6221,17 +6220,6 @@ dependencies = [
"digest 0.10.7", "digest 0.10.7",
] ]
[[package]]
name = "sha1"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214"
dependencies = [
"cfg-if",
"cpufeatures 0.3.0",
"digest 0.11.2",
]
[[package]] [[package]]
name = "sha2" name = "sha2"
version = "0.10.9" version = "0.10.9"
@@ -7698,7 +7686,7 @@ dependencies = [
"httparse", "httparse",
"log", "log",
"rand 0.9.2", "rand 0.9.2",
"sha1 0.10.6", "sha1",
"thiserror 2.0.18", "thiserror 2.0.18",
"utf-8", "utf-8",
] ]
@@ -7716,7 +7704,7 @@ dependencies = [
"log", "log",
"native-tls", "native-tls",
"rand 0.9.2", "rand 0.9.2",
"sha1 0.10.6", "sha1",
"thiserror 2.0.18", "thiserror 2.0.18",
] ]
@@ -9305,7 +9293,7 @@ dependencies = [
"lzma-rs", "lzma-rs",
"memchr", "memchr",
"pbkdf2", "pbkdf2",
"sha1 0.10.6", "sha1",
"thiserror 2.0.18", "thiserror 2.0.18",
"time", "time",
"xz2", "xz2",
+1 -2
View File
@@ -83,8 +83,7 @@ argon2 = "0.5"
aes-gcm = "0.10" aes-gcm = "0.10"
aes = "0.9" aes = "0.9"
cbc = "0.2" cbc = "0.2"
pbkdf2 = "0.12" ring = "0.17"
sha1 = "0.11"
sha2 = "0.11" sha2 = "0.11"
hyper = { version = "1.8", features = ["full"] } hyper = { version = "1.8", features = ["full"] }
hyper-util = { version = "0.1", features = ["full"] } hyper-util = { version = "0.1", features = ["full"] }
+14 -3
View File
@@ -12,8 +12,10 @@ use tauri::AppHandle;
/// so no encryption path is needed here — Chromium reads plaintext when /// so no encryption path is needed here — Chromium reads plaintext when
/// `encrypted_value` is empty, regardless of what other cookies store. /// `encrypted_value` is empty, regardless of what other cookies store.
pub mod chrome_decrypt { pub mod chrome_decrypt {
use aes::cipher::{block_padding::Pkcs7, BlockDecryptMut, KeyIvInit}; use aes::cipher::{block_padding::Pkcs7, BlockModeDecrypt, KeyIvInit};
use ring::pbkdf2;
use sha2::{Digest, Sha256}; use sha2::{Digest, Sha256};
use std::num::NonZeroU32;
use std::path::Path; use std::path::Path;
type Aes128CbcDec = cbc::Decryptor<aes::Aes128>; type Aes128CbcDec = cbc::Decryptor<aes::Aes128>;
@@ -35,7 +37,16 @@ pub mod chrome_decrypt {
fn derive_key(password: &[u8]) -> [u8; KEY_LEN] { fn derive_key(password: &[u8]) -> [u8; KEY_LEN] {
let mut key = [0u8; KEY_LEN]; let mut key = [0u8; KEY_LEN];
pbkdf2::pbkdf2_hmac::<sha1::Sha1>(password, SALT, PBKDF2_ITERATIONS, &mut key); // Using ring::pbkdf2 instead of the `pbkdf2` crate to avoid digest
// version conflicts between sha1 0.11 (digest 0.11) and pbkdf2 0.12
// (digest 0.10). ring's implementation is self-contained.
pbkdf2::derive(
pbkdf2::PBKDF2_HMAC_SHA1,
NonZeroU32::new(PBKDF2_ITERATIONS).expect("iterations must be non-zero"),
SALT,
password,
&mut key,
);
key key
} }
@@ -88,7 +99,7 @@ pub mod chrome_decrypt {
let mut buf = ciphertext.to_vec(); let mut buf = ciphertext.to_vec();
let decrypted = Aes128CbcDec::new(key.into(), &IV.into()) let decrypted = Aes128CbcDec::new(key.into(), &IV.into())
.decrypt_padded_mut::<Pkcs7>(&mut buf) .decrypt_padded::<Pkcs7>(&mut buf)
.ok()?; .ok()?;
// Strip the SHA-256(host_key) integrity prefix if present. Older cookies // Strip the SHA-256(host_key) integrity prefix if present. Older cookies