Write a new backup's ways in with one operation (roadmap 9.3) - #228
Merged
404SecNotFound merged 1 commit intoSep 28, 2026
Conversation
Roadmap 9.3. Creating a backup with a share set or a passkey wrote the passphrase slot and then enrolled each extra way in, and each enrolment reopened the container, deriving the password again: 1, 2, 2 and 3 derivations for password, +shares, +passkey, +both. encryptKeym2WithSlots writes every initial slot while the generated master key is still in hand, so the password is derived once and the share and passkey slots take only their HKDF. writeKeym2 generalises to writeKeym2Slots; the bytes are exactly the enrolment path's given the same random inputs. The password, KDF parameters, version, share threshold and count and passkey sizes are checked before any derivation. The worker and its no-worker fallback call it through encryptContainerWithSlots; §4.8 keeps its own writer, and enrolling into an existing backup is unchanged. The worker now reads the key file once, so the page transfers it on every path. Adds test:slot-transaction (derivation counts through the shipping worker for PBKDF2 and Argon2id, byte equality with the enrolment path for every cipher, version, slot combination and key-file case, every way in opens it, refusals cost no derivation, a failed write returns no container or shares), a census block in secret-erase-core, a bridge encryptslots subcommand compared byte for byte against the reference's three-step path in crosstest2.py, and three appended v3-slots fixtures (corpus 42 -> 45 in both languages).
404SecNotFound
merged commit Sep 28, 2026
de969a5
into
claude/serene-carson-0739mv-secret-buffers
15 checks passed
This was referenced Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Roadmap 9.3 and handover Section 05. Status: verified (implementation and required automated checks passed; no independent review implied).
Stacked on PR #227 (Section 04), which it builds on and which is not yet merged. This PR shows only its own commit. GitHub retargets it to
mainwhen #227 merges, since the repo uses merge commits.Commits
14937a1(PR Give each secret buffer one owner that erases it (roadmap 9.4) #227's head)487f8beObserved baseline
Measured through the shipping worker on #227's tree, with the old
crypto-worker.tsswapped in andtest:slot-transactionrun against it.An invalid threshold (4 of 3, or 1 of 3) was refused only after one derivation. This matches roadmap 9.0.
Changes
encryptKeym2WithSlots(keym-v2.ts) writes the passphrase slot, share set and passkey slot in one operation, in the order the enrolment path adds them.finally, per the 9.4 ownership rules.explicitinputs and the PRF output are the caller's and are left untouched.writeKeym2→writeKeym2Slots, generalised to N slots. Every prefix is validated before any key is derived. The single-slot writers call it with one slot, and their bytes are unchanged.encryptContainerWithSlots(keymaker-crypto.ts) hasencryptContainer's validation and key-file contract.encryptContainerWithSlots.secret-erase-test.mjsare tightened from "zeroed" to "detached", which means no page copy exists at all.v3-slots-{aes256gcm,chacha20poly1305,chained}are appended, each with a password, a 3-of-5 share set and a passkey. The corpus had no container with all three. Earlier entries are untouched:fixtures.jsonis +69 lines, −0. The corpus count moves from 42 to 45 in bothkeymaker-regression.mtsandcrosstest2.py.encryptslotspins every random input, andcrosstest2.pycompares its bytes and share strings with the Python reference's three-step path (encrypt,add_shamir_slot,add_passkey_slot).test:slot-transaction, registered inpackage.json, README andci.yml.Checks (all exit 0)
typecheck,build(no base path),test:readmetest:slot-transaction(new)test:conformance2test:keymakertest:secret-erase-coretest:*script (41 in total)--workers=2The Python suites ran in a venv built from the hash-pinned
reference/requirements.txt.Performance report
One container (4-core Intel Xeon @ 2.80GHz, Node 22.22.2). The backup has a password, shares and a passkey, with AES-256-GCM, v3 and a 64-byte payload. There were 9 runs of each path, interleaved, after one discarded warm-up.
The saving is in the password derivation only. [Inference] Other devices and settings will show a different ratio, so this is not a claim that creating a backup is three times faster everywhere. KDF parameters are unchanged.
Negative controls (each applied, typechecked, run, then restored)
test:slot-transactionfails every multi-way creation (2 or 3 derivations) and both invalid-threshold refusals (1 derivation)test:slot-transactionand 18 incrosstest2.pyNC3 did not bite at first. The first version inserted the share slot at index 1, which is where it already goes, so the patch changed nothing. It was rewritten to put the passkey slot first, and then it bit in both suites.
Not independently controlled
The "failed write returns no container and no shares" check has no targeted control. The worker's error path has no route that attaches
dataorshares, so there was nothing to remove. The check asserts the response shape after a failure injected once all three slots are wrapped, and a guard confirms the failure really landed there.Fixtures and compatibility
Unrun checks
Remaining risks
Next action
The owner merges #227, then this PR. This completes Sections 00 to 05 of the current run. Section 06 is outside this run's scope.