ccsini 0.1.29 → 0.1.31
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 -2
- 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.31";
|
|
28000
28000
|
|
|
28001
28001
|
// src/commands/init.ts
|
|
28002
28002
|
init_source();
|
|
@@ -29001,6 +29001,15 @@ class CcsiniClient {
|
|
|
29001
29001
|
throw new Error("Failed to delete blobs");
|
|
29002
29002
|
return res.json();
|
|
29003
29003
|
}
|
|
29004
|
+
async wipeAccount(deviceId, publicKey) {
|
|
29005
|
+
const res = await fetch(`${this.apiUrl}/api/devices/wipe-account`, {
|
|
29006
|
+
method: "POST",
|
|
29007
|
+
headers: { "Content-Type": "application/json" },
|
|
29008
|
+
body: JSON.stringify({ deviceId, publicKey })
|
|
29009
|
+
});
|
|
29010
|
+
if (!res.ok)
|
|
29011
|
+
throw new Error("Failed to wipe account data");
|
|
29012
|
+
}
|
|
29004
29013
|
async resetAll() {
|
|
29005
29014
|
const res = await fetch(`${this.apiUrl}/api/sync/reset`, {
|
|
29006
29015
|
method: "DELETE",
|
|
@@ -29430,7 +29439,30 @@ function registerInitCommand(program2) {
|
|
|
29430
29439
|
spinner.fail(e.message);
|
|
29431
29440
|
process.exit(1);
|
|
29432
29441
|
}
|
|
29433
|
-
|
|
29442
|
+
let isMultiDevice = !!existingSalt;
|
|
29443
|
+
if (isMultiDevice) {
|
|
29444
|
+
const { freshStart } = await dist_default12.prompt([
|
|
29445
|
+
{
|
|
29446
|
+
type: "confirm",
|
|
29447
|
+
name: "freshStart",
|
|
29448
|
+
message: "Existing encryption data found. Start fresh with a new password?",
|
|
29449
|
+
default: false
|
|
29450
|
+
}
|
|
29451
|
+
]);
|
|
29452
|
+
if (freshStart) {
|
|
29453
|
+
const wipeSpinner = ora("Wiping previous account data...").start();
|
|
29454
|
+
try {
|
|
29455
|
+
const client = new CcsiniClient("https://ccsini-api.anis-maisara190.workers.dev", "");
|
|
29456
|
+
await client.wipeAccount(deviceId, publicKeyB64);
|
|
29457
|
+
wipeSpinner.succeed("Previous account data wiped");
|
|
29458
|
+
} catch (e) {
|
|
29459
|
+
wipeSpinner.fail(`Could not wipe server data: ${e.message}`);
|
|
29460
|
+
process.exit(1);
|
|
29461
|
+
}
|
|
29462
|
+
existingSalt = null;
|
|
29463
|
+
isMultiDevice = false;
|
|
29464
|
+
}
|
|
29465
|
+
}
|
|
29434
29466
|
let masterKey;
|
|
29435
29467
|
let salt;
|
|
29436
29468
|
if (isMultiDevice) {
|