ccsini 0.1.28 → 0.1.30
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/dist/index.js +34 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27996,7 +27996,7 @@ var {
|
|
|
27996
27996
|
} = import__.default;
|
|
27997
27997
|
|
|
27998
27998
|
// src/version.ts
|
|
27999
|
-
var VERSION = "0.1.
|
|
27999
|
+
var VERSION = "0.1.30";
|
|
28000
28000
|
|
|
28001
28001
|
// src/commands/init.ts
|
|
28002
28002
|
init_source();
|
|
@@ -29430,7 +29430,33 @@ function registerInitCommand(program2) {
|
|
|
29430
29430
|
spinner.fail(e.message);
|
|
29431
29431
|
process.exit(1);
|
|
29432
29432
|
}
|
|
29433
|
-
|
|
29433
|
+
let isMultiDevice = !!existingSalt;
|
|
29434
|
+
if (isMultiDevice) {
|
|
29435
|
+
const { freshStart } = await dist_default12.prompt([
|
|
29436
|
+
{
|
|
29437
|
+
type: "confirm",
|
|
29438
|
+
name: "freshStart",
|
|
29439
|
+
message: "Existing encryption data found. Start fresh with a new password?",
|
|
29440
|
+
default: false
|
|
29441
|
+
}
|
|
29442
|
+
]);
|
|
29443
|
+
if (freshStart) {
|
|
29444
|
+
const wipeSpinner = ora("Wiping previous account data...").start();
|
|
29445
|
+
try {
|
|
29446
|
+
const { importPrivateKey: importPrivateKey2, createDeviceJWT: createDeviceJWT2 } = await Promise.resolve().then(() => (init_auth(), exports_auth));
|
|
29447
|
+
const privateKey = await importPrivateKey2(privateKeyB64);
|
|
29448
|
+
const jwt = await createDeviceJWT2(privateKey, deviceId);
|
|
29449
|
+
const authedClient = new CcsiniClient("https://ccsini-api.anis-maisara190.workers.dev", jwt);
|
|
29450
|
+
await authedClient.resetAll();
|
|
29451
|
+
wipeSpinner.succeed("Previous account data wiped");
|
|
29452
|
+
} catch (e) {
|
|
29453
|
+
wipeSpinner.fail(`Could not wipe server data: ${e.message}`);
|
|
29454
|
+
process.exit(1);
|
|
29455
|
+
}
|
|
29456
|
+
existingSalt = null;
|
|
29457
|
+
isMultiDevice = false;
|
|
29458
|
+
}
|
|
29459
|
+
}
|
|
29434
29460
|
let masterKey;
|
|
29435
29461
|
let salt;
|
|
29436
29462
|
if (isMultiDevice) {
|
|
@@ -30075,8 +30101,12 @@ function registerResetCommand(program2) {
|
|
|
30075
30101
|
const jwt = await createDeviceJWT(privateKey, config.deviceId);
|
|
30076
30102
|
const client = new CcsiniClient(config.apiUrl, jwt);
|
|
30077
30103
|
const spinner = ora2("Wiping server data...").start();
|
|
30078
|
-
|
|
30079
|
-
|
|
30104
|
+
try {
|
|
30105
|
+
const { blobsDeleted } = await client.resetAll();
|
|
30106
|
+
spinner.succeed(`Server data wiped (${blobsDeleted} blob${blobsDeleted !== 1 ? "s" : ""} deleted)`);
|
|
30107
|
+
} catch {
|
|
30108
|
+
spinner.warn("Could not wipe server data (device may have been removed from dashboard)");
|
|
30109
|
+
}
|
|
30080
30110
|
const localSpinner = ora2("Removing local config...").start();
|
|
30081
30111
|
await rm(configDir, { recursive: true, force: true });
|
|
30082
30112
|
localSpinner.succeed("Local config removed");
|