Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async getAuthInfoObjects() {
const authFilesArray = await AuthInfo.listAllAuthFiles().catch(err => null);
if (authFilesArray === null || authFilesArray.length === 0) {
return null;
}
const authInfoObjects: FileInfo[] = [];
for (const username of authFilesArray) {
try {
const filePath = path.join(
await AuthInfoConfig.resolveRootFolder(true),
'.sfdx',
username
);
const fileData = readFileSync(filePath, 'utf8');
authInfoObjects.push(JSON.parse(fileData));
} catch (e) {
console.log(e);
}
}
return authInfoObjects;
}