@xyo-network/event-kit-statement-graph 2.2.0 → 2.2.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/README.md CHANGED
@@ -60,11 +60,20 @@ already resolved.
60
60
  Published Statement Graph `0.5.3` admits consensus-elevated, subject-bearing
61
61
  Claims and decodes Claim bodies from finalized block carriers while resolving
62
62
  claimed objects and acceptance attachments through the datalake. The Gate 2
63
- live rerun against that release remains the acceptance boundary.
64
-
65
- Statement Graph `0.5.x` uses fold version 4 and scan-checkpoint format 2. Event
66
- Kit's publisher-scoped outer checkpoint is format 3 and binds
67
- `indexedThrough` to the exact canonical XL1 root hash. Only the exact
63
+ live rerun against that release remains historical acceptance evidence.
64
+
65
+ The package depends on Statement Graph `~0.7.1` (peers `^0.7`), resolved to
66
+ `0.7.1`. Finalized replay declares gate profile
67
+ `{ rejectAmbiguousSchemaDeclarations: true, requireBodySchemaEquality: false, revision: 1 }`.
68
+ A checkpoint saved before gate profiles resume without a rescan; the next
69
+ committed range seals that profile. Instances that share a checkpoint store
70
+ upgrade together and must not roll back past a profile-bearing checkpoint: an
71
+ older release loads that checkpoint as corrupt, and recovery discards it and
72
+ rebuilds from the floor.
73
+
74
+ Statement Graph fold version 4 and scan-checkpoint format 2 remain the embedded
75
+ scan contract. Event Kit's publisher-scoped outer checkpoint is format 3 and
76
+ binds `indexedThrough` to the exact canonical XL1 root hash. Only the exact
68
77
  current checkpoint and ordered Event Kit schema policy are accepted. Missing,
69
78
  additional, reordered, or version-suffixed policy entries fail closed as
70
79
  invalid content; no alternative-policy reader or in-place migration exists.
@@ -158,7 +167,9 @@ Statement Graph owns Claim only: it provides structural
158
167
  `{source, subject, hashes}`, no `target`, and no revoke verb. The admission
159
168
  adapter requires Claim `subject` to equal the grant body's publisher. Event Kit
160
169
  negation is an ordinary revocation object under that same publisher subject,
161
- claimed by the authorized controller. See
170
+ claimed by the authorized controller and recognized by the recomputed canonical
171
+ hash, including when the body is missing or the declaration names another
172
+ schema. See
162
173
  [D-003](../../docs/decisions/D-003-STATEMENT-GRAPH-V2-GRANTS.md).
163
174
 
164
175
  ## Evidence boundary
@@ -214,9 +225,10 @@ with `MemoryStatementDataLake`. It is superseded by the passing Statement Graph
214
225
  block after a required body is restored.
215
226
 
216
227
  `pnpm test:live` runs this handshake alongside the existing local-chain head,
217
- admission, and Statement Graph fold specs. All 14 tests pass against xyo-chain
218
- and `apiLocal` `5.3.0`, XL1 SDK/protocol `5.4.0`, and Statement Graph `0.5.0`:
219
- the chain validates elevated Claims and Statement Graph reads each Claim from
220
- its finalized block carrier. The REST service is a test-owned loopback fixture,
228
+ admission, and Statement Graph fold specs. The historical Gate 2 run passed
229
+ 14 tests against xyo-chain and `apiLocal` `5.3.0`, XL1 SDK/protocol `5.4.0`,
230
+ and Statement Graph `0.5.0`: the chain validates elevated Claims and Statement
231
+ Graph reads each Claim from its finalized block carrier. The current pin is
232
+ `0.7.1`. The REST service is a test-owned loopback fixture,
221
233
  not the hosted shared public datalake, so this is not public-stack, Sequence,
222
234
  Mainnet, Proxmox, multi-VM, or production qualification.
