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§
- Restore
Report skippedrepeats the names the snapshot could not restore; they are absent, not stale.- Snapshot
Auth Error - A refused snapshot: the message the kernel result reports.
- Snapshot
Report - 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, thencontent. - verify_
snapshot - Verifies a signed snapshot and returns the sha256 of its content, which the kernel re-checks on read.