voidlogue-crypto 2.0.4 → 2.0.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/vault.ts +11 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "voidlogue-crypto",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Open-source client-side cryptographic primitives for Voidlogue — published for independent audit and verification of privacy claims.",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/vault.ts CHANGED
@@ -259,18 +259,18 @@ export const Vault = {
259
259
  roomHash: string,
260
260
  email: string,
261
261
  codename: string,
262
- newPin: string
262
+ newPin: string,
263
+ existingHintEntry?: LabelEntry
263
264
  ): Promise<boolean> {
264
- const entry = this._getEncryptedHint(roomHash);
265
- // entry is always an object ({encrypted:'', iv:'', …}) for unlabelled convos,
266
- // so we must check entry?.encrypted (non-empty string) not just entry.
267
- return this.save(
268
- roomHash,
269
- email,
270
- codename,
271
- newPin,
272
- entry?.encrypted ? '(restored)' : ''
273
- );
265
+ // Save as ghost (no hint) — avoids re-encrypting the label under the new
266
+ // PIN key, which would create a new index entry and make ghosts visible.
267
+ const ok = await this.save(roomHash, email, codename, newPin, '');
268
+ // If the caller supplies the original encrypted label entry, restore it
269
+ // verbatim — no re-encryption needed since labels are keyed independently.
270
+ if (ok && existingHintEntry?.encrypted) {
271
+ await this._updateIndex(roomHash, existingHintEntry);
272
+ }
273
+ return ok;
274
274
  },
275
275
 
276
276
  async updateLabel(