@kumiai/mls 0.10.3 → 0.10.4
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/lib/group-handle.js +13 -7
- package/package.json +1 -1
package/lib/group-handle.js
CHANGED
|
@@ -171,16 +171,22 @@ export function mutexFor(handle) {
|
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
/** Project tree re-admissions from the full ledger fold, never a previous projection.
|
|
174
|
+
/** Project lifecycle tree re-admissions from the full ledger fold, never a previous projection.
|
|
175
175
|
* A lapsed re-admitted leaf and a leaf inserted after expiry are indistinguishable here;
|
|
176
176
|
* a genuine expired post-reset package can activate a leaf for a Welcome joiner or an
|
|
177
177
|
* external rejoiner adopting a fork existing members reject. Ordinary commit admission
|
|
178
178
|
* still enforces expiry.
|
|
179
|
-
*/ function registryWithTreeBindings(registry, tree) {
|
|
179
|
+
*/ function registryWithTreeBindings(registry, tree, anchor) {
|
|
180
|
+
if (anchor.controller == null) return registry;
|
|
180
181
|
const devices = new Map(registry.devices);
|
|
181
182
|
for (const node of tree){
|
|
182
183
|
if (node?.nodeType !== nodeTypes.leaf || !isDefaultCredential(node.leaf.credential) || node.leaf.credential.credentialType !== defaultCredentialTypes.basic) continue;
|
|
183
|
-
|
|
184
|
+
let parsed;
|
|
185
|
+
try {
|
|
186
|
+
parsed = parseMLSCredentialIdentity(node.leaf.credential.identity);
|
|
187
|
+
} catch {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
184
190
|
if (!mayReadmitResetDevice(registry, parsed)) continue;
|
|
185
191
|
const did = normalizeDID(parsed.id);
|
|
186
192
|
const record = devices.get(did);
|
|
@@ -253,7 +259,7 @@ export function mutexFor(handle) {
|
|
|
253
259
|
]));
|
|
254
260
|
const folded = foldLedgerControl(this.#ledger, anchor, this.groupID);
|
|
255
261
|
this.#roster = folded.roster;
|
|
256
|
-
this.#registry = registryWithTreeBindings(folded.registry, this.#state.ratchetTree);
|
|
262
|
+
this.#registry = registryWithTreeBindings(folded.registry, this.#state.ratchetTree, this.#anchor);
|
|
257
263
|
// Authentication reads only this handle's registry and lifetime limits.
|
|
258
264
|
const denyHolder = deviceDenyHolderFor(this.#context);
|
|
259
265
|
if (denyHolder != null) {
|
|
@@ -452,7 +458,7 @@ export function mutexFor(handle) {
|
|
|
452
458
|
}
|
|
453
459
|
const folded = foldLedgerControl(this.#ledger, this.#anchor, this.groupID);
|
|
454
460
|
this.#roster = folded.roster;
|
|
455
|
-
this.#registry = registryWithTreeBindings(folded.registry, this.#state.ratchetTree);
|
|
461
|
+
this.#registry = registryWithTreeBindings(folded.registry, this.#state.ratchetTree, this.#anchor);
|
|
456
462
|
this.#admission = this.#computeAdmission();
|
|
457
463
|
if (this.#pendingControlEvents != null) {
|
|
458
464
|
this.emitControlEvents(appended.filter(({ entry })=>entry.type === DEVICE_ENTRY_TYPE));
|
|
@@ -564,7 +570,7 @@ export function mutexFor(handle) {
|
|
|
564
570
|
}
|
|
565
571
|
]));
|
|
566
572
|
this.#roster = folded.roster;
|
|
567
|
-
this.#registry = registryWithTreeBindings(folded.registry, this.#state.ratchetTree);
|
|
573
|
+
this.#registry = registryWithTreeBindings(folded.registry, this.#state.ratchetTree, this.#anchor);
|
|
568
574
|
this.#admission = this.#computeAdmission();
|
|
569
575
|
try {
|
|
570
576
|
await opts?.persist?.(this);
|
|
@@ -1061,7 +1067,7 @@ export function mutexFor(handle) {
|
|
|
1061
1067
|
}
|
|
1062
1068
|
this.#roster = candidateRoster;
|
|
1063
1069
|
const folded = foldLedgerControl(this.#ledger, this.#anchor, this.groupID);
|
|
1064
|
-
this.#registry = registryWithTreeBindings(folded.registry, this.#state.ratchetTree);
|
|
1070
|
+
this.#registry = registryWithTreeBindings(folded.registry, this.#state.ratchetTree, this.#anchor);
|
|
1065
1071
|
this.#admission = this.#computeAdmission();
|
|
1066
1072
|
const emit = ()=>{
|
|
1067
1073
|
this.#notifyAccepted(surfaced, acceptedEntries.filter(({ verified })=>verified.entry.type === DEVICE_ENTRY_TYPE).map(({ verified })=>verified));
|