@dishantlangayan/sc-cli-core 0.5.2 → 0.5.3
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/lib/auth/org-manager.js +13 -0
- package/package.json +1 -1
package/lib/auth/org-manager.js
CHANGED
|
@@ -299,6 +299,19 @@ export class OrgManager {
|
|
|
299
299
|
if (!this.masterKey || !this.machineId) {
|
|
300
300
|
throw new OrgError('Org manager not initialized', OrgErrorCode.NOT_INITIALIZED);
|
|
301
301
|
}
|
|
302
|
+
// If storage is empty, delete the file instead of saving
|
|
303
|
+
if (this.storage.orgs.length === 0) {
|
|
304
|
+
try {
|
|
305
|
+
await unlink(this.configFile);
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
// Ignore if file doesn't exist (ENOENT)
|
|
309
|
+
if (error.code !== 'ENOENT') {
|
|
310
|
+
throw error;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
302
315
|
// Ensure directory exists
|
|
303
316
|
await mkdir(this.configDir, { mode: 0o700, recursive: true });
|
|
304
317
|
// Generate new salt and derive key for THIS save
|