feat: zero-access key-hierarchy primitives (password KDF, key-wrap records, nmcs1 stream) - #14
Merged
Merged
Conversation
…cords, nmcs1 stream) Add three capabilities that the artifact-studio zero-access encryption program builds on: - @nestm/crypto/password: registry-based scrypt KDF with absolute parameter ceilings and a hard maxmem cap, canonical versioned params codec, and recovery codes (Crockford base32, checksum-padded groups). - @nestm/crypto/keys: KeyWrapRecord (A256GCMKW secret wraps + X25519 sealed boxes) with recipient-identity-bound AAD and length-checked unwrap, plus hmacSha256 / timingSafeEqualBytes. - @nestm/crypto/stream: the nmcs1 chunked AEAD container (fixed 512B header, per-chunk HKDF-derived keys/nonces from a per-object random fileId, truncation/ reorder/splice/header-tamper resistant, buffered + Web-stream APIs). fileId is a testing-only seam, never a public option, so nonce reuse cannot be caused by a caller. Also export isCipherEnvelope from ./core. No new runtime deps; ESM-only.
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.
Groundwork for the artifact-studio zero-access encryption program. Left open intentionally for comparison against an alternative implementation — do not merge yet.
What
@nestm/crypto/password— registry-based scrypt KDF (absolute param ceilings + hard maxmem cap, versioned canonical params codec) and recovery codes (Crockford base32, checksum-padded groups).@nestm/crypto/keys—KeyWrapRecord(A256GCMKW secret wraps + X25519 sealed boxes) with recipient-identity-bound AAD and length-checked unwrap;hmacSha256/timingSafeEqualBytes.@nestm/crypto/stream— thenmcs1chunked AEAD container: fixed 512-byte header, per-chunk keys/nonces from a per-object randomfileId; truncation/reorder/splice/header-tamper resistant; buffered + Web-stream APIs.fileIdis a testing-only seam, never public.isCipherEnvelopeexported from./core. No new runtime deps; ESM-only.Security review
A 15-agent adversarial review found 1 critical (public
fileId→ keystream reuse) + 13 high; all fixed and re-verified, plus two extra hardening fixes. Frozen wire vectors added.Verification
pnpm test251 passed ·check·build·check-package·test:packed— all green.