chrome-tools 1.1.18 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -7
- package/dist/chrome_abe_decrypt.exe +0 -0
- package/dist/chromium/addresses.d.ts +2 -0
- package/dist/chromium/browsers.d.ts +73 -0
- package/dist/chromium/local-storage.d.ts +7 -0
- package/dist/chromium/profiles.d.ts +130 -0
- package/dist/cli.js +95 -8821
- package/dist/core/crypto.d.ts +52 -0
- package/dist/core/keychain.d.ts +57 -0
- package/dist/core/limit.d.ts +4 -0
- package/dist/core/sql.d.ts +2 -0
- package/dist/index.d.ts +28 -628
- package/dist/index.js +29 -2520
- package/dist/modules/autofill.d.ts +68 -0
- package/dist/modules/bookmarks.d.ts +22 -0
- package/dist/modules/cookies.d.ts +40 -0
- package/dist/modules/downloads.d.ts +27 -0
- package/dist/modules/extensions.d.ts +24 -0
- package/dist/modules/history.d.ts +34 -0
- package/dist/modules/local-storage.d.ts +21 -0
- package/dist/modules/passwords.d.ts +50 -0
- package/dist/modules/search-engines.d.ts +21 -0
- package/dist/modules/top-sites.d.ts +17 -0
- package/dist/platform/darwin.d.ts +12 -0
- package/dist/platform/index.d.ts +33 -0
- package/dist/platform/linux.d.ts +10 -0
- package/dist/platform/types.d.ts +49 -0
- package/dist/platform/win32.d.ts +13 -0
- package/dist/storage/binary.d.ts +6 -0
- package/dist/storage/errors.d.ts +13 -0
- package/dist/storage/files.d.ts +5 -0
- package/dist/storage/leveldb.d.ts +8 -0
- package/dist/storage/sqlite.d.ts +5 -0
- package/package.json +9 -10
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type ResolveProfilesOptions } from "../chromium/profiles.js";
|
|
2
|
+
export interface AutofillOptions extends ResolveProfilesOptions {
|
|
3
|
+
search?: string;
|
|
4
|
+
limit?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface AutofillEntry {
|
|
7
|
+
profile: string;
|
|
8
|
+
name: string;
|
|
9
|
+
value: string;
|
|
10
|
+
dateCreated: string;
|
|
11
|
+
dateLastUsed: string;
|
|
12
|
+
count: number;
|
|
13
|
+
}
|
|
14
|
+
export interface CreditCardOptions extends ResolveProfilesOptions {
|
|
15
|
+
decryptionKey?: Buffer;
|
|
16
|
+
}
|
|
17
|
+
export interface CreditCardEntry {
|
|
18
|
+
profile: string;
|
|
19
|
+
guid: string;
|
|
20
|
+
nameOnCard: string;
|
|
21
|
+
expirationMonth: number;
|
|
22
|
+
expirationYear: number;
|
|
23
|
+
cardNumber: string;
|
|
24
|
+
nickname: string;
|
|
25
|
+
origin: string;
|
|
26
|
+
useCount: number;
|
|
27
|
+
dateModified: string;
|
|
28
|
+
}
|
|
29
|
+
export interface AddressOptions extends ResolveProfilesOptions {
|
|
30
|
+
}
|
|
31
|
+
export interface AddressEntry {
|
|
32
|
+
profile: string;
|
|
33
|
+
guid: string;
|
|
34
|
+
fullName: string;
|
|
35
|
+
email: string;
|
|
36
|
+
phone: string;
|
|
37
|
+
companyName: string;
|
|
38
|
+
streetAddress: string;
|
|
39
|
+
city: string;
|
|
40
|
+
state: string;
|
|
41
|
+
zipcode: string;
|
|
42
|
+
countryCode: string;
|
|
43
|
+
origin: string;
|
|
44
|
+
useCount: number;
|
|
45
|
+
dateModified: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves autofill entries from Chrome's Web Data database.
|
|
49
|
+
*
|
|
50
|
+
* @param options - Filtering and targeting options.
|
|
51
|
+
* @returns Array of autofill entries.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getAutofillEntries({ chromeDir, profilePath, profile, browser, onDiagnostic, search, limit, }?: AutofillOptions): AutofillEntry[];
|
|
54
|
+
/**
|
|
55
|
+
* Retrieves saved credit cards from Chrome's Web Data database.
|
|
56
|
+
* Card numbers are encrypted and will be decrypted.
|
|
57
|
+
*
|
|
58
|
+
* @param options - Targeting options.
|
|
59
|
+
* @returns Array of credit card entries.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getCreditCards({ chromeDir, profilePath, profile, browser, onDiagnostic, decryptionKey, }?: CreditCardOptions): CreditCardEntry[];
|
|
62
|
+
/**
|
|
63
|
+
* Retrieves saved addresses from Chrome's Web Data database.
|
|
64
|
+
*
|
|
65
|
+
* @param options - Targeting options.
|
|
66
|
+
* @returns Array of address entries.
|
|
67
|
+
*/
|
|
68
|
+
export declare function getAddresses(options?: AddressOptions): AddressEntry[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ResolveProfilesOptions } from "../chromium/profiles.js";
|
|
2
|
+
export interface BookmarkOptions extends ResolveProfilesOptions {
|
|
3
|
+
folder?: string;
|
|
4
|
+
search?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface BookmarkEntry {
|
|
7
|
+
profile?: string;
|
|
8
|
+
title: string;
|
|
9
|
+
url: string;
|
|
10
|
+
folder: string;
|
|
11
|
+
dateAdded: string;
|
|
12
|
+
dateLastUsed: string;
|
|
13
|
+
id?: string;
|
|
14
|
+
guid?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Reads and parses bookmarks from Chrome's Bookmarks JSON file.
|
|
18
|
+
*
|
|
19
|
+
* @param options - Options for filtering and targeting.
|
|
20
|
+
* @returns Filtered bookmark entries.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getBookmarks({ chromeDir, profilePath, profile, folder, search, browser, onDiagnostic, }?: BookmarkOptions): BookmarkEntry[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type ResolveProfilesOptions } from "../chromium/profiles.js";
|
|
2
|
+
export interface CookieOptions extends ResolveProfilesOptions {
|
|
3
|
+
domain?: string;
|
|
4
|
+
url?: string;
|
|
5
|
+
decrypt?: boolean;
|
|
6
|
+
limit?: number;
|
|
7
|
+
decryptionKey?: Buffer;
|
|
8
|
+
}
|
|
9
|
+
export interface CookieEntry {
|
|
10
|
+
profile: string;
|
|
11
|
+
domain: string;
|
|
12
|
+
name: string;
|
|
13
|
+
value: string;
|
|
14
|
+
path: string;
|
|
15
|
+
expires: string;
|
|
16
|
+
secure: boolean;
|
|
17
|
+
httpOnly: boolean;
|
|
18
|
+
sameSite: string;
|
|
19
|
+
created: string;
|
|
20
|
+
lastAccessed: string;
|
|
21
|
+
}
|
|
22
|
+
declare function parseURL(urlStr?: string): URL | null;
|
|
23
|
+
declare function getPossibleHostKeys(hostname: string): string[];
|
|
24
|
+
declare function domainMatch(hostname: string, hostKey: string): boolean;
|
|
25
|
+
declare function pathMatch(urlPath: string, cookiePath: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Extracts cookies from Chrome's Cookies database.
|
|
28
|
+
* Encrypted values are decrypted using the same mechanism as passwords.
|
|
29
|
+
*
|
|
30
|
+
* @param options - Targeting and filtering options.
|
|
31
|
+
* @returns Array of cookie entries.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getCookies({ chromeDir, profilePath, profile, browser, onDiagnostic, domain, url, decrypt, limit, decryptionKey, }?: CookieOptions): CookieEntry[];
|
|
34
|
+
export declare const _test: {
|
|
35
|
+
parseURL: typeof parseURL;
|
|
36
|
+
getPossibleHostKeys: typeof getPossibleHostKeys;
|
|
37
|
+
domainMatch: typeof domainMatch;
|
|
38
|
+
pathMatch: typeof pathMatch;
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ResolveProfilesOptions } from "../chromium/profiles.js";
|
|
2
|
+
export interface DownloadOptions extends ResolveProfilesOptions {
|
|
3
|
+
search?: string;
|
|
4
|
+
limit?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface DownloadEntry {
|
|
7
|
+
profile: string;
|
|
8
|
+
targetPath: string;
|
|
9
|
+
url: string;
|
|
10
|
+
siteUrl: string;
|
|
11
|
+
referrer: string;
|
|
12
|
+
totalBytes: number;
|
|
13
|
+
receivedBytes: number;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
state: string;
|
|
16
|
+
dangerType: string;
|
|
17
|
+
opened: boolean;
|
|
18
|
+
startTime: string;
|
|
19
|
+
endTime: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves download history from Chrome's History database.
|
|
23
|
+
*
|
|
24
|
+
* @param options - Targeting, filtering, and limit options.
|
|
25
|
+
* @returns Array of download entries.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getDownloads({ chromeDir, profilePath, profile, browser, onDiagnostic, search, limit, }?: DownloadOptions): DownloadEntry[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ResolveProfilesOptions } from "../chromium/profiles.js";
|
|
2
|
+
export interface ExtensionOptions extends ResolveProfilesOptions {
|
|
3
|
+
search?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ExtensionEntry {
|
|
6
|
+
profile: string;
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
version: string;
|
|
10
|
+
description: string;
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
homepageUrl: string;
|
|
13
|
+
updateUrl: string;
|
|
14
|
+
installTime: string;
|
|
15
|
+
fromWebstore: boolean;
|
|
16
|
+
location: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves installed Chrome extensions from the Preferences JSON file.
|
|
20
|
+
*
|
|
21
|
+
* @param options - Targeting and filtering options.
|
|
22
|
+
* @returns Array of extension entries.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getExtensions({ chromeDir, profilePath, profile, search, browser, onDiagnostic, }?: ExtensionOptions): ExtensionEntry[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ResolveProfilesOptions } from "../chromium/profiles.js";
|
|
2
|
+
export interface HistoryOptions extends ResolveProfilesOptions {
|
|
3
|
+
search?: string;
|
|
4
|
+
limit?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface HistoryEntry {
|
|
7
|
+
profile: string;
|
|
8
|
+
url: string;
|
|
9
|
+
title: string;
|
|
10
|
+
visitCount: number;
|
|
11
|
+
lastVisit: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SearchTermOptions extends ResolveProfilesOptions {
|
|
14
|
+
limit?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface SearchTermEntry {
|
|
17
|
+
profile: string;
|
|
18
|
+
term: string;
|
|
19
|
+
url: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves browsing history from Chrome's History database.
|
|
23
|
+
*
|
|
24
|
+
* @param options - Filtering and targeting options.
|
|
25
|
+
* @returns Array of history entries.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getHistory({ chromeDir, profilePath, profile, search, limit, browser, onDiagnostic, }?: HistoryOptions): HistoryEntry[];
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves search terms from Chrome's History database.
|
|
30
|
+
*
|
|
31
|
+
* @param options - Targeting and limit options.
|
|
32
|
+
* @returns Array of search term entries.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getSearchTerms({ chromeDir, profilePath, profile, limit, browser, onDiagnostic, }?: SearchTermOptions): SearchTermEntry[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ResolveProfilesOptions } from "../chromium/profiles.js";
|
|
2
|
+
export interface LocalStorageOptions extends ResolveProfilesOptions {
|
|
3
|
+
origin?: string;
|
|
4
|
+
url?: string;
|
|
5
|
+
key?: string;
|
|
6
|
+
search?: string;
|
|
7
|
+
limit?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface LocalStorageEntry {
|
|
10
|
+
profile: string;
|
|
11
|
+
origin: string;
|
|
12
|
+
key: string;
|
|
13
|
+
value: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Reads localStorage key/value pairs from Chromium's Local Storage store.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Targeting and filtering options.
|
|
19
|
+
* @returns Array of localStorage entries.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getLocalStorage({ chromeDir, profilePath, profile, browser, onDiagnostic, origin, url, key, search, limit, }?: LocalStorageOptions): LocalStorageEntry[];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type ResolveProfilesOptions } from "../chromium/profiles.js";
|
|
2
|
+
export interface PasswordOptions extends ResolveProfilesOptions {
|
|
3
|
+
search?: string;
|
|
4
|
+
decryptionKey?: Buffer;
|
|
5
|
+
}
|
|
6
|
+
/** Which on-disk store a password came from. */
|
|
7
|
+
export type PasswordSource = "device" | "account";
|
|
8
|
+
export interface PasswordEntry {
|
|
9
|
+
profile: string;
|
|
10
|
+
/** "device" = local "Login Data"; "account" = synced "Login Data For Account". */
|
|
11
|
+
source?: PasswordSource;
|
|
12
|
+
url?: string;
|
|
13
|
+
username?: string;
|
|
14
|
+
password?: string;
|
|
15
|
+
lastUsed?: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
/** What a single password store looked like when it was read. */
|
|
19
|
+
export interface PasswordStoreReport {
|
|
20
|
+
/** The User Data directory searched; "default" when the platform picked it. */
|
|
21
|
+
root: string;
|
|
22
|
+
profile: string;
|
|
23
|
+
/** "Login Data" (device) or "Login Data For Account" (synced). */
|
|
24
|
+
file: string;
|
|
25
|
+
source: PasswordSource;
|
|
26
|
+
exists: boolean;
|
|
27
|
+
/** Rows in `logins`, before any search filter. Null when the read failed. */
|
|
28
|
+
rows: number | null;
|
|
29
|
+
/** Why the read failed, when it did. No credential value is ever included. */
|
|
30
|
+
error?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Reports what a `getPasswords` call would read, and what it could not.
|
|
34
|
+
*
|
|
35
|
+
* `getPasswords` skips a store it cannot open — a missing file, a schema it does
|
|
36
|
+
* not know, a database another process is holding — and an empty result cannot
|
|
37
|
+
* tell "nothing saved here" from "could not look". This runs the same profile
|
|
38
|
+
* resolution and opens the same databases, and answers with row counts and
|
|
39
|
+
* errors only. It decrypts nothing, so no password value can escape through it.
|
|
40
|
+
*/
|
|
41
|
+
export declare function describePasswordStores({ chromeDir, profilePath, profile, browser, }?: PasswordOptions): PasswordStoreReport[];
|
|
42
|
+
/**
|
|
43
|
+
* Extracts and decrypts saved passwords from Chrome's password databases.
|
|
44
|
+
* Reads both the device-local and account-synced stores, labelling each entry
|
|
45
|
+
* with its `source` (no de-duplication across the two).
|
|
46
|
+
*
|
|
47
|
+
* @param options - Options for profile selection and filtering.
|
|
48
|
+
* @returns Array of decrypted password entries.
|
|
49
|
+
*/
|
|
50
|
+
export declare function getPasswords({ chromeDir, profilePath, profile, search, browser, decryptionKey, onDiagnostic, }?: PasswordOptions): PasswordEntry[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ResolveProfilesOptions } from "../chromium/profiles.js";
|
|
2
|
+
export interface SearchEngineOptions extends ResolveProfilesOptions {
|
|
3
|
+
}
|
|
4
|
+
export interface SearchEngineEntry {
|
|
5
|
+
profile: string;
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
keyword: string;
|
|
9
|
+
url: string;
|
|
10
|
+
suggestionsUrl: string;
|
|
11
|
+
faviconUrl: string;
|
|
12
|
+
isDefault: boolean;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves search engines configured in Chrome from the Web Data database.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Targeting options.
|
|
19
|
+
* @returns Array of search engine entries.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getSearchEngines({ chromeDir, profilePath, profile, browser, onDiagnostic, }?: SearchEngineOptions): SearchEngineEntry[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ResolveProfilesOptions } from "../chromium/profiles.js";
|
|
2
|
+
export interface TopSiteOptions extends ResolveProfilesOptions {
|
|
3
|
+
}
|
|
4
|
+
export interface TopSiteEntry {
|
|
5
|
+
profile: string;
|
|
6
|
+
url: string;
|
|
7
|
+
title: string;
|
|
8
|
+
rank: number;
|
|
9
|
+
redirects: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves top sites from Chrome's Top Sites database.
|
|
13
|
+
*
|
|
14
|
+
* @param options - Targeting options.
|
|
15
|
+
* @returns Array of top site entries.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getTopSites({ chromeDir, profilePath, profile, browser, onDiagnostic }?: TopSiteOptions): TopSiteEntry[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChromePlatform } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* macOS backend.
|
|
4
|
+
*
|
|
5
|
+
* Key source: the active browser's "<Browser> Safe Storage" password from the
|
|
6
|
+
* login Keychain (e.g. "Chrome Safe Storage", "Microsoft Edge Safe Storage"),
|
|
7
|
+
* stretched with PBKDF2 (1003 iterations) — implemented in `core/keychain.ts`.
|
|
8
|
+
* Cipher: AES-128-CBC with a fixed 16-space IV — implemented in `core/crypto.ts`.
|
|
9
|
+
* The browser only changes *which* Keychain item and data dir are used; the
|
|
10
|
+
* crypto is identical across all Chromium forks.
|
|
11
|
+
*/
|
|
12
|
+
export declare const darwin: ChromePlatform;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ProfileReadReporter } from "../storage/errors.js";
|
|
2
|
+
/**
|
|
3
|
+
* Platform selection + facades.
|
|
4
|
+
*
|
|
5
|
+
* This is the ONLY place that reads `process.platform`. Everything else in the
|
|
6
|
+
* codebase imports the facades below (`getPlatformChromeDir`, `deriveEncryptionKey`,
|
|
7
|
+
* `decryptValue`, `decryptValueBuffer`, `clearKeyCache`) and stays OS-agnostic.
|
|
8
|
+
*/
|
|
9
|
+
import type { ChromePlatform } from "./types.js";
|
|
10
|
+
import { type BrowserDescriptor } from "../chromium/browsers.js";
|
|
11
|
+
export type { ChromePlatform } from "./types.js";
|
|
12
|
+
export { BROWSERS, listBrowsers, resolveBrowser, requireBrowser, getActiveBrowser, setActiveBrowser, type BrowserId, type BrowserDescriptor, } from "../chromium/browsers.js";
|
|
13
|
+
export { KeychainAccessError, isKeychainAccessDenied, type KeychainErrorKind, } from "../core/keychain.js";
|
|
14
|
+
/**
|
|
15
|
+
* Returns the backend for the current OS, cached after first call.
|
|
16
|
+
* @throws On an unsupported platform.
|
|
17
|
+
*/
|
|
18
|
+
export declare function selectPlatform(): ChromePlatform;
|
|
19
|
+
/** Default Chrome User Data directory for the current OS. */
|
|
20
|
+
export declare function getPlatformChromeDir(browser?: string | BrowserDescriptor): string;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the symmetric key for decrypting this profile's secrets.
|
|
23
|
+
* @param chromeDir - Needed on Windows, where the key lives in `Local State`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function deriveEncryptionKey(chromeDir?: string, browser?: string | BrowserDescriptor): Buffer;
|
|
26
|
+
/** Decrypts a Chrome blob and returns the plaintext bytes (or a placeholder string). */
|
|
27
|
+
export declare function decryptValueBuffer(blob: Buffer | Uint8Array | null | undefined, key: Buffer): Buffer | string;
|
|
28
|
+
/** Decrypts a Chrome blob and returns the plaintext as a UTF-8 string. */
|
|
29
|
+
export declare function decryptValue(blob: Buffer | Uint8Array | null | undefined, key: Buffer): string;
|
|
30
|
+
/** Clears the active backend's cached key material. */
|
|
31
|
+
export declare function clearKeyCache(): void;
|
|
32
|
+
/** Resolve keys lazily for a single store and its explicit browser profile. */
|
|
33
|
+
export declare function createProfileDecryptor(chromeDir: string, browser: string | undefined, overrideKey: Buffer | undefined, report: ProfileReadReporter | undefined, profile: string, store: string): (blob: Buffer) => Buffer | string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChromePlatform } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Linux backend.
|
|
4
|
+
*
|
|
5
|
+
* Key source: the active browser's "Safe Storage" password from the Secret
|
|
6
|
+
* Service (gnome-keyring / KWallet) via `secret-tool`, or the hardcoded
|
|
7
|
+
* "peanuts" fallback, stretched with PBKDF2 (1 iteration).
|
|
8
|
+
* Cipher: AES-128-CBC with a fixed 16-space IV (same primitive as macOS).
|
|
9
|
+
*/
|
|
10
|
+
export declare const linux: ChromePlatform;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { BrowserDescriptor } from "../chromium/browsers.js";
|
|
2
|
+
export interface DecryptionContext {
|
|
3
|
+
chromeDir: string;
|
|
4
|
+
browser: BrowserDescriptor;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The platform-specific backend contract.
|
|
8
|
+
*
|
|
9
|
+
* Everything that differs between operating systems is bundled here because the
|
|
10
|
+
* three concerns are coupled — a Windows key only works with the Windows cipher,
|
|
11
|
+
* etc. Each backend (darwin/win32/linux) implements this once; the rest of the
|
|
12
|
+
* codebase stays platform-agnostic and talks to the selected backend through the
|
|
13
|
+
* facades in `./index.ts`.
|
|
14
|
+
*/
|
|
15
|
+
export interface ChromePlatform {
|
|
16
|
+
/** Node platform identifier this backend handles (e.g. "darwin", "win32", "linux"). */
|
|
17
|
+
readonly name: string;
|
|
18
|
+
/** Absolute path to Chrome's User Data directory for this OS. */
|
|
19
|
+
getDefaultChromeDir(browser?: BrowserDescriptor): string;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the symmetric key used to decrypt this profile's secrets, ready to
|
|
22
|
+
* hand to {@link decrypt}. May read the OS key store and is cached internally.
|
|
23
|
+
*
|
|
24
|
+
* @param chromeDir - User Data dir, needed on platforms (Windows) where the
|
|
25
|
+
* key lives inside `Local State`. Defaults to {@link getDefaultChromeDir}.
|
|
26
|
+
* @throws An actionable Error if the key cannot be obtained.
|
|
27
|
+
*/
|
|
28
|
+
getDecryptionKey(chromeDir?: string, browser?: BrowserDescriptor): Buffer;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the App-Bound Encryption key for Chrome 127+ on Windows.
|
|
31
|
+
* Only the win32 backend implements this; others return `undefined`.
|
|
32
|
+
*
|
|
33
|
+
* @param chromeDir - User Data dir containing the `Local State` file.
|
|
34
|
+
* @param browser - Browser to target (needed to select the COM CLSID).
|
|
35
|
+
* @returns The decrypted 32-byte AES key, or `undefined` if ABE is
|
|
36
|
+
* unavailable or unsupported on this platform.
|
|
37
|
+
*/
|
|
38
|
+
getAppBoundKey?(chromeDir?: string, browser?: BrowserDescriptor): Buffer | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Decrypts a single Chrome `v10`/`v11`/`v20` blob using this platform's
|
|
41
|
+
* scheme (AES-128-CBC on macOS/Linux, AES-256-GCM on Windows).
|
|
42
|
+
*
|
|
43
|
+
* @returns The plaintext bytes, or a `<...>` placeholder string on a
|
|
44
|
+
* recognized but undecryptable blob (never throws).
|
|
45
|
+
*/
|
|
46
|
+
decrypt(blob: Buffer, key: Buffer): Buffer | string;
|
|
47
|
+
/** Clears any cached key material. Useful for tests / re-authentication. */
|
|
48
|
+
clearCache(): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChromePlatform } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Windows backend.
|
|
4
|
+
*
|
|
5
|
+
* Key source: `os_crypt.encrypted_key` in Local State — base64, "DPAPI"-prefixed,
|
|
6
|
+
* unprotected via DPAPI into a raw 32-byte AES-256 key (no PBKDF2 on Windows).
|
|
7
|
+
* Cipher: AES-256-GCM (nonce + tag carried in each blob).
|
|
8
|
+
*
|
|
9
|
+
* Chrome 127+ adds `os_crypt.app_bound_encrypted_key` — base64, "APPB"-prefixed.
|
|
10
|
+
* It is passed directly to Chrome's IElevator COM service via the native helper
|
|
11
|
+
* to obtain the 32-byte AES-256 key for "v20" blobs.
|
|
12
|
+
*/
|
|
13
|
+
export declare const win32: ChromePlatform;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type StoreReadIssue = "missing_store" | "unsupported_schema" | "snapshot_unavailable" | "decryption_unavailable" | "unreadable";
|
|
2
|
+
export interface ProfileReadDiagnostic {
|
|
3
|
+
profile: string;
|
|
4
|
+
store: string;
|
|
5
|
+
code: StoreReadIssue;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export type ProfileReadReporter = (diagnostic: ProfileReadDiagnostic) => void;
|
|
9
|
+
export declare class StoreReadError extends Error {
|
|
10
|
+
readonly code: StoreReadIssue;
|
|
11
|
+
constructor(code: StoreReadIssue, message: string, options?: ErrorOptions);
|
|
12
|
+
}
|
|
13
|
+
export declare function reportStoreIssue(report: ProfileReadReporter | undefined, profile: string, store: string, error: unknown): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type BigIntStats } from "node:fs";
|
|
2
|
+
export declare function getFileStamp(path: string): BigIntStats | undefined;
|
|
3
|
+
export declare function sameFile(before?: BigIntStats, after?: BigIntStats): boolean;
|
|
4
|
+
/** Guard against a temporary directory configured inside the source profile. */
|
|
5
|
+
export declare function createSnapshotDirectory(profilePath: string, prefix: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type SnapshotQuery = (sql: string, params?: unknown[]) => any[];
|
|
2
|
+
/** SQLite opens only the private copy, including for journal recovery. */
|
|
3
|
+
export declare function withDatabaseSnapshot<T>(path: string, read: (query: SnapshotQuery) => T): T;
|
|
4
|
+
export declare function queryDatabase(dbFilePath: string, sql: string, params?: unknown[]): any[];
|
|
5
|
+
export declare function tableExists(dbFilePath: string, tableName: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-tools",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "CLI & Node.js library for chrome",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -58,11 +58,13 @@
|
|
|
58
58
|
"dist"
|
|
59
59
|
],
|
|
60
60
|
"scripts": {
|
|
61
|
-
"build": "node scripts/clean.mjs && tsup && tsc -p tsconfig.types.json &&
|
|
61
|
+
"build": "node scripts/clean.mjs && tsup && tsc -p tsconfig.types.json && node scripts/finalize.mjs && node scripts/verify-dist.mjs",
|
|
62
62
|
"typecheck": "tsc --noEmit",
|
|
63
63
|
"lint": "oxlint --deny-warnings .",
|
|
64
64
|
"start": "node dist/cli.js",
|
|
65
|
-
"test": "npm run build && npm run typecheck && node
|
|
65
|
+
"test": "npm run build && npm run typecheck && node scripts/test-unit.mjs && node dist/cli.js --help",
|
|
66
|
+
"test:chrome": "node test/compatibility/chrome.mjs",
|
|
67
|
+
"test:package": "node test/compatibility/package.mjs",
|
|
66
68
|
"release": "node scripts/release.mjs"
|
|
67
69
|
},
|
|
68
70
|
"keywords": [
|
|
@@ -87,16 +89,13 @@
|
|
|
87
89
|
"node": ">=22.16.0"
|
|
88
90
|
},
|
|
89
91
|
"devDependencies": {
|
|
90
|
-
"@types/node": "^26.
|
|
91
|
-
"
|
|
92
|
-
"chalk": "^6.0.0",
|
|
92
|
+
"@types/node": "^26.6.6",
|
|
93
|
+
"chalk": "^6.0.1",
|
|
93
94
|
"cli-table3": "^0.6.5",
|
|
94
|
-
"commander": "^15.
|
|
95
|
+
"commander": "^15.1.0",
|
|
95
96
|
"oxlint": "1.77.0",
|
|
96
|
-
"rollup": "^4.63.0",
|
|
97
|
-
"rollup-plugin-dts": "^6.5.1",
|
|
98
97
|
"tsup": "^8.5.1",
|
|
99
|
-
"tsx": "^4.23.
|
|
98
|
+
"tsx": "^4.23.15",
|
|
100
99
|
"typescript": "^7.0.2"
|
|
101
100
|
}
|
|
102
101
|
}
|