@@ -1 +1 @@
1
- {"version":3,"file":"finalizedReplayController.d.ts","sourceRoot":"","sources":["../../src/finalizedReplayController.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAA;AAMnF,OAAO,KAAK,EACV,UAAU,EAEX,MAAM,sCAAsC,CAAA;AAQ7C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAA;AAM7E,OAAO,KAAK,EACV,wBAAwB,EACxB,gCAAgC,EAChC,kBAAkB,EAGnB,MAAM,uBAAuB,CAAA;AAO9B,MAAM,WAAW,6BAA6B;IAC5C,yEAAyE;IACzE,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;IACxB,oFAAoF;IACpF,IAAI,CAAC,UAAU,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,C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AAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CACvC;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,kCAAkC;IACjD,+FAA+F;IAC/F,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAC9B;AAED,MAAM,WAAW,iCAAiC;IAChD,6EAA6E;IAC7E,MAAM,IAAI,QAAQ,CAAC,6BAA6B,CAAC,GAAG,IAAI,CAAA;IACxD,8FAA8F;IAC9F,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAA;IACjE,QAAQ,IAAI,QAAQ,CAAC,wBAAwB,CAAC,CAAA;IAC9C,MAAM,IAAI,6BAA6B,CAAA;IACvC,yFAAyF;IACzF,IAAI,CAAC,OAAO,CAAC,EAAE,kCAAkC,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAA;IAC1F,sFAAsF;IACtF,MAAM,IAAI,oBAAoB,CAAA;CAC/B;AAqaD,wBAAsB,uCAAuC,CAC3D,UAAU,EAAE,8BAA8B,GACzC,OAAO,CAAC,iCAAiC,CAAC,CAqC5C;AAED,uFAAuF;AACvF,wBAAgB,yCAAyC,CACvD,OAAO,CAAC,EAAE,OAAO,GAChB,6BAA6B,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,wBAAwB,EAAE,CAAA;CAAE,CAWzF"}
@@ -1,4 +1,4 @@
1
- import type { PublisherEncryptionKeyLifecycle, PublisherServiceLifecycleRevision } from '@xyo-network/event-kit-protocol';
1
+ import type { PublisherEncryptionKeyLifecycle, PublisherServiceLifecycleRevision, RecomputableRevocationKind } from '@xyo-network/event-kit-protocol';
2
2
  import type { PublisherEncryptionKey, PublisherService } from '@xyo-network/event-kit-schemas';
3
3
  import type { StatementGraphViewer } from '@xyo-network/xl1-statement-graph-engine';
4
4
  import type { AppliedEventRecord } from '@xyo-network/xl1-statement-graph-schemas';
@@ -29,12 +29,12 @@ export declare function parsedHandshakeObjects<T>(viewer: StatementGraphViewer,
29
29
  } | {
30
30
  readonly success: false;
31
31
  }): Promise<ClaimedHandshakeObject<T>[]>;
