@kumiai/mls 0.10.9 → 0.11.0

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.
@@ -1,11 +1,11 @@
1
- import { type SignedEvent } from '@kokuin/controller';
1
+ import type { SignedEvent } from '@kokuin/controller';
2
2
  import type { AuthenticationService, Credential } from 'ts-mls';
3
3
  import { type MLSCredentialIdentity } from './credential.js';
4
4
  import { type DeviceRegistry } from './registry.js';
5
5
  export { MLS_LEAF_ACT, MLS_LEAF_RES } from './capability.js';
6
6
  /** The action a management capability must grant to mutate a profile's device registry. */
7
7
  export declare const MLS_DEVICES_ACT = "manage";
8
- /** The resource half — kumiai-namespaced, group-independent, per the kokuin management tier. */
8
+ /** The resource half — kumiai-namespaced and group-independent. */
9
9
  export declare const MLS_DEVICES_RES = "kumiai/devices";
10
10
  export type DIDAuthenticationDependencies = {
11
11
  deviceDenySet?: () => ReadonlySet<string>;
@@ -1,16 +1,16 @@
1
1
  import { assertCapabilityToken, assertValidDelegation, checkCapability, hasPermission } from '@kokuin/capability';
2
- import { foldLog } from '@kokuin/controller';
3
2
  import { decodeMultibase, decodePeer4, getAlgorithmAndPublicKey, getSignatureInfo, getVerifier, isPeer4, normalizeDID, verifyToken } from '@kokuin/token';
4
3
  import { fromB64U, fromUTF } from '@sozai/codec';
5
4
  import { defaultCredentialTypes } from 'ts-mls';
6
5
  import { assertCapabilityLifetime, assertControllerGrant, capabilityKey, MAX_LEAF_LIFETIME, MAX_TRUSTED_GRANT_LIFETIME, MLS_LEAF_ACT, MLS_LEAF_RES, readCapability } from './capability.js';
6
+ import { foldChain } from './controller-log.js';
7
7
  import { parseMLSCredentialIdentity } from './credential.js';
8
8
  import { createEmbeddedControllerResolver } from './embedded-resolver.js';
9
9
  import { LeafBindingError } from './errors.js';
10
10
  import { denySetOf, mayReadmitResetDevice } from './registry.js';
11
11
  export { MLS_LEAF_ACT, MLS_LEAF_RES } from './capability.js';
12
12
  /** The action a management capability must grant to mutate a profile's device registry. */ export const MLS_DEVICES_ACT = 'manage';
13
- /** The resource half — kumiai-namespaced, group-independent, per the kokuin management tier. */ export const MLS_DEVICES_RES = 'kumiai/devices';
13
+ /** The resource half — kumiai-namespaced and group-independent. */ export const MLS_DEVICES_RES = 'kumiai/devices';
14
14
  const EMPTY_DENY = new Set();
15
15
  function constantTimeEqual(a, b) {
16
16
  if (a.length !== b.length) return false;
@@ -72,7 +72,7 @@ function isDenied(denied, did) {
72
72
  return denied.has(did) || denied.has(normalizeDID(did));
73
73
  }
74
74
  /** Authenticate only embedded proof, using the token's issuance as its reference time. */ async function verifyPinnedCapability(params) {
75
- if (!params.controllerID.startsWith('did:kokuin:') || !foldLog(params.controllerID, params.prefix).ok) {
75
+ if (!params.controllerID.startsWith('did:kokuin:') || !foldChain(params.controllerID, params.prefix).ok) {
76
76
  throw new LeafBindingError('controller-mismatch');
77
77
  }
78
78
  const token = readCapability(params.capability);
@@ -210,7 +210,7 @@ function withoutIssuer(denied, capability) {
210
210
  ].filter((did)=>normalizeDID(did) !== normalizeDID(parsed.id))) : denied;
211
211
  if (parsed.controller == null) return;
212
212
  if (registry != null) {
213
- const folded = foldLog(parsed.controller.id, parsed.controller.prefix);
213
+ const folded = foldChain(parsed.controller.id, parsed.controller.prefix);
214
214
  if (!folded.ok) throw new LeafBindingError('controller-mismatch');
215
215
  if ((folded.states.at(-1)?.gen ?? 0) < (registry.controllers.get(normalizeDID(parsed.controller.id))?.genFloor ?? 0)) throw new LeafBindingError('generation-floor');
216
216
  }
@@ -0,0 +1,9 @@
1
+ import type { KeyState } from '@kokuin/controller';
2
+ import { type ControllerLog, type FoldResult, type SignedEvent } from '@kokuin/controller';
3
+ export declare const CHAIN_REVOKE_REFUSED = "chain revoke refused";
4
+ export declare function asControllerLog(chain: ReadonlyArray<SignedEvent>): ControllerLog;
5
+ export declare function hasChainRevoke(chain: ReadonlyArray<unknown>): boolean;
6
+ export declare function foldChain(did: string, chain: ReadonlyArray<SignedEvent>): FoldResult;
7
+ export declare function isDetachedFoldReason(reason: string): boolean;
8
+ /** Requires a normalised subject DID. */
9
+ export declare function revokesSubject(chain: ReadonlyArray<SignedEvent>, states: ReadonlyArray<KeyState>, index: number, subject: string): boolean;
@@ -0,0 +1,44 @@
1
+ import { foldLog } from '@kokuin/controller';
2
+ import { normalizeDID } from '@kokuin/token';
3
+ export const CHAIN_REVOKE_REFUSED = 'chain revoke refused';
4
+ export function asControllerLog(chain) {
5
+ return {
6
+ chain: [
7
+ ...chain
8
+ ],
9
+ events: []
10
+ };
11
+ }
12
+ export function hasChainRevoke(chain) {
13
+ return chain.some((signed)=>{
14
+ if (signed == null || typeof signed !== 'object' || !('event' in signed)) return false;
15
+ const event = signed.event;
16
+ return event != null && typeof event === 'object' && 't' in event && event.t === 'rev';
17
+ });
18
+ }
19
+ export function foldChain(did, chain) {
20
+ // Kokuin 0.2 skips unsigned crit:false events, but a chain rev must never fold.
21
+ if (hasChainRevoke(chain)) {
22
+ const index = chain.findIndex((signed)=>hasChainRevoke([
23
+ signed
24
+ ]));
25
+ return {
26
+ ok: false,
27
+ reason: CHAIN_REVOKE_REFUSED,
28
+ index
29
+ };
30
+ }
31
+ return foldLog(did, asControllerLog(chain));
32
+ }
33
+ export function isDetachedFoldReason(reason) {
34
+ return /sequence|digest/.test(reason);
35
+ }
36
+ /** Requires a normalised subject DID. */ export function revokesSubject(chain, states, index, subject) {
37
+ const state = states[index];
38
+ const prior = states[index - 1];
39
+ if (index <= 0 || chain[index]?.event.t !== 'rot' || state == null || prior == null) return false;
40
+ const denies = (state)=>[
41
+ ...state.deny
42
+ ].some((did)=>normalizeDID(did) === subject);
43
+ return state.gen === prior.gen && denies(state) && !denies(prior);
44
+ }
@@ -6,6 +6,9 @@ import type { DIDMethodResolver } from '@kokuin/token';
6
6
  * `undefined` for any other DID, so no code path can reach a sidecar. `resolveDenySet` is overridden
7
7
  * to answer from the injected group-folded set (freshness), rather than the prefix's frozen head.
8
8
  *
9
+ * Member grants are unsupported: the prefix carries no epoch events, so members could only come
10
+ * from a stale snapshot.
11
+ *
9
12
  * A per-leaf, one-shot instance: the prefix is small, verification is single-pass, and no `history`
10
13
  * store is configured. This is the adapter the Slice 1 spike verified to run with zero external I/O.
11
14
  */
@@ -1,4 +1,5 @@
1
1
  import { createControllerResolver } from '@kokuin/controller';
2
+ import { asControllerLog, hasChainRevoke } from './controller-log.js';
2
3
  const EMPTY = new Set();
3
4
  /**
4
5
  * A `did:kokuin:` resolver whose log is the prefix EMBEDDED in an MLS leaf — never fetched
@@ -6,14 +7,22 @@ const EMPTY = new Set();
6
7
  * `undefined` for any other DID, so no code path can reach a sidecar. `resolveDenySet` is overridden
7
8
  * to answer from the injected group-folded set (freshness), rather than the prefix's frozen head.
8
9
  *
10
+ * Member grants are unsupported: the prefix carries no epoch events, so members could only come
11
+ * from a stale snapshot.
12
+ *
9
13
  * A per-leaf, one-shot instance: the prefix is small, verification is single-pass, and no `history`
10
14
  * store is configured. This is the adapter the Slice 1 spike verified to run with zero external I/O.
11
15
  */ export function createEmbeddedControllerResolver(params) {
12
16
  const base = createControllerResolver({
13
- loadLog: async (did)=>did === params.controllerID ? params.prefix : undefined
17
+ loadLog: async (did)=>did === params.controllerID && !hasChainRevoke(params.prefix) ? asControllerLog(params.prefix) : undefined
14
18
  });
19
+ // Forward only what verification needs: anything else kokuin adds is not passed through unseen.
20
+ const { method, resolve, resolveHistoric, resolveAgreementKey } = base;
15
21
  return {
16
- ...base,
22
+ method,
23
+ resolve,
24
+ resolveHistoric,
25
+ resolveAgreementKey,
17
26
  async resolveDenySet (_did) {
18
27
  return params.denySet ?? EMPTY;
19
28
  }
@@ -490,6 +490,7 @@ function ledgerLogEntry(entryID, token, verified) {
490
490
  */ async applyLedgerEntries(tokens) {
491
491
  return mutexFor(this).run(async ()=>{
492
492
  const appended = [];
493
+ const candidates = [];
493
494
  const memo = VERIFIED_LEDGER_TOKENS.get(tokens);
494
495
  const nextMemo = [];
495
496
  for (const [index, token] of tokens.entries()){
@@ -508,18 +509,26 @@ function ledgerLogEntry(entryID, token, verified) {
508
509
  if (verified == null || verified.entry.groupID !== this.groupID) continue;
509
510
  const entryID = ledgerEntryDigest(token);
510
511
  const entry = ledgerLogEntry(entryID, token, verified);
511
- this.#ledger.push(entry);
512
+ candidates.push(entry);
512
513
  nextMemo[index] = VERIFIED_LEDGER_ENTRIES.get(verified);
514
+ appended.push(verified);
515
+ }
516
+ const ledger = [
517
+ ...this.#ledger,
518
+ ...candidates
519
+ ];
520
+ const folded = foldLedgerControl(ledger, this.#anchor, this.groupID);
521
+ const registry = registryWithTreeBindings(folded.registry, this.#state.ratchetTree, this.#anchor);
522
+ this.#ledger = ledger;
523
+ for (const { entryID, token, verified } of candidates){
513
524
  this.#entryBodies.set(entryID, {
514
525
  token,
515
526
  verified
516
527
  });
517
- appended.push(verified);
518
528
  }
519
529
  VERIFIED_LEDGER_TOKENS.set(tokens, nextMemo);
520
- const folded = foldLedgerControl(this.#ledger, this.#anchor, this.groupID);
521
530
  this.#roster = folded.roster;
522
- this.#registry = registryWithTreeBindings(folded.registry, this.#state.ratchetTree, this.#anchor);
531
+ this.#registry = registry;
523
532
  this.#admission = this.#computeAdmission();
524
533
  if (this.#pendingControlEvents != null) {
525
534
  this.emitControlEvents(appended.filter(({ entry })=>entry.type === DEVICE_ENTRY_TYPE));
@@ -1,7 +1,8 @@
1
- import { didFromInception, foldLog } from '@kokuin/controller';
1
+ import { didFromInception } from '@kokuin/controller';
2
2
  import { createSigningIdentityForDID, normalizeDID } from '@kokuin/token';
3
3
  import { defaultProposalTypes, encode, isDefaultProposal, mlsMessageEncoder, nodeTypes } from 'ts-mls';
4
4
  import { readCapability } from './capability.js';
5
+ import { foldChain, isDetachedFoldReason, revokesSubject } from './controller-log.js';
5
6
  import { parseMLSCredentialIdentity } from './credential.js';
6
7
  import { LeafBindingError, RevokeProofError } from './errors.js';
7
8
  import { commitWithEntries } from './group-commit.js';
@@ -185,14 +186,14 @@ export async function removeLapsedLeaves(group) {
185
186
  if (normalizeDID(did) !== normalizeDID(controller)) throw new RevokeProofError('wrong-controller');
186
187
  }
187
188
  if (log.some(({ event })=>event.t !== 'icp' && event.i !== controller)) throw new RevokeProofError('wrong-controller');
188
- const folded = foldLog(controller, log);
189
+ const folded = foldChain(controller, log);
189
190
  if (!folded.ok) {
190
- const detached = /sequence|digest|prior|inception must/.test(folded.reason);
191
+ const detached = isDetachedFoldReason(folded.reason);
191
192
  throw new RevokeProofError(detached ? 'detached' : 'not-authority-signed');
192
193
  }
193
194
  // Drop events that leave the folded state unchanged.
194
195
  const advancing = log.filter((_, index)=>index === 0 || folded.states[index]?.digest !== folded.states[index - 1]?.digest);
195
- const canonical = foldLog(controller, advancing);
196
+ const canonical = foldChain(controller, advancing);
196
197
  if (!canonical.ok) throw new RevokeProofError('not-authority-signed');
197
198
  let resetIndex = -1;
198
199
  for(let index = 1; index < advancing.length; index++){
@@ -208,12 +209,12 @@ export async function removeLapsedLeaves(group) {
208
209
  ...advancing.slice(resetIndex)
209
210
  ];
210
211
  }
211
- const recordedFold = foldLog(controller, recorded);
212
+ const recordedFold = foldChain(controller, recorded);
212
213
  const recordedHead = recordedFold.ok ? recordedFold.states.at(-1) : undefined;
213
214
  const generation = canonical.states.at(-1)?.gen ?? 0;
214
215
  if (recorded.length > 0 && generation > (recordedHead?.gen ?? floor)) throw new RevokeProofError('needs-reset');
215
216
  const start = recorded.length === 0 ? Math.max(1, resetIndex) : 1;
216
- let end = advancing.findIndex(({ event }, index)=>index >= start && event.t === 'rev' && 'x' in event && typeof event.x === 'string' && normalizeDID(event.x) === subject && (canonical.states[index]?.gen ?? 0) >= floor);
217
+ let end = advancing.findIndex((_, index)=>index >= start && revokesSubject(advancing, canonical.states, index, subject) && (canonical.states[index]?.gen ?? 0) >= floor);
217
218
  if (end < 0) {
218
219
  if (generation < floor) throw new RevokeProofError('generation-floor');
219
220
  throw new RevokeProofError('no-rev');
@@ -279,7 +280,7 @@ export async function revokeWithProof(group, params) {
279
280
  const leaves = group.listMembers().map((member)=>{
280
281
  const binding = group.bindingOfDID(member.id);
281
282
  const payload = binding?.capability == null ? undefined : readCapability(binding.capability).payload;
282
- const folded = binding?.prefix == null ? undefined : foldLog(controller, binding.prefix);
283
+ const folded = binding?.prefix == null ? undefined : foldChain(controller, binding.prefix);
283
284
  return {
284
285
  ...member,
285
286
  issuer: payload?.cap == null ? undefined : normalizeDID(payload.iss),
@@ -1,8 +1,9 @@
1
- import { didFromInception, foldLog } from '@kokuin/controller';
1
+ import { didFromInception } from '@kokuin/controller';
2
2
  import { normalizeDID } from '@kokuin/token';
3
3
  import { defaultCredentialTypes, isDefaultCredential, nodeTypes } from 'ts-mls';
4
4
  import { hasHolderEvidence } from './authentication.js';
5
5
  import { readCapability } from './capability.js';
6
+ import { foldChain, isDetachedFoldReason, revokesSubject } from './controller-log.js';
6
7
  import { parseMLSCredentialIdentity } from './credential.js';
7
8
  import { RevokeProofError } from './errors.js';
8
9
  import { controllerLogSize, HISTORY_HORIZON, historySize } from './history.js';
@@ -21,7 +22,7 @@ export { controllerLogSize, HISTORY_HORIZON } from './history.js';
21
22
  if (recorded.length === 0 && proof.length === 0) throw new RevokeProofError('no-rev');
22
23
  for (const signed of proof){
23
24
  const event = signed?.event;
24
- if (event == null || event.t !== 'icp' && event.t !== 'rot' && event.t !== 'rev') {
25
+ if (event == null || event.t !== 'icp' && event.t !== 'rot') {
25
26
  throw new RevokeProofError('not-authority-signed');
26
27
  }
27
28
  if ('cap' in event && event.cap != null) throw new RevokeProofError('not-authority-signed');
@@ -54,9 +55,9 @@ export { controllerLogSize, HISTORY_HORIZON } from './history.js';
54
55
  ...recorded,
55
56
  ...proof
56
57
  ];
57
- const folded = foldLog(controller, log);
58
+ const folded = foldChain(controller, log);
58
59
  if (!folded.ok) {
59
- const detached = folded.reason.includes('sequence') || folded.reason.includes('digest') || folded.reason.includes('prior') || folded.reason.includes('inception must');
60
+ const detached = isDetachedFoldReason(folded.reason);
60
61
  throw new RevokeProofError(detached ? 'detached' : 'not-authority-signed');
61
62
  }
62
63
  for(let index = 1; index < folded.states.length; index++){
@@ -81,14 +82,8 @@ export { controllerLogSize, HISTORY_HORIZON } from './history.js';
81
82
  };
82
83
  }
83
84
  let belowFloor = false;
84
- for(let index = 0; index < log.length; index++){
85
- const event = log[index]?.event;
86
- const state = folded.states[index];
87
- if (event?.t !== 'rev' || !('x' in event) || typeof event.x !== 'string' || state == null) continue;
88
- if (normalizeDID(event.x) !== subject) continue;
89
- if (![
90
- ...state.deny
91
- ].some((did)=>normalizeDID(did) === subject)) continue;
85
+ for (const [index, state] of folded.states.entries()){
86
+ if (!revokesSubject(log, folded.states, index, subject)) continue;
92
87
  if (state.gen < floor) {
93
88
  belowFloor = true;
94
89
  continue;
@@ -150,7 +145,7 @@ export { controllerLogSize, HISTORY_HORIZON } from './history.js';
150
145
  const parentRaw = Array.isArray(parent) ? parent[0] : parent;
151
146
  const issuer = parentRaw == null || capability == null ? undefined : normalizeDID(capability.payload.iss);
152
147
  const attested = parentRaw == null ? capability?.payload.iat : readCapability(parentRaw).payload.iat;
153
- const folded = binding?.prefix == null ? undefined : foldLog(controller, binding.prefix);
148
+ const folded = binding?.prefix == null ? undefined : foldChain(controller, binding.prefix);
154
149
  return {
155
150
  did: normalizeDID(member.id),
156
151
  leafIndex: member.leafIndex,
package/lib/lifecycle.js CHANGED
@@ -1,9 +1,9 @@
1
- import { foldLog } from '@kokuin/controller';
2
1
  import { normalizeDID } from '@kokuin/token';
3
2
  import { defaultCredentialTypes, defaultProposalTypes, isDefaultCredential, isDefaultProposal, nodeTypes } from 'ts-mls';
4
3
  import { LEDGER_HEAD_EXTENSION_TYPE } from './anchor.js';
5
4
  import { checkHolderEvidence, verifyLeafCredential } from './authentication.js';
6
5
  import { assertCapabilityLifetime, MAX_LEAF_LIFETIME, MAX_TRUSTED_GRANT_LIFETIME, readCapability } from './capability.js';
6
+ import { foldChain } from './controller-log.js';
7
7
  import { parseMLSCredentialIdentity } from './credential.js';
8
8
  import { LeafBindingError, LeafLapsedError, RevokeProofError } from './errors.js';
9
9
  import { assertBindingAuthorTime, makeMLSCredential } from './group-credential.js';
@@ -101,7 +101,7 @@ function checkBinding(group, leaf, previous, /** The leaf arrives in a Welcome t
101
101
  const parent = Array.isArray(payload.cap) ? payload.cap[0] : payload.cap;
102
102
  if (parent != null) assertCapabilityLifetime(readCapability(parent).payload, controller == null ? MAX_TRUSTED_GRANT_LIFETIME : group.anchor.trustedGrantLifetime ?? 2_592_000);
103
103
  if (payload.cap != null && denied.has(normalizeDID(payload.iss)) && !(welcome && isEvidencedChild(group, leaf, denied))) throw new LeafBindingError('denied-issuer');
104
- const folded = foldLog(binding.id, binding.prefix);
104
+ const folded = foldChain(binding.id, binding.prefix);
105
105
  if (!folded.ok) throw new LeafBindingError('controller-mismatch');
106
106
  if (controller != null && (folded.states.at(-1)?.gen ?? 0) < (group.registry.controllers.get(normalizeDID(controller))?.genFloor ?? 0)) throw new LeafBindingError('generation-floor');
107
107
  }
@@ -146,7 +146,7 @@ function checkSurvivors(group, tree, registry, origin) {
146
146
  const payload = readCapability(binding.capability).payload;
147
147
  if (payload.cap != null && denied.has(normalizeDID(payload.iss)) && !((origin.kind === 'welcome' || position % 2 === 0 && isUnchangedLeaf(origin.before, position / 2, node.leaf)) && isEvidencedChild(group, node.leaf, denied))) throw new LeafBindingError('denied-issuer');
148
148
  if (controller != null) {
149
- const folded = foldLog(binding.id, binding.prefix);
149
+ const folded = foldChain(binding.id, binding.prefix);
150
150
  if (normalizeDID(binding.id) !== normalizeDID(controller) || !folded.ok) throw new LeafBindingError('controller-mismatch');
151
151
  if ((folded.states.at(-1)?.gen ?? 0) < (registry.controllers.get(normalizeDID(controller))?.genFloor ?? 0)) throw new LeafBindingError('generation-floor');
152
152
  }
@@ -1,8 +1,8 @@
1
- import { foldLog } from '@kokuin/controller';
2
1
  import { encodeMultibase, isVerifiedToken, normalizeDID, stringifyToken, verifyToken } from '@kokuin/token';
3
2
  import { hmac } from '@noble/hashes/hmac.js';
4
3
  import { sha256 } from '@noble/hashes/sha2.js';
5
4
  import { readCapability } from './capability.js';
5
+ import { foldChain } from './controller-log.js';
6
6
  import { openSealedReply, sealToRequest, verifyRecoveryRequest } from './recovery.js';
7
7
  const utf8 = new TextEncoder();
8
8
  const VERDICT_TYPE = 'kumiai.recovery-verdict';
@@ -117,7 +117,7 @@ export function recoverySignerEligible(params) {
117
117
  if (binding?.controller !== controller || binding.capability == null || binding.prefix == null) return false;
118
118
  const payload = readCapability(binding.capability).payload;
119
119
  if (known.devices.get(normalizeDID(signer))?.status === 'revoked' || payload.cap != null && known.devices.get(normalizeDID(payload.iss))?.status === 'revoked') return false;
120
- const folded = foldLog(controller, binding.prefix);
120
+ const folded = foldChain(controller, binding.prefix);
121
121
  const projection = known.controllers.get(normalizeDID(controller));
122
122
  if (!folded.ok || (folded.states.at(-1)?.gen ?? 0) < (projection?.genFloor ?? 0)) return false;
123
123
  let time = projection?.timeFloor ?? 0;
package/lib/registry.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type SignedEvent } from '@kokuin/controller';
1
+ import type { SignedEvent } from '@kokuin/controller';
2
2
  import type { GroupAnchor } from './anchor.js';
3
3
  import type { MLSCredentialIdentity } from './credential.js';
4
4
  import type { FoldDrop, FoldInput } from './fold.js';
package/lib/registry.js CHANGED
@@ -1,5 +1,5 @@
1
- import { foldLog } from '@kokuin/controller';
2
1
  import { normalizeDID } from '@kokuin/token';
2
+ import { foldChain } from './controller-log.js';
3
3
  import { authenticateLifecycleProof } from './lifecycle-proof.js';
4
4
  import { adminCount, ROLE_ENTRY_TYPE, roleReducer } from './roster.js';
5
5
  /** The reserved control type carrying a device-registry mutation. One branch, one namespace slot. */ export const DEVICE_ENTRY_TYPE = 'kumiai.device';
@@ -187,7 +187,7 @@ export function isLifecycleDeviceValue(value) {
187
187
  const record = registry.devices.get(normalizeDID(parsed.id));
188
188
  const binding = parsed.controller;
189
189
  if (record == null || !isResetOnly(record) || binding == null || normalizeDID(binding.id) !== record.controller) return false;
190
- const folded = foldLog(binding.id, binding.prefix);
190
+ const folded = foldChain(binding.id, binding.prefix);
191
191
  return folded.ok && (folded.states.at(-1)?.gen ?? 0) >= (registry.controllers.get(record.controller)?.genFloor ?? 0);
192
192
  }
193
193
  /** The profile a device is bound to in the folded registry, or undefined — the authority input. */ export function controllerOf(registry, deviceDID) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumiai/mls",
3
- "version": "0.10.9",
3
+ "version": "0.11.0",
4
4
  "description": "E2EE group identity and membership for Enkaku using MLS",
5
5
  "keywords": [
6
6
  "mls",
@@ -25,9 +25,9 @@
25
25
  "lib/*"
26
26
  ],
27
27
  "dependencies": {
28
- "@kokuin/capability": "^0.4.2",
29
- "@kokuin/controller": "^0.1.0",
30
- "@kokuin/token": "^0.5.1",
28
+ "@kokuin/capability": "^0.5.1",
29
+ "@kokuin/controller": "^0.2.1",
30
+ "@kokuin/token": "^0.6.1",
31
31
  "@noble/ciphers": "^2.4.0",
32
32
  "@noble/curves": "^2.4.0",
33
33
  "@noble/hashes": "^2.4.0",