@dotrino/identity 0.48.0 → 0.48.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/package.json +1 -1
- package/src/node.js +5 -1
- package/vault/core.js +7 -2
package/package.json
CHANGED
package/src/node.js
CHANGED
|
@@ -122,7 +122,11 @@ export class Identity {
|
|
|
122
122
|
this._core = await createIdentityCore({
|
|
123
123
|
kv: fileKv(path.join(this._dir, 'identity.json'), this._atRest),
|
|
124
124
|
peers: filePeers(path.join(this._dir, 'peers.json')),
|
|
125
|
-
makeSync: null
|
|
125
|
+
makeSync: null,
|
|
126
|
+
// Aquí las cuentas las lleva quien hospeda (el daemon del vault tiene su propio
|
|
127
|
+
// registro de perfiles): que una expulsión borre una por debajo le dejaría el suyo
|
|
128
|
+
// apuntando a algo que ya no existe. Se borra el enlace y el acta, nada más.
|
|
129
|
+
removeAccountOnExpulsion: false
|
|
126
130
|
})
|
|
127
131
|
this._core.onSyncStatus((payload) => this._emit('sync', payload))
|
|
128
132
|
this._core.onVaultEvent((payload) => this._emit('vault', payload))
|
package/vault/core.js
CHANGED
|
@@ -158,7 +158,7 @@ function sanitizeProfilePatch (patch = {}) {
|
|
|
158
158
|
return out
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
export async function createIdentityCore ({ kv: rawKv, peers, makeSync = null, keyStore = null, sessionKv = null }) {
|
|
161
|
+
export async function createIdentityCore ({ kv: rawKv, peers, makeSync = null, keyStore = null, sessionKv = null, removeAccountOnExpulsion = true }) {
|
|
162
162
|
const {
|
|
163
163
|
initPeerStorage, loadPeers, savePeers, setPeersDirect, upsertPeer, onDirty
|
|
164
164
|
} = peers
|
|
@@ -362,6 +362,11 @@ export async function createIdentityCore ({ kv: rawKv, peers, makeSync = null, k
|
|
|
362
362
|
* tenía fijado, así que da igual lo que hagamos después con el perfil activo);
|
|
363
363
|
* 3. se borra la cuenta y se deja otra puesta;
|
|
364
364
|
* 4. 'account-removed' → la app RECARGA (multi-perfil no es reactivo, por diseño).
|
|
365
|
+
*
|
|
366
|
+
* El paso 3 es SOLO del navegador (`removeAccountOnExpulsion`). En Node las cuentas las
|
|
367
|
+
* lleva quien hospeda —el daemon del vault tiene su propio registro de perfiles, en
|
|
368
|
+
* `profiles.js`— y borrar una por debajo le dejaría el suyo apuntando a algo que ya no
|
|
369
|
+
* existe. Ahí se borra el enlace y el acta, y de la cuenta decide su dueño.
|
|
365
370
|
*/
|
|
366
371
|
const wipeVaultLink = () => {
|
|
367
372
|
try { kv.removeItem(VAULT_CERT_STORAGE); kv.removeItem(VAULT_DEVICE_STORAGE) } catch (_) {}
|
|
@@ -369,7 +374,7 @@ export async function createIdentityCore ({ kv: rawKv, peers, makeSync = null, k
|
|
|
369
374
|
emitVault({ phase: 'revoked' })
|
|
370
375
|
// Sin `await`: quien llama es un manejador de mensajes que no espera nada (y si algo
|
|
371
376
|
// aquí revienta, el enlace y el acta ya se fueron, que es lo que no puede quedar).
|
|
372
|
-
removeThisAccount().catch(() => {})
|
|
377
|
+
if (removeAccountOnExpulsion) removeThisAccount().catch(() => {})
|
|
373
378
|
}
|
|
374
379
|
|
|
375
380
|
/**
|