32
- export declare function handshakeRevocations(viewer: StatementGraphViewer, records: readonly AppliedEventRecord[], parse: (value: unknown) => {
33
- readonly data: Record<string, string>;
34
- readonly success: true;
35
- } | {
36
- readonly success: false;
37
- }, field: string): Promise<{
32
+ /**
33
+ * Revocations recognized by Claim membership of the recomputed canonical hash.
34
+ * Declared schema and body resolution are not consulted. `source` is the only
35
+ * party allowed to negate these targets.
36
+ */
37
+ export declare function hashMatchedRevocations(viewer: StatementGraphViewer, source: string, subject: string, kind: RecomputableRevocationKind, targets: readonly string[]): Promise<{
38
38
  block: number;
39
39
  target: string;
40
40
  }[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"handshakeCatalog.d.ts","sourceRoot":"","sources":["../../src/handshakeCatalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,+BAA+B,EAC/B,iCAAiC,EAClC,MAAM,iCAAiC,CAAA;AAKxC,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,gCAAgC,CAAA;AAiBvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAA;AACnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAA;AAElF,OAAO,KAAK,EACV,sBAAsB,EACtB,iCAAiC,EACjC,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EAE1B,MAAM,8BAA8B,CAAA;AAErC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EA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,EAAE,0BAA0B,EAChC,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAS9C;AAqBD,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,oBAAoB,EAC5B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,iBAAiB,CAAC,CAqE5B;AA0BD,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,EACjD,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,GACpB,OAAO,CAST;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,EACjD,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GACpB,OAAO,CAST;AAcD,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,iCAAiC,EAC1C,QAAQ,EAAE,uBAAuB,GAChC,OAAO,CAAC,yBAAyB,CAAC,CA2EpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"handshakeReadModel.d.ts","sourceRoot":"","sources":["../../src/handshakeReadModel.ts"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAEV,0BAA0B,EAC1B,iCAAiC,EAWlC,MAAM,8BAA8B,CAAA;AAwZrC,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,iCAAiC,GACzC,0BAA0B,CA2D5B"}
1
+ {"version":3,"file":"handshakeReadModel.d.ts","sourceRoot":"","sources":["../../src/handshakeReadModel.ts"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAEV,0BAA0B,EAC1B,iCAAiC,EAWlC,MAAM,8BAA8B,CAAA;AAyYrC,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,iCAAiC,GACzC,0BAA0B,CA2D5B"}
@@ -223,7 +223,7 @@ import {
223
223
  ChainIdZod as ChainIdZod3,
224
224
  normalizeAddress as normalizeAddress3,
225
225
  NormalizedAddressZod as NormalizedAddressZod3,
226
- WakeSubscriptionAcceptanceSchema as WakeSubscriptionAcceptanceSchema2,
226
+ WakeSubscriptionAcceptanceSchema as WakeSubscriptionAcceptanceSchema3,
227
227
  WakeSubscriptionAcceptanceZod
228
228
  } from "@xyo-network/event-kit-schemas";
229
229
  import { STATEMENT_FOLD_VERSION as STATEMENT_FOLD_VERSION2 } from "@xyo-network/xl1-statement-graph-schemas";
@@ -295,6 +295,74 @@ async function requireCurrentReplayChain(chain, finalizedHead, chainId) {
295
295
  }
296
296
  }
297
297
 
298
+ // src/recomputableRevocation.ts
299
+ import {
300
+ recomputableRevocationHash
301
+ } from "@xyo-network/event-kit-protocol";
302
+ import {
303
+ EncryptedWakeSubscriptionSchema as EncryptedWakeSubscriptionSchema2,
304
+ PublisherEncryptionKeySchema as PublisherEncryptionKeySchema2,
305
+ PublisherServiceSchema as PublisherServiceSchema2,
306
+ WakeGrantObjectSchema as WakeGrantObjectSchema2,
307
+ WakeSubscriptionAcceptanceSchema as WakeSubscriptionAcceptanceSchema2
308
+ } from "@xyo-network/event-kit-schemas";
309
+ var targetKindBySchema = {
310
+ [EncryptedWakeSubscriptionSchema2]: "subscription",
311
+ [PublisherEncryptionKeySchema2]: "key",
312
+ [PublisherServiceSchema2]: "service",
313
+ [WakeGrantObjectSchema2]: "grant",
314
+ [WakeSubscriptionAcceptanceSchema2]: "acceptance"
315
+ };
316
+ function knownRevocationTargets(records, bodyFor) {
317
+ const targets = /* @__PURE__ */ new Map();
318
+ for (const record of records) {
319
+ const body = bodyFor(record.objectHash);
320
+ if (body === void 0 || typeof body.schema !== "string" || body.schema !== record.objectSchema) continue;
321
+ const kind = targetKindBySchema[body.schema];
322
+ if (kind === void 0) continue;
323
+ const hashes = targets.get(kind) ?? /* @__PURE__ */ new Set();
324
+ hashes.add(record.objectHash);
325
+ targets.set(kind, hashes);
326
+ }
327
+ return targets;
328
+ }
329
+ function mergedRevocationTargets(prior, block) {
330
+ const merged = /* @__PURE__ */ new Map();
331
+ absorbRevocationTargets(merged, prior);
332
+ absorbRevocationTargets(merged, block);
333
+ return merged;
334
+ }
335
+ function absorbRevocationTargets(into, from) {
336
+ for (const [kind, hashes] of from) {
337
+ const existing = into.get(kind) ?? /* @__PURE__ */ new Set();
338
+ for (const hash of hashes) existing.add(hash);
339
+ into.set(kind, existing);
340
+ }
341
+ }
342
+ function objectHashesBlockingReplay(applied, bodyFor, allowedRevocations) {
343
+ const mismatched = [];
344
+ const missing = [];
345
+ const seen = /* @__PURE__ */ new Set();
346
+ for (const record of applied) {
347
+ if (seen.has(record.objectHash)) continue;
348
+ seen.add(record.objectHash);
349
+ if (allowedRevocations.has(record.objectHash)) continue;
350
+ const body = bodyFor(record.objectHash);
351
+ if (body === void 0) missing.push(record.objectHash);
352
+ else if (body.schema !== record.objectSchema) mismatched.push(record.objectHash);
353
+ }
354
+ return { mismatched, missing };
355
+ }
356
+ async function knownRevocationHashes(targets) {
357
+ const hashes = /* @__PURE__ */ new Set();
358
+ for (const [kind, objectHashes] of targets) {
359
+ for (const objectHash of objectHashes) {
360
+ hashes.add(await recomputableRevocationHash(kind, objectHash));
361
+ }
362
+ }
363
+ return hashes;
364
+ }
365
+
298
366
  // src/replayCheckpoint.ts
299
367
  import { HashZod as HashZod3 } from "@ariestools/sdk";
300
368
  import {
@@ -306,14 +374,21 @@ import {
306
374
  AppliedEventRecordZod,
307
375
  BlockNumberZod,
308
376
  STATEMENT_FOLD_VERSION,
377
+ STRICT_GATE_REVISION,
309
378
  UnresolvedEventReferenceZod
310
379
  } from "@xyo-network/xl1-statement-graph-schemas";
311
380
  import {
312
381
  assembleCheckpointRecords,
382
+ gateProfileMismatch,
313
383
  StatementScanCheckpointZod
314
384
  } from "@xyo-network/xl1-statement-graph-sdk";
315
385
  import { z } from "zod";
316
386
  var EVENT_KIT_REPLAY_CHECKPOINT_VERSION = 3;
387
+ var EVENT_KIT_REPLAY_GATE_PROFILE = Object.freeze({
388
+ rejectAmbiguousSchemaDeclarations: true,
389
+ requireBodySchemaEquality: false,
390
+ revision: STRICT_GATE_REVISION
391
+ });
317
392
  var ResolvedReplayBodyZod = z.strictObject({
318
393
  body: z.record(z.string(), z.unknown()),
319
394
  hash: HashZod3
@@ -453,7 +528,7 @@ function bodySetIntegrityError(checkpoint) {
453
528
  }
454
529
  return void 0;
455
530
  }
456
- function appliedIntegrityError(checkpoint) {
531
+ function appliedIntegrityError(checkpoint, allowedRevocations) {
457
532
  const { indexedThrough } = checkpoint;
458
533
  const bodyByHash = new Map(checkpoint.bodies.map((entry) => [entry.hash, entry]));
459
534
  const appliedIdentities = /* @__PURE__ */ new Set();
@@ -489,8 +564,10 @@ function appliedIntegrityError(checkpoint) {
489
564
  }
490
565
  eventLocations.set(eventKey3, location);
491
566
  const body = bodyByHash.get(event.objectHash)?.body;
492
- if (body === void 0) return `applied object body ${event.objectHash} is missing`;
493
- if (body.schema !== event.objectSchema) {
567
+ const recomputableRevocation = allowedRevocations.has(event.objectHash);
568
+ if (body === void 0) {
569
+ if (!recomputableRevocation) return `applied object body ${event.objectHash} is missing`;
570
+ } else if (body.schema !== event.objectSchema && !recomputableRevocation) {
494
571
  return `applied object ${event.objectHash} schema ${String(body.schema)} != ${event.objectSchema}`;
495
572
  }
496
573
  }
@@ -539,15 +616,16 @@ function scanIntegrityError(checkpoint) {
539
616
  if (!sameClaimRecords(actualRecords, expectedClaimRecords(checkpoint.applied))) {
540
617
  return "scan claim records differ from applied-event history";
541
618
  }
542
- return scan.watermark !== void 0 && scan.watermark.block > indexedThrough ? `scan watermark block ${scan.watermark.block} exceeds indexedThrough ${indexedThrough}` : watermarkIntegrityError(checkpoint);
619
+ return scan.watermark !== void 0 && scan.watermark.block > indexedThrough ? `scan watermark block ${scan.watermark.block} exceeds indexedThrough ${indexedThrough}` : watermarkIntegrityError(checkpoint, assembled.records);
543
620
  }
544
- function watermarkIntegrityError(checkpoint) {
621
+ function watermarkIntegrityError(checkpoint, records) {
545
622
  const scan = checkpoint.scan;
546
623
  if (scan === null) return void 0;
547
624
  const { watermark, watermarkGroupEventKeys } = scan;
548
625
  if (watermark === void 0) {
549
626
  if (checkpoint.applied.length > 0) return "scan watermark is missing for applied-event history";
550
- return watermarkGroupEventKeys.length === 0 ? void 0 : "scan has group event keys without a watermark";
627
+ if (watermarkGroupEventKeys.length > 0) return "scan has group event keys without a watermark";
628
+ return records.length === 0 ? void 0 : "scan has claim records without a watermark";
551
629
  }
552
630
  if (watermark.block < checkpoint.floorBlock) {
553
631
  return `scan watermark block ${watermark.block} precedes floorBlock ${checkpoint.floorBlock}`;
@@ -579,8 +657,18 @@ function blockedIntegrityError(checkpoint) {
579
657
  }
580
658
  return blocked.unresolvedEvents.some((event) => event.block !== blocked.atBlock) ? "blocked unresolved event does not belong to blocked block" : void 0;
581
659
  }
582
- function checkpointIntegrityError(checkpoint) {
583
- return progressIntegrityError(checkpoint) ?? bodySetIntegrityError(checkpoint) ?? appliedIntegrityError(checkpoint) ?? scanIntegrityError(checkpoint) ?? blockedIntegrityError(checkpoint);
660
+ function checkpointIntegrityError(checkpoint, allowedRevocations) {
661
+ return progressIntegrityError(checkpoint) ?? bodySetIntegrityError(checkpoint) ?? appliedIntegrityError(checkpoint, allowedRevocations) ?? scanIntegrityError(checkpoint) ?? blockedIntegrityError(checkpoint);
662
+ }
663
+ async function allowedRevocationHashes(checkpoint) {
664
+ const bodies = new Map(checkpoint.bodies.map((entry) => [entry.hash, entry.body]));
665
+ return await knownRevocationHashes(knownRevocationTargets(
666
+ checkpoint.applied,
667
+ (hash) => bodies.get(hash)
668
+ ));
669
+ }
670
+ function gateProfileIdentityError(checkpoint) {
671
+ return checkpoint.scan === null ? void 0 : gateProfileMismatch(checkpoint.scan.contract.gateProfile, EVENT_KIT_REPLAY_GATE_PROFILE);
584
672
  }
585
673
  async function persistedBodyIntegrityError(checkpoint) {
586
674
  for (const entry of checkpoint.bodies) {
@@ -615,8 +703,10 @@ async function loadEventKitReplayCheckpoint(value, identity) {
615
703
  if (mismatch !== void 0) return { detail: mismatch, status: "identity-mismatch" };
616
704
  const bodyIntegrityError = await persistedBodyIntegrityError(checkpoint);
617
705
  if (bodyIntegrityError !== void 0) return { detail: bodyIntegrityError, status: "corrupt" };
618
- const integrityError = checkpointIntegrityError(checkpoint);
619
- return integrityError === void 0 ? { checkpoint, status: "valid" } : { detail: integrityError, status: "corrupt" };
706
+ const integrityError = checkpointIntegrityError(checkpoint, await allowedRevocationHashes(checkpoint));
707
+ if (integrityError !== void 0) return { detail: integrityError, status: "corrupt" };
708
+ const profileError = gateProfileIdentityError(checkpoint);
709
+ return profileError === void 0 ? { checkpoint, status: "valid" } : { detail: profileError, status: "identity-mismatch" };
620
710
  }
621
711
 
622
712
  // src/finalizedReplayController.ts
@@ -653,6 +743,7 @@ function replayContract(options, throughBlock) {
653
743
  eventBodyCorpus: { sourceId: options.sourceId },
654
744
  floorBlock: options.floorBlock,
655
745
  foldVersion: STATEMENT_FOLD_VERSION2,
746
+ gateProfile: EVENT_KIT_REPLAY_GATE_PROFILE,
656
747
  indexedSchemaPolicy: { foldedObjectSchemas: [...EventKitClaimedObjectSchemas] },
657
748
  network: options.network,
658
749
  throughBlock
@@ -714,17 +805,17 @@ function mergeBodies(existing, additions) {
714
805
  }
715
806
  return merged.entries().map(([hash, body]) => ({ body, hash: HashZod4.parse(hash) })).toArray().toSorted((left, right) => left.hash.localeCompare(right.hash));
716
807
  }
717
- async function stageAppliedBlock(options, applied) {
808
+ async function stageAppliedBlock(options, priorTargets, applied) {
718
809
  const appliedObjectHashes = uniqueStrings(applied.map((record) => record.objectHash));
719
810
  const objects = await resolveVerifiedBodies(options.bodies, appliedObjectHashes);
720
- const missingObjects = appliedObjectHashes.filter((hash) => !objects.bodies.has(hash));
721
- const schemaMismatchedObjects = uniqueStrings(applied.flatMap((record) => {
722
- const body = objects.bodies.get(record.objectHash);
723
- return body !== void 0 && body.schema !== record.objectSchema ? [record.objectHash] : [];
724
- }));
811
+ const allowedRevocations = await knownRevocationHashes(mergedRevocationTargets(
812
+ priorTargets,
813
+ knownRevocationTargets(applied, (hash) => objects.bodies.get(hash))
814
+ ));
815
+ const blocking = objectHashesBlockingReplay(applied, (hash) => objects.bodies.get(hash), allowedRevocations);
725
816
  const acceptanceAttachments = [];
726
817
  for (const record of applied) {
727
- if (normalizeAddress3(record.source) !== options.publisher || record.objectSchema !== WakeSubscriptionAcceptanceSchema2) continue;
818
+ if (normalizeAddress3(record.source) !== options.publisher || record.objectSchema !== WakeSubscriptionAcceptanceSchema3) continue;
728
819
  const acceptance = WakeSubscriptionAcceptanceZod.safeParse(objects.bodies.get(record.objectHash));
729
820
  if (acceptance.success) acceptanceAttachments.push(acceptance.data.challenge, acceptance.data.response);
730
821
  }
@@ -736,8 +827,8 @@ async function stageAppliedBlock(options, applied) {
736
827
  ...attachments.corrupt
737
828
  ]);
738
829
  const objectHashes = uniqueStrings([
739
- ...missingObjects,
740
- ...schemaMismatchedObjects,
830
+ ...blocking.missing,
831
+ ...blocking.mismatched,
741
832
  ...missingAttachments
742
833
  ]).map((hash) => HashZod4.parse(hash));
743
834
  return {
@@ -787,10 +878,13 @@ async function stageRange(options, prior, fromBlock, throughBlock, signal) {
787
878
  ...unresolvedByBlock.keys()
788
879
  ]);
789
880
  const relevantBlocks = relevant.values().toArray().toSorted((left, right) => left - right);
881
+ const priorBodies = new Map(prior.bodies.map((entry) => [entry.hash, entry.body]));
882
+ const knownTargets = knownRevocationTargets(prior.applied, (hash) => priorBodies.get(hash));
790
883
  const bodies = /* @__PURE__ */ new Map();
791
884
  for (const block of relevantBlocks) {
792
885
  signal?.throwIfAborted();
793
- const staged = await stageAppliedBlock(options, appliedByBlock.get(block) ?? []);
886
+ const blockApplied = appliedByBlock.get(block) ?? [];
887
+ const staged = await stageAppliedBlock(options, knownTargets, blockApplied);
794
888
  for (const [hash, body] of staged.bodies) bodies.set(hash, body);
795
889
  const unresolvedEvents = unresolvedByBlock.get(block) ?? [];
796
890
  if (unresolvedEvents.length > 0 || staged.objectHashes.length > 0 || staged.corrupt.length > 0) {
@@ -807,6 +901,7 @@ async function stageRange(options, prior, fromBlock, throughBlock, signal) {
807
901
  throughHash
808
902
  };
809
903
  }
904
+ absorbRevocationTargets(knownTargets, knownRevocationTargets(blockApplied, (hash) => staged.bodies.get(hash)));
810
905
  }
811
906
  return {
812
907
  applied,
@@ -1042,42 +1137,34 @@ function toGrantObject(record) {
1042
1137
 
1043
1138
  // src/handshakeReadModel.ts
1044
1139
  import {
1045
- EncryptedWakeSubscriptionSchema as EncryptedWakeSubscriptionSchema2,
1140
+ EncryptedWakeSubscriptionSchema as EncryptedWakeSubscriptionSchema3,
1046
1141
  EncryptedWakeSubscriptionZod,
1047
1142
  EndpointChallengeResponseZod,
1048
1143
  EndpointChallengeZod,
1049
1144
  HandshakeIdZod,
1050
1145
  hasMatchingHandshakeProfile,
1051
1146
  NormalizedAddressZod as NormalizedAddressZod5,
1052
- PublisherServiceSchema as PublisherServiceSchema3,
1053
- WakeGrantObjectSchema as WakeGrantObjectSchema2,
1147
+ PublisherServiceSchema as PublisherServiceSchema4,
1148
+ WakeGrantObjectSchema as WakeGrantObjectSchema3,
1054
1149
  WakeGrantObjectZod,
1055
- WakeGrantRevocationSchema as WakeGrantRevocationSchema2,
1056
- WakeGrantRevocationZod,
1057
- WakeSubscriptionAcceptanceRevocationSchema as WakeSubscriptionAcceptanceRevocationSchema2,
1058
- WakeSubscriptionAcceptanceRevocationZod,
1059
- WakeSubscriptionAcceptanceSchema as WakeSubscriptionAcceptanceSchema3,
1060
- WakeSubscriptionAcceptanceZod as WakeSubscriptionAcceptanceZod2,
1061
- WakeSubscriptionRevocationSchema as WakeSubscriptionRevocationSchema2,
1062
- WakeSubscriptionRevocationZod
1150
+ WakeSubscriptionAcceptanceSchema as WakeSubscriptionAcceptanceSchema4,
1151
+ WakeSubscriptionAcceptanceZod as WakeSubscriptionAcceptanceZod2
1063
1152
  } from "@xyo-network/event-kit-schemas";
1064
1153
  import { XyoAddressZod as XyoAddressZod3 } from "@xyo-network/sdk-protocol/address";
1065
1154
 
1066
1155
  // src/handshakeCatalog.ts
1156
+ import { HashZod as HashZod6 } from "@ariestools/sdk";
1067
1157
  import {
1158
+ recomputableRevocationHash as recomputableRevocationHash2,
1068
1159
  resolvePreferredEncryptionKey,
1069
1160
  selectPublisherService
1070
1161
  } from "@xyo-network/event-kit-protocol";
1071
1162
  import {
1072
1163
  ChainIdZod as ChainIdZod4,
1073
1164
  NormalizedAddressZod as NormalizedAddressZod4,
1074
- PublisherEncryptionKeyRevocationSchema as PublisherEncryptionKeyRevocationSchema2,
1075
- PublisherEncryptionKeyRevocationZod,
1076
- PublisherEncryptionKeySchema as PublisherEncryptionKeySchema2,
1165
+ PublisherEncryptionKeySchema as PublisherEncryptionKeySchema3,
1077
1166
  PublisherEncryptionKeyZod,
1078
- PublisherServiceRevocationSchema as PublisherServiceRevocationSchema2,
1079
- PublisherServiceRevocationZod,
1080
- PublisherServiceSchema as PublisherServiceSchema2,
1167
+ PublisherServiceSchema as PublisherServiceSchema3,
1081
1168
  PublisherServiceZod,
1082
1169
  SOURCE_WAKE_EVENT_KIND as SOURCE_WAKE_EVENT_KIND2
1083
1170
  } from "@xyo-network/event-kit-schemas";
@@ -1146,39 +1233,53 @@ async function parsedHandshakeObjects(viewer, records, parse) {
1146
1233
  }
1147
1234
  return objects;
1148
1235
  }
1149
- async function handshakeRevocations(viewer, records, parse, field) {
1236
+ var LegacyHexAddress3 = /^[A-Fa-f0-9]{40}$/;
1237
+ function sameAddress(left, right) {
1238
+ const normalizedLeft = LegacyHexAddress3.test(left) ? left.toLowerCase() : left;
1239
+ const normalizedRight = LegacyHexAddress3.test(right) ? right.toLowerCase() : right;
1240
+ return normalizedLeft === normalizedRight;
1241
+ }
1242
+ async function hashMatchedRevocations(viewer, source, subject, kind, targets) {
1243
+ const sourceAddress = XyoAddressZod2.parse(source);
1244
+ const subjectAddress = XyoAddressZod2.parse(subject);
1150
1245
  const result = [];
1151
- for (const record of earliestByHash(records)) {
1152
- const parsed = parse(await verifiedHandshakeObjectBody(viewer, record));
1153
- if (parsed.success && typeof parsed.data[field] === "string") {
1154
- result.push({ block: record.block, target: parsed.data[field] });
1155
- }
1246
+ for (const target of targets) {
1247
+ const block = await revocationClaimBlock(viewer, sourceAddress, subjectAddress, kind, target);
1248
+ if (block !== void 0) result.push({ block, target });
1156
1249
  }
1157
1250
  return result;
1158
1251
  }
1252
+ async function revocationClaimBlock(viewer, source, subject, kind, target) {
1253
+ const objectHash = HashZod6.parse(await recomputableRevocationHash2(kind, target));
1254
+ const claims = await viewer.claims(source, { objectHash, subject });
1255
+ const blocks = claims.filter((claim) => claim.objectHash === objectHash && sameAddress(claim.source, source) && sameAddress(claim.subject, subject) && Number.isSafeInteger(claim.firstBlock) && claim.firstBlock >= 0).map((claim) => claim.firstBlock);
1256
+ return blocks.length === 0 ? void 0 : Math.min(...blocks);
1257
+ }
1159
1258
  async function buildHandshakeCatalogs(viewer, publisher) {
1160
1259
  const events = await viewer.events(XyoAddressZod2.parse(publisher));
1161
1260
  const services = await parsedHandshakeObjects(
1162
1261
  viewer,
1163
- events.filter((record) => record.objectSchema === PublisherServiceSchema2 || record.objectSchema === PublisherServiceSchema2),
1262
+ events.filter((record) => record.objectSchema === PublisherServiceSchema3 || record.objectSchema === PublisherServiceSchema3),
1164
1263
  (value) => PublisherServiceZod.safeParse(value)
1165
1264
  );
1166
1265
  const keys = await parsedHandshakeObjects(
1167
1266
  viewer,
1168
- events.filter((record) => record.objectSchema === PublisherEncryptionKeySchema2),
1267
+ events.filter((record) => record.objectSchema === PublisherEncryptionKeySchema3),
1169
1268
  (value) => PublisherEncryptionKeyZod.safeParse(value)
1170
1269
  );
1171
- const serviceRevocations = await handshakeRevocations(
1270
+ const serviceRevocations = await hashMatchedRevocations(
1172
1271
  viewer,
1173
- events.filter((record) => record.objectSchema === PublisherServiceRevocationSchema2),
1174
- (value) => PublisherServiceRevocationZod.safeParse(value),
1175
- "service"
1272
+ publisher,
1273
+ publisher,
1274
+ "service",
1275
+ services.map((service) => service.objectHash)
1176
1276
  );
1177
- const keyRevocations = await handshakeRevocations(
1277
+ const keyRevocations = await hashMatchedRevocations(
1178
1278
  viewer,
1179
- events.filter((record) => record.objectSchema === PublisherEncryptionKeyRevocationSchema2),
1180
- (value) => PublisherEncryptionKeyRevocationZod.safeParse(value),
1181
- "key"
1279
+ publisher,
1280
+ publisher,
1281
+ "key",
1282
+ keys.map((key) => key.objectHash)
1182
1283
  );
1183
1284
  const serviceByHash = new Map(services.map((service) => {
1184
1285
  const revokedAtBlock = firstHandshakeRevocation(serviceRevocations, service.objectHash);
@@ -1351,9 +1452,9 @@ async function discoverHandshakeService(options, rawQuery) {
1351
1452
  }
1352
1453
 
1353
1454
  // src/publisherSubjectViewer.ts
1354
- var LegacyHexAddress3 = /^[A-Fa-f0-9]{40}$/;
1455
+ var LegacyHexAddress4 = /^[A-Fa-f0-9]{40}$/;
1355
1456
  function normalizeAddress4(value) {
1356
- return LegacyHexAddress3.test(value) ? value.toLowerCase() : value;
1457
+ return LegacyHexAddress4.test(value) ? value.toLowerCase() : value;
1357
1458
  }
1358
1459
  function isPublisherSubject(subject, publisher) {
1359
1460
  return normalizeAddress4(subject) === normalizeAddress4(publisher);
@@ -1502,26 +1603,10 @@ function hasExactKeyBinding(subscription, service, catalogs, tupleBlock) {
1502
1603
  function expiryIsInsideServicePolicy(subscription, service, tupleBlock) {
1503
1604
  return subscription.expiresAtBlock > tupleBlock && subscription.expiresAtBlock <= tupleBlock + service.limits.maxSubscriptionLifetimeBlocks;
1504
1605
  }
1505
- async function tupleRevocations(viewer, records) {
1506
- return {
1507
- grants: await handshakeRevocations(
1508
- viewer,
1509
- records.filter((record) => record.objectSchema === WakeGrantRevocationSchema2),
1510
- (value) => WakeGrantRevocationZod.safeParse(value),
1511
- "grant"
1512
- ),
1513
- subscriptions: await handshakeRevocations(
1514
- viewer,
1515
- records.filter((record) => record.objectSchema === WakeSubscriptionRevocationSchema2),
1516
- (value) => WakeSubscriptionRevocationZod.safeParse(value),
1517
- "subscription"
1518
- )
1519
- };
1520
- }
1521
- async function validateTuple(viewer, records, subscriber, service, catalogs, chainId, publisher, sourceEvents) {
1522
- const serviceEntries = records.filter((record) => record.objectSchema === PublisherServiceSchema3 || record.objectSchema === PublisherServiceSchema3);
1523
- const grantEntries = records.filter((record) => record.objectSchema === WakeGrantObjectSchema2);
1524
- const subscriptionEntries = records.filter((record) => record.objectSchema === EncryptedWakeSubscriptionSchema2 || record.objectSchema === EncryptedWakeSubscriptionSchema2);
1606
+ async function validateTuple(viewer, records, subscriber, service, catalogs, chainId, publisher) {
1607
+ const serviceEntries = records.filter((record) => record.objectSchema === PublisherServiceSchema4 || record.objectSchema === PublisherServiceSchema4);
1608
+ const grantEntries = records.filter((record) => record.objectSchema === WakeGrantObjectSchema3);
1609
+ const subscriptionEntries = records.filter((record) => record.objectSchema === EncryptedWakeSubscriptionSchema3 || record.objectSchema === EncryptedWakeSubscriptionSchema3);
1525
1610
  const baseEvidence = handshakeEventEvidence(records[0]);
1526
1611
  const reject = (reason) => ({
1527
1612
  rejection: {
@@ -1555,7 +1640,16 @@ async function validateTuple(viewer, records, subscriber, service, catalogs, cha
1555
1640
  if (!exactHandshakeServiceAt(catalogs, service, publisher, tupleBlock)) return reject("service-inactive-at-claim");
1556
1641
  if (!hasExactKeyBinding(subscription, service, catalogs, tupleBlock)) return reject("key-binding-invalid");
1557
1642
  if (!expiryIsInsideServicePolicy(subscription, service.body, tupleBlock)) return reject("expiry-out-of-policy");
1558
- const revoked = await tupleRevocations(viewer, sourceEvents);
1643
+ const revoked = {
1644
+ grants: await hashMatchedRevocations(viewer, subscriber, publisher, "grant", [grantRecord.objectHash]),
1645
+ subscriptions: await hashMatchedRevocations(
1646
+ viewer,
1647
+ subscriber,
1648
+ publisher,
1649
+ "subscription",
1650
+ [subscriptionRecord.objectHash]
1651
+ )
1652
+ };
1559
1653
  const subscriptionRevokedAtBlock = firstHandshakeRevocation(revoked.subscriptions, subscriptionRecord.objectHash);
1560
1654
  const grantRevokedAtBlock = firstHandshakeRevocation(revoked.grants, grantRecord.objectHash);
1561
1655
  return {
@@ -1614,8 +1708,7 @@ async function discoverTuples(viewer, services, catalogs, query, candidateSource
1614
1708
  service,
1615
1709
  catalogs,
1616
1710
  query.chainId,
1617
- query.publisher,
1618
- events
1711
+ query.publisher
1619
1712
  );
1620
1713
  if (result.rejection !== void 0) rejections.push(result.rejection);
1621
1714
  if (result.tuple !== void 0) {
@@ -1638,14 +1731,15 @@ async function validatedAcceptances(options, catalogs, tuples, chainId, publishe
1638
1731
  const events = (await options.viewer.events(publisherAddress, { subject: publisherAddress })).filter((record) => isPublisherSubject(record.source, publisherAddress) && isPublisherSubject(record.subject, publisherAddress));
1639
1732
  const acceptances = await parsedHandshakeObjects(
1640
1733
  options.viewer,
1641
- events.filter((record) => record.objectSchema === WakeSubscriptionAcceptanceSchema3),
1734
+ events.filter((record) => record.objectSchema === WakeSubscriptionAcceptanceSchema4),
1642
1735
  (value) => WakeSubscriptionAcceptanceZod2.safeParse(value)
1643
1736
  );
1644
- const acceptanceRevocations = await handshakeRevocations(
1737
+ const acceptanceRevocations = await hashMatchedRevocations(
1645
1738
  options.viewer,
1646
- events.filter((record) => record.objectSchema === WakeSubscriptionAcceptanceRevocationSchema2),
1647
- (value) => WakeSubscriptionAcceptanceRevocationZod.safeParse(value),
1648
- "acceptance"
1739
+ publisher,
1740
+ publisher,
1741
+ "acceptance",
1742
+ acceptances.map((claimed) => claimed.objectHash)
1649
1743
  );
1650
1744
  const result = [];
1651
1745
  for (const claimed of acceptances) {