@sharedenv/cli 1.1.0 → 1.1.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/bin/sharedenv.js CHANGED
@@ -164,7 +164,16 @@ async function cmdLogin({ values }) {
164
164
  const client = createClient({ baseUrl, cookies, userAgent: USER_AGENT });
165
165
  const otp = async () => process.env.SHAREDENV_OTP || (await ask('Two-factor code: '));
166
166
  await login(client, { identifier, password, otp });
167
- const account = await unlockAccount(client, password); // the vault opens: only then is anything kept
167
+ // The vault opens: only then is anything kept. The server just accepted this password,
168
+ // so a vault it does not open was sealed under the one before a reset.
169
+ const account = await unlockAccount(client, password).catch((err) => {
170
+ if (err.code !== 'VAULT_SEALED') throw err;
171
+ throw new Error(
172
+ 'your password was reset, and the vault is still sealed under the old one. Sign in ' +
173
+ 'once on the web app and enter your recovery code: the vault then opens with the new ' +
174
+ 'password, here too'
175
+ );
176
+ });
168
177
  store.writeSession({ baseUrl, cookies: client.cookies() });
169
178
  note(`Signed in to ${baseUrl}.`);
170
179
  await watchOwnKey(client, account);
package/lib/auth.js CHANGED
@@ -64,7 +64,12 @@ export async function unlockAccount(client, password) {
64
64
  try {
65
65
  privateKey = unwrapPrivateKey(keyring.encPrivateKey, password, keyring.kdf);
66
66
  } catch {
67
- throw new Error('wrong password — could not unlock the vault');
67
+ const err = new Error(
68
+ 'this password does not unlock the vault. If you reset it, the vault is still sealed ' +
69
+ 'under the old one: sign in once on the web app and enter your recovery code there'
70
+ );
71
+ err.code = 'VAULT_SEALED';
72
+ throw err;
68
73
  }
69
74
  // The directory must name the key we hold: a row naming another public key would let
70
75
  // the server choose who receives what is sealed to "us".
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharedenv/cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "description": "sharedenv CLI — pull and run with your zero-knowledge secrets, decrypted locally.",
6
6
  "license": "Apache-2.0",