v1

latestOpenAPI 3.1.0Apache-2.02026-07-13153158.0 KB
snapshot

Verify and decode a signed snapshot blob

Accepts a base64-encoded snapshot blob previously produced by POST /snapshot/save, verifies its HMAC-SHA256 signature against TENSOR_WASM_API_SNAPSHOT_HMAC_KEY, and returns the HMAC-authenticated provenance (captured tenant, instance id, uncompressed size, wire version).

Hardening: the reader always requires a signature (require_signature) so a stripped-trailer downgrade to an unsigned v2 blob is refused; TENSOR_WASM_API_SNAPSHOT_REQUIRE_SIGNATURE is the operator surface for this posture. A 256 MiB decompression cap bounds restore-time memory pressure.

Authorization: protected stack (bearer auth + tenant scope). After HMAC verification recovers the snapshot's captured tenant, the handler enforces that it equals the caller's resolved tenant — a cross-tenant restore is 403 tenant_scope_denied. A wrong / missing key or a tampered blob is 403 snapshot_signature_invalid (a single opaque rejection, not a decode oracle).

NOTE: this verifies and decodes the snapshot envelope. Reconstituting a live running instance from the captured memory needs an executor restore hook that does not exist yet; requesting that capability surfaces 501 not_implemented.

post/snapshot/restore

Headers

X-TensorWasm-Tenantinteger

Tenant scope (u64). Defaults to 0 if absent. Mandatory when the gateway runs with TENSOR_WASM_API_REQUIRE_TENANT=1.

Request body

snapshot_b64string required

Base64-encoded signed snapshot blob (standard alphabet, padded) previously returned by POST /snapshot/save.

Response

Snapshot signature verified; provenance returned.

tenant_idinteger required

Tenant the snapshot was originally captured for.

instance_idstring required

Instance id stamped into the snapshot metadata at capture time, rendered as the I#<n> display form.

total_uncompressed_bytesinteger required

Total uncompressed payload bytes recorded in the metadata.

versioninteger required

Snapshot wire-format version that verified (3 for the signed envelope this gateway writes).