@hasna/contacts 0.6.0 → 0.6.1
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/cli/index.js +17 -12
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -8892,7 +8892,7 @@ function promptPassphrase(promptText) {
|
|
|
8892
8892
|
});
|
|
8893
8893
|
});
|
|
8894
8894
|
}
|
|
8895
|
-
vaultCmd.command("init").description("Initialize the encrypted vault").action(async () => {
|
|
8895
|
+
vaultCmd.command("init").description("Initialize the encrypted vault").option("--passphrase <pass>", "Passphrase (non-interactive)").action(async (opts) => {
|
|
8896
8896
|
const { initVault: initVault2, isVaultInitialized: isVaultInitialized2 } = await Promise.resolve().then(() => (init_vault(), exports_vault));
|
|
8897
8897
|
if (isVaultInitialized2()) {
|
|
8898
8898
|
console.log(chalk.yellow(`
|
|
@@ -8900,24 +8900,29 @@ Vault already initialized. Use "contacts vault unlock" to access it.
|
|
|
8900
8900
|
`));
|
|
8901
8901
|
return;
|
|
8902
8902
|
}
|
|
8903
|
-
|
|
8904
|
-
if (
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8903
|
+
let passphrase;
|
|
8904
|
+
if (opts.passphrase) {
|
|
8905
|
+
passphrase = opts.passphrase;
|
|
8906
|
+
} else {
|
|
8907
|
+
passphrase = await promptPassphrase("Enter vault passphrase: ");
|
|
8908
|
+
if (!passphrase) {
|
|
8909
|
+
console.error(chalk.red("Passphrase is required."));
|
|
8910
|
+
process.exit(1);
|
|
8911
|
+
}
|
|
8912
|
+
const confirm2 = await promptPassphrase("Confirm passphrase: ");
|
|
8913
|
+
if (passphrase !== confirm2) {
|
|
8914
|
+
console.error(chalk.red("Passphrases do not match."));
|
|
8915
|
+
process.exit(1);
|
|
8916
|
+
}
|
|
8912
8917
|
}
|
|
8913
8918
|
initVault2(passphrase);
|
|
8914
8919
|
console.log(chalk.green(`
|
|
8915
8920
|
Vault initialized and unlocked.
|
|
8916
8921
|
`));
|
|
8917
8922
|
});
|
|
8918
|
-
vaultCmd.command("unlock").description("Unlock the vault").action(async () => {
|
|
8923
|
+
vaultCmd.command("unlock").description("Unlock the vault").option("--passphrase <pass>", "Passphrase (non-interactive)").action(async (opts) => {
|
|
8919
8924
|
const { unlockVault: unlockVault2 } = await Promise.resolve().then(() => (init_vault(), exports_vault));
|
|
8920
|
-
const passphrase = await promptPassphrase("Enter vault passphrase: ");
|
|
8925
|
+
const passphrase = opts.passphrase || await promptPassphrase("Enter vault passphrase: ");
|
|
8921
8926
|
const ok = unlockVault2(passphrase);
|
|
8922
8927
|
if (!ok) {
|
|
8923
8928
|
console.error(chalk.red(`
|