Skip to main content

Module snapshot

Module snapshot 

Source
Expand description

Host-side snapshot authentication (port of snapshot-auth.ts) and the kernel’s snapshot/restore reports (KernelSnapshotReport / KernelRestoreReport of kernel.ts).

The key lives only in the host: the Python kernel runs model-written code, so any key it held could be read by that code. The host signs a snapshot after the kernel writes it and verifies the signature before the kernel may read it. Signed file: one signature line, then the kernel’s content (sha256 header line + JSON body): {"format":"ultron-rlm-snapshot-signature","version":1,"alg":"HMAC-SHA256","hmac":"<hex>"}\n<content>; the HMAC covers the content bytes exactly.

Structs§

RestoreReport
skipped repeats the names the snapshot could not restore; they are absent, not stale.
SnapshotAuthError
A refused snapshot: the message the kernel result reports.
SnapshotReport
Names are saved only as constrained data; every other user name is listed with a reason.

Constants§

SNAPSHOT_ERROR_NAME
The error name kernel.ts gives refused snapshots (SnapshotAuthenticationError.name).
SNAPSHOT_KEY_FILE

Functions§

load_or_create_snapshot_key
Reads the per-profile snapshot key <agent_dir>/rlm-snapshot.key, creating it once (0600, random) when absent.
process_snapshot_key
Fallback for kernels built without a profile key: snapshots are then restorable only within this process.
sign_snapshot
The signed file: a signature line over content, then content.
verify_snapshot
Verifies a signed snapshot and returns the sha256 of its content, which the kernel re-checks on read.