Skip to content

Checkpoint attestation (EXPERIMENTAL)

EXPERIMENTAL extension seam. HyperToken exposes the generic attestation hand-off described here, but does not include a Witness service, Witness SDK, or dependency on one.

Checkpoint attestation is an application-owned hand-off. The caller creates a commitment, chooses its version, and computes its digest. The caller then passes the resulting commitment reference to engine.attestCheckpoint. A future external adapter (for example, an adapter to a Witness service) might implement CheckpointAttester and attest that reference. The adapter is not part of HyperToken.

Public seam

These are the public TypeScript shapes for the seam. They are exported from the package entry point:

export type CheckpointKind =
  | "checkpoint"
  | "export"
  | "result"
  | "compaction";

export interface CheckpointAttestationRequest {
  digest: string;
  kind: CheckpointKind;
  version: string;
}

export interface CheckpointAttestationResult {
  proofBundle: unknown;
}

export interface CheckpointAttester {
  attest(
    request: CheckpointAttestationRequest,
  ): Promise<CheckpointAttestationResult>;
}

class Engine {
  attestCheckpoint(
    request: CheckpointAttestationRequest,
  ): Promise<CheckpointAttestationResult>;
}

The attester is supplied when constructing the engine:

new Engine({ checkpointAttester?: CheckpointAttester });

version is caller-defined. The caller supplies a lowercase SHA-256 hex digest; the engine validates that format but does not create or hash the commitment. The kind must be one of the four values above and version must be nonempty. Invalid input rejects with InvalidCheckpointAttestationRequestError. If no attester is configured, attestCheckpoint rejects with CheckpointAttesterNotConfiguredError. An attester result is returned to the caller; the engine does not make the proof durable.

On a successful provider call, the engine emits checkpoint:attested. If the provider rejects or throws, it emits checkpoint:attestationFailed and rethrows the provider error. Both events expose only the safe request metadata { digest, kind, version }; they do not expose the proof bundle, provider error details, application state, action payloads, credentials, or private metadata. Validation errors and an unconfigured attester occur before this event path, so neither case emits an attestation success or failure event.

NON-RUNNABLE pseudocode

The following is deliberately NON-RUNNABLE pseudocode. It illustrates the ownership boundary and omits imports and complete setup; helper names are application-defined:

// NON-RUNNABLE PSEUDOCODE — application code owns these operations.
const commitment = application.createCommitment(localCheckpoint);
const request = {
  digest: application.sha256AsLowercaseHex(commitment),
  kind: "checkpoint",
  version: "application-protocol-v1",
};

const attestation = await engine.attestCheckpoint(request);

HyperToken does not create or hash the commitment, game state, or Automerge bytes. It does not persist an attestation proof, send application state or action payloads, send credentials or private metadata, or call this seam automatically when an action is dispatched. The attester receives only the request fields shown above. A caller that needs any other operation must implement and protect it outside this seam.

Security boundary and non-goals

An attestation can bind only what the caller chose to commit to. It does not make the underlying state correct or private. Neither checkpoint attestation nor relay admission provides game-rule validation, player or human identity, peer-key or ECDH binding, secure transport or encrypted sync, room authorization, replay protection or key rotation, or fair play.

TLS/WSS and encrypted sync are separate transport and deployment concerns.