@dotrino/identity 0.136.2 → 0.136.3

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.
@@ -2943,6 +2943,16 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
2943
2943
  })
2944
2944
  }
2945
2945
  function scheduleDeviceNotice (pub) { schedule('dev:' + pub, () => notifyDeviceChange(pub)) }
2946
+ /**
2947
+ * El aviso del cajón que se tocó: el de un namespace o el de un aparato. `varsDesk` escribe en
2948
+ * los dos, y avisaba siempre al namespace —con `ns` null cuando el cajón era de un aparato—,
2949
+ * así que el aparato no se enteraba de que su configuración había cambiado.
2950
+ */
2951
+ function noticeFor (ns, pub) {
2952
+ if (ns) return scheduleNotice(ns)
2953
+ if (!pub) throw new Error('vars: a drawer needs its ns or its device pub')
2954
+ scheduleDeviceNotice(pub)
2955
+ }
2946
2956
 
2947
2957
  function schedule (key, fn) {
2948
2958
  clearTimeout(pendingNotices.get(key))
@@ -3450,7 +3460,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
3450
3460
  await checkAuthor(owner, key, sealed, caller, { allowOverwrite: ask })
3451
3461
  await checkRecipients(owner, sealed.wraps, !!isPublic)
3452
3462
  await secrets.putSealed(owner, key, sealed, { by: who, public: isPublic })
3453
- audit('secret.set', { ns: ns || null, key, sealed: true }); scheduleNotice(ns)
3463
+ audit('secret.set', { ns: ns || null, key, sealed: true }); noticeFor(ns, pub)
3454
3464
  await settleDebts(owner)
3455
3465
  }
3456
3466
  // Comprobado ANTES de dejarlo en espera: un sobre malo falla al guardarlo, no cinco
@@ -3522,7 +3532,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
3522
3532
  await secrets.putSealed(owner, it.key, it.sealed, { by: who, public: !!it.public })
3523
3533
  keys.push(it.key)
3524
3534
  }
3525
- audit('secret.setMany', { ns: ns || null, keys }); scheduleNotice(ns)
3535
+ audit('secret.setMany', { ns: ns || null, keys }); noticeFor(ns, pub)
3526
3536
  await settleDebts(owner)
3527
3537
  }
3528
3538
  const pending = await holdWrite({ caller, ns, pub, keys: items.map((it) => it.key), apply, ask })
@@ -5128,7 +5138,8 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
5128
5138
  // La bóveda de contraseñas (`passwords.js`). Aquí SÍ se lista: es donde está la
5129
5139
  // llave. Lo que no puede es listarla un aparato.
5130
5140
  passwordDevices,
5131
- passwordsVault: () => passwords?.vault || null,
5141
+ // (Aquí estaba `passwordsVault`, que siempre daba null: el mostrador sellado ya no tiene
5142
+ // `vault` —no hay llave que guardar— y nadie lo llamaba. Quitado, no arreglado.)
5132
5143
  // La política de las contraseñas, para quien atiende su propio almacén (la extensión).
5133
5144
  passwordsNeedApproval,
5134
5145
  approvePasswordRequest,
@@ -501,10 +501,12 @@ export function createLoginDesk ({ load, save, now = () => Date.now(), opaque =
501
501
  export async function createPasswordLogin ({ user, password, label, caps, begin, finish, opaque = opaqueClientePorDefecto } = {}) {
502
502
  if (!isValidUser(user)) throw Object.assign(new Error('invalid user name'), { code: 'bad-user' })
503
503
  if (typeof password !== 'string' || !password) throw Object.assign(new Error('a password is required'), { code: 'no-password' })
504
- const start = opaque.registrationStart({ password })
504
+ // `opaque` se inyecta, y el resto de este archivo ya lo espera con `await`: una
505
+ // implementación asíncrona devolvía aquí una promesa y `start.request` salía `undefined`.
506
+ const start = await opaque.registrationStart({ password })
505
507
  const begun = await begin({ user, request: start.request })
506
508
  // La bóveda contesta con su mitad; el registro se termina AQUÍ, con la contraseña.
507
- const fin = opaque.registrationFinish({ state: start.state, response: begun.response, password })
509
+ const fin = await opaque.registrationFinish({ state: start.state, response: begun.response, password })
508
510
  const device = await makeDeviceKey({ label })
509
511
  const enc = await makeDeviceEncKey()
510
512
  const blob = await sealDeviceKeys(fin.exportKey, { sign: device.privateJwk, enc: enc.encPrivateJwk })