@kumiai/mls 0.13.1 → 0.13.2
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/README.md +19 -0
- package/lib/authentication.d.ts +4 -3
- package/lib/authentication.js +10 -0
- package/lib/controller-ingest.d.ts +2 -1
- package/lib/controller-log.d.ts +7 -6
- package/lib/device-proof.d.ts +2 -1
- package/lib/embedded-resolver.d.ts +2 -1
- package/lib/envelope-fold.d.ts +2 -1
- package/lib/envelope-fold.js +2 -1
- package/lib/group-commit.d.ts +7 -7
- package/lib/group-commit.js +31 -15
- package/lib/group-context.d.ts +2 -2
- package/lib/group-context.js +4 -0
- package/lib/group-create.d.ts +3 -3
- package/lib/group-create.js +12 -5
- package/lib/group-device.d.ts +2 -1
- package/lib/group-device.js +20 -10
- package/lib/group-handle.d.ts +9 -8
- package/lib/group-handle.js +48 -25
- package/lib/group-lifecycle.d.ts +16 -15
- package/lib/group-lifecycle.js +55 -29
- package/lib/group-membership.d.ts +3 -2
- package/lib/group-membership.js +4 -3
- package/lib/group-welcome.d.ts +3 -3
- package/lib/group-welcome.js +25 -6
- package/lib/history.d.ts +3 -2
- package/lib/index.d.ts +1 -1
- package/lib/ledger.d.ts +4 -3
- package/lib/ledger.js +3 -2
- package/lib/lifecycle-proof.d.ts +6 -5
- package/lib/lifecycle-proof.js +8 -6
- package/lib/lifecycle.d.ts +8 -7
- package/lib/lifecycle.js +46 -29
- package/lib/member-root.d.ts +8 -7
- package/lib/registry.d.ts +6 -5
- package/lib/types.d.ts +1 -0
- package/package.json +6 -6
package/lib/lifecycle.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { type GroupHandle } from './group-handle.js';
|
|
|
6
6
|
import type { VerifiedLedgerEntry } from './ledger.js';
|
|
7
7
|
import { type CommitPolicyContext } from './policy.js';
|
|
8
8
|
import { type DeviceRegistry } from './registry.js';
|
|
9
|
+
import type { YieldOptions } from './types.js';
|
|
9
10
|
export type CommitRejectionReason = 'binding' | 'lapse' | 'floor' | 'policy' | 'invalid';
|
|
10
11
|
export declare function rejectionReason(error: unknown): CommitRejectionReason;
|
|
11
12
|
export declare function leafAt(tree: ClientState['ratchetTree'], index: number): LeafNode | undefined;
|
|
@@ -13,22 +14,22 @@ export type AttestedTreeTimeParams = {
|
|
|
13
14
|
tree: ClientState['ratchetTree'];
|
|
14
15
|
registry: DeviceRegistry;
|
|
15
16
|
controllerID: string;
|
|
16
|
-
} & CryptoOptions;
|
|
17
|
+
} & CryptoOptions & YieldOptions;
|
|
17
18
|
export declare function attestedTreeTime({ tree, registry, controllerID, ...options }: AttestedTreeTimeParams): Promise<number>;
|
|
18
|
-
export declare function treeTime(group: Pick<GroupHandle, 'state' | 'anchor' | 'registry'> & CryptoOptions, controllerID: string, registry?: DeviceRegistry): Promise<number>;
|
|
19
|
-
export declare function isLapsed(group: Pick<GroupHandle, 'state' | 'anchor' | 'registry'> & CryptoOptions, leaf: LeafNode, registry?: DeviceRegistry): Promise<boolean>;
|
|
19
|
+
export declare function treeTime(group: Pick<GroupHandle, 'state' | 'anchor' | 'registry'> & CryptoOptions, controllerID: string, registry?: DeviceRegistry, options?: YieldOptions): Promise<number>;
|
|
20
|
+
export declare function isLapsed(group: Pick<GroupHandle, 'state' | 'anchor' | 'registry'> & CryptoOptions, leaf: LeafNode, registry?: DeviceRegistry, options?: YieldOptions): Promise<boolean>;
|
|
20
21
|
export type LeafExpiryParams = {
|
|
21
22
|
binding: ControllerBinding;
|
|
22
23
|
registry: DeviceRegistry;
|
|
23
24
|
controller: string;
|
|
24
|
-
} & CryptoOptions;
|
|
25
|
+
} & CryptoOptions & YieldOptions;
|
|
25
26
|
export declare function leafExpiry({ binding, registry, controller, ...options }: LeafExpiryParams): Promise<number | undefined>;
|
|
26
27
|
export declare function validateEntry(group: GroupHandle, leaf: LeafNode, previous?: LeafNode, judging?: JudgingContext): Promise<void>;
|
|
27
28
|
/** The same credential and key a tree already holds at that leaf index. */
|
|
28
29
|
export declare function isUnchangedLeaf(tree: ClientState['ratchetTree'], index: number, leaf: Pick<LeafNode, 'credential' | 'signaturePublicKey'>): boolean;
|
|
29
30
|
export declare function validateWelcomeTree(group: GroupHandle, judging?: JudgingContext): Promise<void>;
|
|
30
31
|
export type IncomingMessage = Parameters<IncomingMessageCallback>[0];
|
|
31
|
-
export type PrepareLifecycleGateParams = {
|
|
32
|
+
export type PrepareLifecycleGateParams = YieldOptions & {
|
|
32
33
|
group: GroupHandle;
|
|
33
34
|
entries: Array<VerifiedLedgerEntry>;
|
|
34
35
|
candidateRegistry: DeviceRegistry;
|
|
@@ -41,7 +42,7 @@ export type LifecycleGate = {
|
|
|
41
42
|
};
|
|
42
43
|
/** The callback judges proposals; survivors check the path before any state is installed. */
|
|
43
44
|
export declare function prepareLifecycleGate(params: PrepareLifecycleGateParams): Promise<LifecycleGate>;
|
|
44
|
-
export type AssertSenderNotLapsedParams = {
|
|
45
|
+
export type AssertSenderNotLapsedParams = YieldOptions & {
|
|
45
46
|
group: GroupHandle;
|
|
46
47
|
tree: ClientState['ratchetTree'];
|
|
47
48
|
leafIndex: number | null | undefined;
|
|
@@ -49,7 +50,7 @@ export type AssertSenderNotLapsedParams = {
|
|
|
49
50
|
};
|
|
50
51
|
/** Historical messages use the tree and registry authenticated in their own epoch. */
|
|
51
52
|
export declare function assertSenderNotLapsed(params: AssertSenderNotLapsedParams): Promise<void>;
|
|
52
|
-
export type AssertRecoveryBindingParams = {
|
|
53
|
+
export type AssertRecoveryBindingParams = YieldOptions & {
|
|
53
54
|
group: GroupHandle;
|
|
54
55
|
identity: OwnIdentity;
|
|
55
56
|
controller: ControllerBinding;
|
package/lib/lifecycle.js
CHANGED
|
@@ -72,7 +72,7 @@ export async function attestedTreeTime({ tree, registry, controllerID, ...option
|
|
|
72
72
|
const quorum = times.length === 1 ? times[0] : times[1];
|
|
73
73
|
return Math.max(projection?.timeFloor ?? 0, rootTime, quorum ?? 0);
|
|
74
74
|
}
|
|
75
|
-
export async function treeTime(group, controllerID, registry = group.registry) {
|
|
75
|
+
export async function treeTime(group, controllerID, registry = group.registry, options) {
|
|
76
76
|
return await attestedTreeTime({
|
|
77
77
|
tree: group.state.ratchetTree,
|
|
78
78
|
registry: group.anchor.controller == null ? {
|
|
@@ -80,10 +80,11 @@ export async function treeTime(group, controllerID, registry = group.registry) {
|
|
|
80
80
|
controllers: new Map()
|
|
81
81
|
} : registry,
|
|
82
82
|
controllerID,
|
|
83
|
-
crypto: group.crypto
|
|
83
|
+
crypto: group.crypto,
|
|
84
|
+
yield: options?.yield
|
|
84
85
|
});
|
|
85
86
|
}
|
|
86
|
-
export async function isLapsed(group, leaf, registry = group.registry) {
|
|
87
|
+
export async function isLapsed(group, leaf, registry = group.registry, options) {
|
|
87
88
|
const controller = group.anchor.controller;
|
|
88
89
|
if (controller == null) return false;
|
|
89
90
|
const binding = identity(leaf).controller;
|
|
@@ -91,9 +92,10 @@ export async function isLapsed(group, leaf, registry = group.registry) {
|
|
|
91
92
|
binding,
|
|
92
93
|
registry,
|
|
93
94
|
controller,
|
|
94
|
-
crypto: group.crypto
|
|
95
|
+
crypto: group.crypto,
|
|
96
|
+
yield: options?.yield
|
|
95
97
|
});
|
|
96
|
-
return expiry != null && expiry < await treeTime(group, controller, registry);
|
|
98
|
+
return expiry != null && expiry < await treeTime(group, controller, registry, options);
|
|
97
99
|
}
|
|
98
100
|
export async function leafExpiry({ binding, registry, controller, ...options }) {
|
|
99
101
|
const did = normalizeDID(controller);
|
|
@@ -189,7 +191,8 @@ async function checkBinding(group, leaf, previous, /** The leaf arrives in a Wel
|
|
|
189
191
|
const full = judging.stage === 'full';
|
|
190
192
|
const denied = full && registry != null ? denySetOf(registry) : new Set();
|
|
191
193
|
if (denied.has(normalizeDID(parsed.id)) && !await mayReadmitResetDevice(registry ?? group.registry, parsed, {
|
|
192
|
-
crypto: group.crypto
|
|
194
|
+
crypto: group.crypto,
|
|
195
|
+
yield: judging.yield
|
|
193
196
|
})) throw new LeafBindingError('denied-id');
|
|
194
197
|
const record = full ? registry?.devices.get(normalizeDID(parsed.id)) : undefined;
|
|
195
198
|
if (record != null && (binding == null || normalizeDID(binding.id) !== record.controller)) throw new LeafBindingError('controller-mismatch');
|
|
@@ -209,22 +212,24 @@ async function checkBinding(group, leaf, previous, /** The leaf arrives in a Wel
|
|
|
209
212
|
if (payload.cap != null && denied.has(normalizeDID(payload.iss)) && !((welcome || judging.mode === 'retain') && isEvidencedChild(group, leaf, denied))) throw new LeafBindingError('denied-issuer');
|
|
210
213
|
}
|
|
211
214
|
const folded = await foldChain(binding.id, binding.prefix, {
|
|
212
|
-
crypto: group.crypto
|
|
215
|
+
crypto: group.crypto,
|
|
216
|
+
yield: judging.yield
|
|
213
217
|
});
|
|
214
218
|
if (!folded.ok) throw new LeafBindingError('controller-mismatch');
|
|
215
219
|
if (full && controller != null && (folded.states.at(-1)?.gen ?? 0) < (registry?.controllers.get(normalizeDID(controller))?.genFloor ?? 0)) throw new LeafBindingError('generation-floor');
|
|
216
220
|
}
|
|
217
|
-
async function checkAdmissionExpiry(group, leaf, registry = group.registry) {
|
|
221
|
+
async function checkAdmissionExpiry(group, leaf, registry = group.registry, options) {
|
|
218
222
|
const binding = identity(leaf).controller;
|
|
219
223
|
if (binding == null) return;
|
|
220
224
|
const expiry = await leafExpiry({
|
|
221
225
|
binding,
|
|
222
226
|
registry,
|
|
223
227
|
controller: binding.id,
|
|
224
|
-
crypto: group.crypto
|
|
228
|
+
crypto: group.crypto,
|
|
229
|
+
yield: options?.yield
|
|
225
230
|
});
|
|
226
231
|
if (expiry == null) throw new LeafBindingError('member-unavailable');
|
|
227
|
-
if (expiry <= await treeTime(group, binding.id, registry)) throw new LeafLapsedError('lapsed');
|
|
232
|
+
if (expiry <= await treeTime(group, binding.id, registry, options)) throw new LeafLapsedError('lapsed');
|
|
228
233
|
}
|
|
229
234
|
async function checkEntry(group, leaf, previous, judging = {
|
|
230
235
|
registry: group.registry,
|
|
@@ -232,7 +237,7 @@ async function checkEntry(group, leaf, previous, judging = {
|
|
|
232
237
|
mode: 'admit'
|
|
233
238
|
}) {
|
|
234
239
|
await checkBinding(group, leaf, previous, false, judging);
|
|
235
|
-
if (judging.mode === 'admit') await checkAdmissionExpiry(group, leaf, judging.registry);
|
|
240
|
+
if (judging.mode === 'admit') await checkAdmissionExpiry(group, leaf, judging.registry, judging);
|
|
236
241
|
}
|
|
237
242
|
async function validateBoundLeaf(group, leaf, previous, welcome = false, judging = {
|
|
238
243
|
registry: group.registry,
|
|
@@ -242,6 +247,7 @@ async function validateBoundLeaf(group, leaf, previous, welcome = false, judging
|
|
|
242
247
|
await checkBinding(group, leaf, previous, welcome, judging);
|
|
243
248
|
await verifyLeafCredential(leaf.credential, leaf.signaturePublicKey, {
|
|
244
249
|
crypto: group.crypto,
|
|
250
|
+
yield: judging.yield,
|
|
245
251
|
judging: ()=>({
|
|
246
252
|
...judging,
|
|
247
253
|
registry: group.anchor.controller == null ? undefined : judging.registry
|
|
@@ -258,17 +264,18 @@ export async function validateEntry(group, leaf, previous, judging = {
|
|
|
258
264
|
mode: 'admit'
|
|
259
265
|
}) {
|
|
260
266
|
await validateBoundLeaf(group, leaf, previous, false, judging);
|
|
261
|
-
if (judging.mode === 'admit') await checkAdmissionExpiry(group, leaf, judging.registry);
|
|
267
|
+
if (judging.mode === 'admit') await checkAdmissionExpiry(group, leaf, judging.registry, judging);
|
|
262
268
|
}
|
|
263
269
|
/** The same credential and key a tree already holds at that leaf index. */ export function isUnchangedLeaf(tree, index, leaf) {
|
|
264
270
|
const held = leafAt(tree, index);
|
|
265
271
|
return held != null && credentialEqual(held, leaf) && bytesEqual(held.signaturePublicKey, leaf.signaturePublicKey);
|
|
266
272
|
}
|
|
267
|
-
async function checkSurvivors(group, tree, registry, origin) {
|
|
273
|
+
async function checkSurvivors(group, tree, registry, origin, policy) {
|
|
268
274
|
const denied = denySetOf(registry);
|
|
269
275
|
const controller = group.anchor.controller;
|
|
270
276
|
const options = {
|
|
271
|
-
crypto: group.crypto
|
|
277
|
+
crypto: group.crypto,
|
|
278
|
+
yield: policy?.yield
|
|
272
279
|
};
|
|
273
280
|
for (const [position, node] of tree.entries()){
|
|
274
281
|
if (node?.nodeType !== nodeTypes.leaf) continue;
|
|
@@ -307,24 +314,25 @@ export async function validateWelcomeTree(group, judging = {
|
|
|
307
314
|
for (const [index, node] of group.state.ratchetTree.entries()){
|
|
308
315
|
if (node?.nodeType !== nodeTypes.leaf) continue;
|
|
309
316
|
await validateBoundLeaf(group, node.leaf, undefined, true, judging);
|
|
310
|
-
if (judging.stage === 'full' && index === group.state.privatePath.leafIndex * 2) await checkAdmissionExpiry(group, node.leaf, judging.registry);
|
|
317
|
+
if (judging.stage === 'full' && index === group.state.privatePath.leafIndex * 2) await checkAdmissionExpiry(group, node.leaf, judging.registry, judging);
|
|
311
318
|
}
|
|
312
319
|
if (judging.stage === 'full') await checkSurvivors(group, group.state.ratchetTree, judging.registry ?? group.registry, {
|
|
313
320
|
kind: 'welcome'
|
|
314
|
-
});
|
|
321
|
+
}, judging);
|
|
315
322
|
}
|
|
316
323
|
/** The callback judges proposals; survivors check the path before any state is installed. */ export async function prepareLifecycleGate(params) {
|
|
317
324
|
const { group, entries, candidateRegistry, context, externalLeaf } = params;
|
|
318
325
|
const controller = group.anchor.controller;
|
|
319
326
|
const options = {
|
|
320
|
-
crypto: group.crypto
|
|
327
|
+
crypto: group.crypto,
|
|
328
|
+
yield: params.yield
|
|
321
329
|
};
|
|
322
330
|
if (controller == null) {
|
|
323
331
|
for (const { entry, issuer } of entries){
|
|
324
332
|
if (entry.type !== DEVICE_ENTRY_TYPE) continue;
|
|
325
333
|
const capability = entry.value.capability;
|
|
326
334
|
const binding = group.bindingOfDID(issuer);
|
|
327
|
-
if (capability != null && binding?.controller != null && readCapability(capability).payload.exp < await treeTime(group, binding.controller, candidateRegistry)) throw new LeafLapsedError('lapsed');
|
|
335
|
+
if (capability != null && binding?.controller != null && readCapability(capability).payload.exp < await treeTime(group, binding.controller, candidateRegistry, params)) throw new LeafLapsedError('lapsed');
|
|
328
336
|
}
|
|
329
337
|
}
|
|
330
338
|
const before = group.state.ratchetTree;
|
|
@@ -337,7 +345,7 @@ export async function validateWelcomeTree(group, judging = {
|
|
|
337
345
|
tree: before,
|
|
338
346
|
entries: ledger
|
|
339
347
|
});
|
|
340
|
-
const beforeTime = controller == null ? 0 : await treeTime(group, controller);
|
|
348
|
+
const beforeTime = controller == null ? 0 : await treeTime(group, controller, group.registry, params);
|
|
341
349
|
const lapsed = new Set();
|
|
342
350
|
if (controller != null) {
|
|
343
351
|
for(let index = 0; index * 2 < before.length; index++){
|
|
@@ -375,7 +383,7 @@ export async function validateWelcomeTree(group, judging = {
|
|
|
375
383
|
let registry = group.registry;
|
|
376
384
|
for (const entry of lifecycleEntries){
|
|
377
385
|
const verified = entry;
|
|
378
|
-
const effects = await verifyLifecycleProof(group, verified, registry);
|
|
386
|
+
const effects = await verifyLifecycleProof(group, verified, registry, options);
|
|
379
387
|
registry = await registryApply(verified, registry, controller, options);
|
|
380
388
|
if ([
|
|
381
389
|
'revoke',
|
|
@@ -386,7 +394,8 @@ export async function validateWelcomeTree(group, judging = {
|
|
|
386
394
|
const judging = (index, leaf)=>({
|
|
387
395
|
registry: candidateRegistry,
|
|
388
396
|
stage: 'full',
|
|
389
|
-
mode: index != null && isUnchangedLeaf(before, index, leaf) ? 'retain' : 'admit'
|
|
397
|
+
mode: index != null && isUnchangedLeaf(before, index, leaf) ? 'retain' : 'admit',
|
|
398
|
+
yield: params.yield
|
|
390
399
|
});
|
|
391
400
|
if (externalLeaf != null) await validateEntry(group, externalLeaf, undefined, judging(undefined, externalLeaf));
|
|
392
401
|
let incomingCommit;
|
|
@@ -531,7 +540,7 @@ export async function validateWelcomeTree(group, judging = {
|
|
|
531
540
|
await checkSurvivors(group, tree, candidateRegistry, {
|
|
532
541
|
kind: 'commit',
|
|
533
542
|
before
|
|
534
|
-
});
|
|
543
|
+
}, params);
|
|
535
544
|
};
|
|
536
545
|
const postApply = async (state)=>{
|
|
537
546
|
if (incomingCommit == null || state.groupActiveState.kind === 'removedFromGroup') return;
|
|
@@ -556,14 +565,14 @@ export async function validateWelcomeTree(group, judging = {
|
|
|
556
565
|
controller,
|
|
557
566
|
...options
|
|
558
567
|
});
|
|
559
|
-
if (old != null && lapsed.has(senderIndex) && (next == null || credentialEqual(old, next) || expiry == null || expiry < await treeTime(group, controller, candidateRegistry))) throw new LeafLapsedError('lapsed');
|
|
568
|
+
if (old != null && lapsed.has(senderIndex) && (next == null || credentialEqual(old, next) || expiry == null || expiry < await treeTime(group, controller, candidateRegistry, params))) throw new LeafLapsedError('lapsed');
|
|
560
569
|
}
|
|
561
570
|
await checkTime(state.ratchetTree);
|
|
562
571
|
checkSize(state.ratchetTree);
|
|
563
572
|
await checkSurvivors(group, state.ratchetTree, candidateRegistry, {
|
|
564
573
|
kind: 'commit',
|
|
565
574
|
before
|
|
566
|
-
});
|
|
575
|
+
}, params);
|
|
567
576
|
};
|
|
568
577
|
return {
|
|
569
578
|
check,
|
|
@@ -581,10 +590,12 @@ export async function validateWelcomeTree(group, judging = {
|
|
|
581
590
|
if (expected == null) throw new Error('Missing epoch ledger head');
|
|
582
591
|
const registry = await registryAt({
|
|
583
592
|
group,
|
|
584
|
-
head: expected.head
|
|
593
|
+
head: expected.head,
|
|
594
|
+
yield: params.yield
|
|
585
595
|
});
|
|
586
596
|
const options = {
|
|
587
|
-
crypto: group.crypto
|
|
597
|
+
crypto: group.crypto,
|
|
598
|
+
yield: params.yield
|
|
588
599
|
};
|
|
589
600
|
const binding = identity(leaf).controller;
|
|
590
601
|
const expiry = binding == null ? undefined : await leafExpiry({
|
|
@@ -614,7 +625,12 @@ export async function validateWelcomeTree(group, judging = {
|
|
|
614
625
|
controller
|
|
615
626
|
})
|
|
616
627
|
};
|
|
617
|
-
await validateEntry(group, leaf, old
|
|
628
|
+
await validateEntry(group, leaf, old, {
|
|
629
|
+
registry: group.registry,
|
|
630
|
+
stage: 'full',
|
|
631
|
+
mode: 'admit',
|
|
632
|
+
yield: params.yield
|
|
633
|
+
});
|
|
618
634
|
const tree = group.state.ratchetTree.slice();
|
|
619
635
|
tree[index * 2] = {
|
|
620
636
|
nodeType: nodeTypes.leaf,
|
|
@@ -626,8 +642,9 @@ export async function validateWelcomeTree(group, judging = {
|
|
|
626
642
|
tree,
|
|
627
643
|
registry: group.registry,
|
|
628
644
|
controllerID,
|
|
629
|
-
crypto: group.crypto
|
|
630
|
-
|
|
645
|
+
crypto: group.crypto,
|
|
646
|
+
yield: params.yield
|
|
647
|
+
}) < await treeTime(group, controllerID, group.registry, params)) throw new RevokeProofError('effects-mismatch');
|
|
631
648
|
const ledger = group.ledger.map(({ verified })=>verified);
|
|
632
649
|
const size = historySize({
|
|
633
650
|
tree,
|
package/lib/member-root.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type ControllerLog, type FoldResult, type KeyState, type MemberState }
|
|
|
2
2
|
import { type CryptoOptions } from '@kokuin/token';
|
|
3
3
|
import type { ControllerBinding } from './credential.js';
|
|
4
4
|
import type { ControllerProjection, DeviceRegistry, RevokedEffect } from './registry.js';
|
|
5
|
+
import type { YieldOptions } from './types.js';
|
|
5
6
|
export type MemberRoot = {
|
|
6
7
|
kind: 'root';
|
|
7
8
|
controller: string;
|
|
@@ -55,9 +56,9 @@ export type EffectOfParams = {
|
|
|
55
56
|
log: ControllerLog;
|
|
56
57
|
claim: EffectClaim;
|
|
57
58
|
genFloor: number;
|
|
58
|
-
} & CryptoOptions;
|
|
59
|
+
} & CryptoOptions & YieldOptions;
|
|
59
60
|
export declare function effectOf({ controller, log, claim, genFloor, ...options }: EffectOfParams): Promise<void>;
|
|
60
|
-
export declare function effectProofContext(controller: string, log: ControllerLog, options?: CryptoOptions): Promise<{
|
|
61
|
+
export declare function effectProofContext(controller: string, log: ControllerLog, options?: CryptoOptions & YieldOptions): Promise<{
|
|
61
62
|
effectOf: (claim: EffectClaim, genFloor: number) => Promise<void>;
|
|
62
63
|
claimsFor: (recorded: ControllerLog | undefined, genFloor: number) => Promise<EffectClaim[]>;
|
|
63
64
|
}>;
|
|
@@ -66,7 +67,7 @@ export type ClaimsForParams = {
|
|
|
66
67
|
recorded: ControllerLog | undefined;
|
|
67
68
|
merged: ControllerLog;
|
|
68
69
|
genFloor: number;
|
|
69
|
-
} & CryptoOptions;
|
|
70
|
+
} & CryptoOptions & YieldOptions;
|
|
70
71
|
export declare function claimsFor({ controller, recorded, merged, genFloor, ...options }: ClaimsForParams): Promise<Array<EffectClaim>>;
|
|
71
72
|
export type MemberRootStatus = {
|
|
72
73
|
status: 'root';
|
|
@@ -84,13 +85,13 @@ export type MemberRootStatus = {
|
|
|
84
85
|
* The fold of a projection's recorded log, once per log. Lifecycle checks run on every frame, and
|
|
85
86
|
* a fold verifies every signature in the log. Callers must only read the result.
|
|
86
87
|
*/
|
|
87
|
-
export declare function projectionFold(controller: string, projection: ControllerProjection | undefined, options?: CryptoOptions): Promise<FoldResult | undefined>;
|
|
88
|
+
export declare function projectionFold(controller: string, projection: ControllerProjection | undefined, options?: CryptoOptions & YieldOptions): Promise<FoldResult | undefined>;
|
|
88
89
|
export declare function effectiveAttestingMembers(head: KeyState | undefined, projection: ControllerProjection | undefined, time?: number): Array<[string, MemberState]>;
|
|
89
90
|
export type MemberRootStatusParams = {
|
|
90
91
|
registry: DeviceRegistry;
|
|
91
92
|
controller: string;
|
|
92
93
|
root: MemberRoot;
|
|
93
|
-
} & CryptoOptions;
|
|
94
|
+
} & CryptoOptions & YieldOptions;
|
|
94
95
|
export declare function memberRootStatus({ registry, controller, root, ...options }: MemberRootStatusParams): Promise<MemberRootStatus>;
|
|
95
96
|
export type LeafRef = {
|
|
96
97
|
did: string;
|
|
@@ -101,7 +102,7 @@ export type EffectiveAuthorityOfParams = {
|
|
|
101
102
|
leaf: LeafRef;
|
|
102
103
|
registry: DeviceRegistry;
|
|
103
104
|
controller: string;
|
|
104
|
-
} & CryptoOptions;
|
|
105
|
+
} & CryptoOptions & YieldOptions;
|
|
105
106
|
export declare function effectiveAuthorityOf({ leaf, registry, controller, ...options }: EffectiveAuthorityOfParams): Promise<{
|
|
106
107
|
root: MemberRoot;
|
|
107
108
|
slot: EvidenceSlot;
|
|
@@ -119,7 +120,7 @@ export type CascadeOfParams = {
|
|
|
119
120
|
before: DeviceRegistry;
|
|
120
121
|
after: DeviceRegistry;
|
|
121
122
|
controller: string;
|
|
122
|
-
} & CryptoOptions;
|
|
123
|
+
} & CryptoOptions & YieldOptions;
|
|
123
124
|
export declare function cascadeOf({ leaves, claims, before, after, controller, ...options }: CascadeOfParams): Promise<{
|
|
124
125
|
revoked: Array<RevokedEffect>;
|
|
125
126
|
removed: Array<RemovedEffect>;
|
package/lib/registry.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { GroupHandle } from './group-handle.js';
|
|
|
7
7
|
import type { VerifiedLedgerEntry } from './ledger.js';
|
|
8
8
|
import { type EffectClaim, type ProofRef, type RemovedEffect, type RemovedMember } from './member-root.js';
|
|
9
9
|
import { type RosterState } from './roster.js';
|
|
10
|
+
import type { YieldOptions } from './types.js';
|
|
10
11
|
/** The reserved control type carrying a device-registry mutation. One branch, one namespace slot. */
|
|
11
12
|
export declare const DEVICE_ENTRY_TYPE = "kumiai.device";
|
|
12
13
|
/** The device lifecycle operations plus the advisory controller-log beacon. */
|
|
@@ -86,11 +87,11 @@ export declare function isLifecycleDeviceValue(value: DeviceValue): boolean;
|
|
|
86
87
|
* is the acceptance pipeline's job (a self-register leaf attestation, or a management capability),
|
|
87
88
|
* never the fold's. Lifecycle effects replay recorded DIDs without consulting a later tree.
|
|
88
89
|
*/
|
|
89
|
-
export declare function registryApply(verified: VerifiedLedgerEntry<DeviceValue>, state: DeviceRegistry, controllerID?: string, options?: CryptoOptions): Promise<DeviceRegistry>;
|
|
90
|
+
export declare function registryApply(verified: VerifiedLedgerEntry<DeviceValue>, state: DeviceRegistry, controllerID?: string, options?: CryptoOptions & YieldOptions): Promise<DeviceRegistry>;
|
|
90
91
|
/** Only reset removal without a cascade permits a later admission. */
|
|
91
92
|
export declare function isResetOnly(record: DeviceRecord): boolean;
|
|
92
93
|
/** Structural admission exception. Callers still authenticate the capability and holder grant. */
|
|
93
|
-
export declare function mayReadmitResetDevice(registry: DeviceRegistry, parsed: MLSCredentialIdentity, options?: CryptoOptions): Promise<boolean>;
|
|
94
|
+
export declare function mayReadmitResetDevice(registry: DeviceRegistry, parsed: MLSCredentialIdentity, options?: CryptoOptions & YieldOptions): Promise<boolean>;
|
|
94
95
|
export type ControllerOfParams = {
|
|
95
96
|
registry: DeviceRegistry;
|
|
96
97
|
deviceDID: string;
|
|
@@ -112,12 +113,12 @@ export type AssertRetainsKnownEffectsParams = {
|
|
|
112
113
|
controller: string;
|
|
113
114
|
known: DeviceRegistry;
|
|
114
115
|
candidate: DeviceRegistry;
|
|
115
|
-
} & CryptoOptions;
|
|
116
|
+
} & CryptoOptions & YieldOptions;
|
|
116
117
|
export declare function assertRetainsKnownEffects({ controller, known, candidate, ...options }: AssertRetainsKnownEffectsParams): Promise<void>;
|
|
117
118
|
export type RegistryForLogParams = {
|
|
118
119
|
controller: string;
|
|
119
120
|
log: ControllerLog;
|
|
120
|
-
} & CryptoOptions;
|
|
121
|
+
} & CryptoOptions & YieldOptions;
|
|
121
122
|
export declare function registryForLog({ controller, log, ...options }: RegistryForLogParams): Promise<DeviceRegistry>;
|
|
122
123
|
/**
|
|
123
124
|
* The deny set Slice 1's seam consumes: the device DIDs at `status: 'revoked'` NOW. Matched, never
|
|
@@ -142,7 +143,7 @@ export type FoldControlParams = {
|
|
|
142
143
|
anchor: GroupAnchor;
|
|
143
144
|
groupID: string;
|
|
144
145
|
onDrop?: (drop: FoldDrop) => void;
|
|
145
|
-
} & CryptoOptions;
|
|
146
|
+
} & CryptoOptions & YieldOptions;
|
|
146
147
|
/**
|
|
147
148
|
* Fold the whole control ledger into BOTH projections in one ordered pass, so a role entry's
|
|
148
149
|
* authority resolves against the registry-so-far (device entries strictly earlier), never a
|
package/lib/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { CryptoProvider as KokuinCryptoProvider } from '@kokuin/crypto';
|
|
|
3
3
|
import type { Capabilities, CryptoProvider, GroupContextExtension, IncomingMessageCallback, KeyPackage, PrivateKeyPackage } from 'ts-mls';
|
|
4
4
|
import type { ControllerBinding } from './credential.js';
|
|
5
5
|
import type { VerifiedLedgerEntry } from './ledger.js';
|
|
6
|
+
export type { YieldOptions } from '@kokuin/token';
|
|
6
7
|
export type GroupOptions = {
|
|
7
8
|
/** Creator or key-package leaf binding. Creates a lifecycle group when passed to createGroup. */
|
|
8
9
|
controller?: ControllerBinding;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumiai/mls",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"description": "E2EE group identity and membership for Enkaku using MLS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mls",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"lib/*"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@kokuin/capability": "^0.7.
|
|
29
|
-
"@kokuin/controller": "^0.7.
|
|
30
|
-
"@kokuin/crypto": "^0.7.
|
|
31
|
-
"@kokuin/token": "^0.7.
|
|
28
|
+
"@kokuin/capability": "^0.7.1",
|
|
29
|
+
"@kokuin/controller": "^0.7.1",
|
|
30
|
+
"@kokuin/crypto": "^0.7.1",
|
|
31
|
+
"@kokuin/token": "^0.7.1",
|
|
32
32
|
"@noble/ciphers": "^2.4.0",
|
|
33
33
|
"@noble/curves": "^2.4.0",
|
|
34
34
|
"@noble/hashes": "^2.4.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"ts-mls": "2.0.0-rc.13"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@kokuin/crypto-napi": "^0.7.
|
|
42
|
+
"@kokuin/crypto-napi": "^0.7.4"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|