@@ -263,11 +263,25 @@ async function extractTeamsFromSlackLevelDb(leveldbDir: string): Promise<Desktop
263263
264264function getSafeStoragePasswords ( prefix : string ) : string [ ] {
265265 if ( IS_MACOS ) {
266- const services = [ "Slack Safe Storage" , "Chrome Safe Storage" , "Chromium Safe Storage" ] ;
266+ // Electron ("Slack Key") and Mac App Store ("Slack App Store Key") builds
267+ // store separate Safe Storage passwords under the same service name.
268+ // Query each known account explicitly, then fall back to service-only
269+ // lookups to catch unknown account names.
270+ const keychainQueries : { service : string ; account ?: string } [ ] = [
271+ { service : "Slack Safe Storage" , account : "Slack Key" } ,
272+ { service : "Slack Safe Storage" , account : "Slack App Store Key" } ,
273+ { service : "Slack Safe Storage" } ,
274+ { service : "Chrome Safe Storage" } ,
275+ { service : "Chromium Safe Storage" } ,
276+ ] ;
267277 const passwords : string [ ] = [ ] ;
268- for ( const service of services ) {
278+ for ( const q of keychainQueries ) {
269279 try {
270- const out = execFileSync ( "security" , [ "find-generic-password" , "-w" , "-s" , service ] , {
280+ const args = [ "-w" , "-s" , q . service ] ;
281+ if ( q . account ) {
282+ args . push ( "-a" , q . account ) ;
283+ }
284+ const out = execFileSync ( "security" , [ "find-generic-password" , ...args ] , {
271285 encoding : "utf8" ,
272286 stdio : [ "ignore" , "pipe" , "ignore" ] ,
273287 } ) . trim ( ) ;
@@ -279,7 +293,7 @@ function getSafeStoragePasswords(prefix: string): string[] {
279293 }
280294 }
281295 if ( passwords . length > 0 ) {
282- return passwords ;
296+ return [ ... new Set ( passwords ) ] ;
283297 }
284298 }
285299
0 commit comments