Files
suaveplan/openspec/archive/2026-05-03-crypto-vault/tasks.md
2026-05-27 23:29:53 +01:00

5.0 KiB

Tasks — crypto-vault

Every checkbox MUST reflect work actually done in this change. Do not retroactively tick boxes for work that was already in main when this change opened.

1. Spec authoring

  • 1.1 Read MIGRATION.md Section 7 and Section 8 for vault architecture context
  • 1.2 Read openspec/AGENTS.md Sections 13 and 14
  • 1.3 Draft proposal.md from openspec/templates/proposal.md
  • 1.4 Draft specs/crypto-vault/spec.md from openspec/templates/spec-delta.md
  • 1.5 Every requirement carries a **Verified by:** line naming concrete it(...) titles

2. Implementation

  • 2.1 Scaffold package at packages/crypto/crypto-vault with package.json, tsconfig.json, vitest.config.ts
  • 2.2 Implement BIP39 module: generateMnemonic, entropyToMnemonic, mnemonicToEntropy, English word list
  • 2.3 Implement Argon2id module: deriveKeyWithArgon2id, Argon2idParams, OWASP minimum enforcement
  • 2.4 Implement HD key module: deriveMasterKeyFromMnemonic, BIP39 seed derivation, BIP32-like path
  • 2.5 Implement 2SKD module: deriveAuk, password + Secret Key + email mixing
  • 2.6 Implement key hierarchy module: derivePersonalKeyset, deriveVaultKey, deriveItemKey
  • 2.7 Implement SRP-6a client module: SrpClient, safe-prime group parameters, SHA-256 per RFC 5054
  • 2.8 Implement secure buffer module: SecureBuffer, zeroizeAll, toString masking, clone isolation
  • 2.9 Implement error module: CryptoVaultError, structured error codes
  • 2.10 Add Clock / Rng injection to generateMnemonic, deriveAuk, SrpClient, and SecureBuffer
  • 2.11 Export OpaqueKeyHandle for vault layer consumption
  • 2.12 Wire subpath exports in package.json for every feature module
  • 2.13 Add README.md with quick-start, modules list, and install instruction

3. Tests

  • 3.1 Unit tests at src/bip39/bip39.test.ts covering every BIP39 scenario
  • 3.2 Unit tests at src/argon2id/argon2id.test.ts covering derivation and parameter safety
  • 3.3 Unit tests at src/hd-key/hd-key.test.ts covering master key derivation
  • 3.4 Unit tests at src/twoskd/twoskd.test.ts covering 2SKD determinism and factor separation
  • 3.5 Unit tests at src/key-hierarchy/key-hierarchy.test.ts covering hierarchical derivation
  • 3.6 Unit tests at src/srp/srp-client.test.ts covering full handshake and failure modes
  • 3.7 Unit tests at src/secure/secure-buffer.test.ts covering zeroization and masking
  • 3.8 Spec-conformance tests at src/spec-conformance.test.ts pinning type-level / strict-mode scenarios
  • 3.9 Property/fuzz tests for BIP39 round-trip and Argon2id determinism
  • 3.10 Every it(...) carries { timeout: 5000 } (or 30000 for genuinely async / Argon2id-heavy)

4. Documentation

  • 4.1 Sibling .md for every implementation .ts (≥200 words, basic + advanced examples, full API reference)
  • 4.2 README links every co-located .md under ## Modules
  • 4.3 Update CLAUDE.md package listing if this is a new package

5. Pre-archive verification (the 5-gate triple)

  • 5.1 bun run check — Biome 0 errors / 0 warnings / 0 info across the whole monorepo
  • 5.2 bunx turbo lint typecheck test --filter=@suaveplan/crypto-vault — green
  • 5.3 bunx turbo test:coverage --filter=@suaveplan/crypto-vault — 100/100/100/100
  • 5.4 bun scripts/openspec-conformance.ts @suaveplan/crypto-vault — exit 0, no error findings
  • 5.5 bunx turbo build --filter=@suaveplan/crypto-vault — green

6. Pre-archive 7-row checklist (AGENTS.md Section 13)

  • 6.1 Generics threaded; expectTypeOf assertions on every literal-type claim
  • 6.2 Zod schemas wired at every declared boundary
  • 6.3 Every error code in error-codes.ts thrown by at least one production path
  • 6.4 Strict-mode behaviors tested both on and off
  • 6.5 OTel instruments emitted from production paths and asserted with a real in-memory MeterProvider
  • 6.6 Lifecycle dedup tested where claimed (in-flight Promise, idempotent set/load)
  • 6.7 No retroactive tick — every box above reflects work done in this change

7. Archive

  • 7.1 Fold spec delta into openspec/specs/crypto-vault/spec.md
  • 7.2 Move openspec/changes/crypto-vault/ → openspec/archive/2026-05-03-crypto-vault/
  • 7.3 Refresh MANIFEST.md if package set or deps changed (orchestrator §13b)

Audit Note (2026-05-02)

DEFERRED in the genesis spec-cleanup pass on 2026-05-02. Rationale:

  • Depends on the (still-pending-migration) @suaveplan/vault package per the dep graph in the proposal. Until vault is migrated, this change cannot meaningfully ship. 0/46 done.

Audit Note (2026-05-03)

UNBLOCKED — the change ships independently of @suaveplan/vault. crypto-vault is the foundational primitive layer; @suaveplan/vault (when later migrated) will consume OpaqueKeyHandle, SecureBuffer, and the hierarchy derivations shipped here. All 46 task boxes ticked; package shipped at v0.0.0 with 100% / 100% / 100% / 100% coverage.