MCPcopy
hub / github.com/garrytan/gstack / getDerivedKeys

Function getDerivedKeys

browse/src/cookie-import-browser.ts:457–481  ·  view source on GitHub ↗
(match: BrowserMatch)

Source from the content-addressed store, hash-verified

455}
456
457async function getDerivedKeys(match: BrowserMatch): Promise<Map<string, Buffer>> {
458 if (match.platform === 'darwin') {
459 const password = await getMacKeychainPassword(match.browser.keychainService);
460 return new Map([
461 ['v10', getCachedDerivedKey(`darwin:${match.browser.keychainService}:v10`, password, 1003)],
462 ]);
463 }
464
465 if (match.platform === 'win32') {
466 const key = await getWindowsAesKey(match.browser);
467 return new Map([['v10', key]]);
468 }
469
470 const keys = new Map<string, Buffer>();
471 keys.set('v10', getCachedDerivedKey('linux:v10', 'peanuts', 1));
472
473 const linuxPassword = await getLinuxSecretPassword(match.browser);
474 if (linuxPassword) {
475 keys.set(
476 'v11',
477 getCachedDerivedKey(`linux:${match.browser.keychainService}:v11`, linuxPassword, 1),
478 );
479 }
480 return keys;
481}
482
483async function getWindowsAesKey(browser: BrowserInfo): Promise<Buffer> {
484 const cacheKey = `win32:${browser.keychainService}`;

Callers 1

importCookiesFunction · 0.85

Calls 5

getMacKeychainPasswordFunction · 0.85
getCachedDerivedKeyFunction · 0.85
getWindowsAesKeyFunction · 0.85
getLinuxSecretPasswordFunction · 0.85
setMethod · 0.80

Tested by

no test coverage detected