Initial Commit
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
# restore-crypto-fold-keys-vault — fold `crypto-keys` + `crypto-vault` into `crypto`, delete the originals
|
||||
|
||||
**Packages:** `@suaveplan/crypto`, `@suaveplan/crypto-keys` (deleted), `@suaveplan/crypto-vault` (deleted), `@suaveplan/auth` (consumer migration)
|
||||
**Status:** PROPOSED
|
||||
**Type:** refactor + package-removal
|
||||
**Carved from:** `restore-crypto-keychain-packer` umbrella (2026-05-03)
|
||||
**Depends on:** `restore-crypto-cleanup-duplicates` must land first
|
||||
|
||||
## Why
|
||||
|
||||
`@suaveplan/crypto-keys` (key shape) and `@suaveplan/crypto-vault` (vault + ChainSigner) were always artificial splits — "key shape", "keychain", and "vault" are one concept that needs one home. Three confusingly-similar package names invite consumers to spread keychain logic across all three; folding them into the new opinionated `@suaveplan/crypto` consolidates the wire formats and removes a class of misimports.
|
||||
|
||||
After this slice ships:
|
||||
|
||||
- `@suaveplan/crypto/keychain/keypair/` owns key generation, validation, and the `Keypair` type (was `crypto-keys/keypair/`)
|
||||
- `@suaveplan/crypto/keychain/storage/` owns the `Keychain` adapter shapes (was `crypto-keys/keychain/`)
|
||||
- `@suaveplan/crypto/vault/mnemonic/` owns BIP39 (was `crypto-vault/mnemonic/`)
|
||||
- `@suaveplan/crypto/vault/legacy-vault/` owns the existing `Vault` class (was `crypto-vault/vault/`) — this is a temporary home; slice 3 will replace it with the three-regime `Vault` from the umbrella spec
|
||||
- The misleadingly-named `ChainSigner` is dropped (slice 3 introduces `Authority` to actually earn the name)
|
||||
- `@suaveplan/auth` migrates to import from `@suaveplan/crypto` instead of `@suaveplan/crypto-keys`
|
||||
|
||||
The removed packages have no other in-monorepo consumers (cross-checked against `MANIFEST.md` and `grep -rln`).
|
||||
|
||||
## What changes
|
||||
|
||||
### Moved into `@suaveplan/crypto/src/`
|
||||
|
||||
- `crypto-keys/src/keypair/*` → `crypto/src/keychain/keypair/*` (preserve git history via `git mv`)
|
||||
- `crypto-keys/src/keychain/*` → `crypto/src/keychain/storage/*`
|
||||
- `crypto-keys/src/errors/*` → folded into `crypto/src/errors/codes/`
|
||||
- `crypto-vault/src/mnemonic/*` → `crypto/src/vault/mnemonic/*`
|
||||
- `crypto-vault/src/vault/*` → `crypto/src/vault/legacy-vault/*` (rename to mark as transitional)
|
||||
- `crypto-vault/src/errors/*` → folded into `crypto/src/errors/codes/`
|
||||
|
||||
### Removed (entire packages)
|
||||
|
||||
- `packages/crypto/crypto-keys/` — `git rm -r`
|
||||
- `packages/crypto/crypto-vault/` — `git rm -r`
|
||||
|
||||
### Removed (specifically not folded)
|
||||
|
||||
- `crypto-vault/src/chain-signer/*` — DROPPED. The class is replaced by `Authority` in slice 3; nothing in genesis imports `ChainSigner` outside `crypto-vault`'s own tests.
|
||||
|
||||
### Modified consumers
|
||||
|
||||
- `@suaveplan/auth` — `package.json` removes `@suaveplan/crypto-keys` dep, adds `@suaveplan/crypto`; imports updated via codemod
|
||||
- Any other consumer surfaced by `grep -rln "@suaveplan/crypto-keys\|@suaveplan/crypto-vault" packages/` — codemod-migrated to `@suaveplan/crypto`
|
||||
|
||||
### `CLAUDE.md` + `MANIFEST.md`
|
||||
|
||||
- Remove `crypto-keys` and `crypto-vault` from the package list
|
||||
- `bun scripts/folder-reorg/generate-manifest.ts` regenerates `MANIFEST.md`
|
||||
|
||||
## Out of scope
|
||||
|
||||
- Building `Authority`, the three-regime `Vault`, `Packer`, `ChunkedPacker`, `RevocationList`, `AuditLog`, `RootIdentity`, `ServerIdentity` — slice 3.
|
||||
- The import-allowlist conformance gate, `crypto-cli`, `slsa` migration — slice 4.
|
||||
- Renaming `crypto/src/vault/legacy-vault/` to its final home — slice 3 (where the three-regime `Vault` replaces it).
|
||||
|
||||
## Source mapping
|
||||
|
||||
| Requirement | Source | Notes |
|
||||
|---|---|---|
|
||||
| Fold `crypto-keys` content into `crypto/keychain` | `restore-crypto-keychain-packer` umbrella, "Removed (folded into new crypto)" | Above-baseline genesis slice plan |
|
||||
| Fold `crypto-vault` content into `crypto/vault` (legacy) | Same | Same |
|
||||
| Delete `crypto-keys`, `crypto-vault` packages | Same | Same |
|
||||
| Drop `ChainSigner` | Umbrella, "Removed (folded into new crypto)" | Replaced by `Authority` in slice 3 |
|
||||
| Migrate `auth/auth` consumer | Umbrella, "Migration impact" table | One consumer; codemod-driven |
|
||||
|
||||
## Verification approach
|
||||
|
||||
- `bunx turbo lint typecheck test --filter=@suaveplan/crypto` green after the move; the previously-passing tests in `crypto-keys` + `crypto-vault` are now run from `crypto/`
|
||||
- `bunx turbo test:coverage --filter=@suaveplan/crypto` 100/100/100/100 over folded modules
|
||||
- `bunx turbo test --filter=@suaveplan/auth` green after consumer codemod
|
||||
- `grep -rln "@suaveplan/crypto-keys\|@suaveplan/crypto-vault" packages/` returns zero (excluding archives)
|
||||
- `MANIFEST.md` regenerated; package list in `CLAUDE.md` updated
|
||||
|
||||
## Migration impact
|
||||
|
||||
Consumers that import from `@suaveplan/crypto-keys` or `@suaveplan/crypto-vault` MUST switch to `@suaveplan/crypto`. The codemod handles the in-monorepo cases:
|
||||
|
||||
| Consumer today | Tomorrow |
|
||||
|---|---|
|
||||
| `@suaveplan/auth` | `@suaveplan/crypto` |
|
||||
| (no others in monorepo) | — |
|
||||
|
||||
External consumers (none today; genesis is pre-1.0) would need the same trivial rename.
|
||||
@@ -0,0 +1,39 @@
|
||||
# Capability Spec Delta: crypto (restore-crypto-fold-keys-vault)
|
||||
|
||||
**Package:** `@suaveplan/crypto`
|
||||
**Status:** PROPOSED
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Keypair, Keychain storage, BIP39, and legacy Vault live inside `@suaveplan/crypto`
|
||||
|
||||
`@suaveplan/crypto` SHALL own the keypair generation/validation surface, the in-memory and serialized keychain storage adapters, the BIP39 mnemonic generation/restoration helpers, and the existing pre-Authority `Vault` class. The packages `@suaveplan/crypto-keys` and `@suaveplan/crypto-vault` MUST be deleted; their content is folded under `crypto/src/keychain/` and `crypto/src/vault/` respectively.
|
||||
|
||||
The misleadingly-named `ChainSigner` from `crypto-vault` MUST be dropped (it does not actually sign under a hierarchy); slice 3 introduces `Authority` to take its place.
|
||||
|
||||
#### Scenario: keypair generation surface available
|
||||
|
||||
- **WHEN** a consumer imports `Keypair`, `generateKeypair`, `validateKeypair` from `@suaveplan/crypto`
|
||||
- **THEN** all three resolve and behave identically to their pre-fold equivalents in `@suaveplan/crypto-keys`
|
||||
|
||||
#### Scenario: BIP39 surface available
|
||||
|
||||
- **WHEN** a consumer imports `generateMnemonic`, `validateMnemonic`, `mnemonicToSeed` from `@suaveplan/crypto`
|
||||
- **THEN** all three resolve and behave identically to their pre-fold equivalents in `@suaveplan/crypto-vault`
|
||||
|
||||
#### Scenario: legacy Vault surface available transitionally
|
||||
|
||||
- **WHEN** a consumer imports the legacy `Vault` class from `@suaveplan/crypto/vault/legacy-vault`
|
||||
- **THEN** it resolves and behaves identically to the pre-fold `crypto-vault` `Vault` class
|
||||
|
||||
#### Scenario: ChainSigner is gone
|
||||
|
||||
- **WHEN** a consumer attempts to import `ChainSigner` from any `@suaveplan/crypto*` package
|
||||
- **THEN** the import fails (the symbol does not exist anywhere in genesis)
|
||||
|
||||
#### Scenario: deleted packages no longer referenced
|
||||
|
||||
- **WHEN** the test runs `grep -rln "@suaveplan/crypto-keys\|@suaveplan/crypto-vault" packages/`
|
||||
- **THEN** zero matches are found (excluding `openspec/archive/`)
|
||||
|
||||
**Verified by:** `tests/folded-keypair.test.ts::"keypair surface resolves under @suaveplan/crypto"` AND `tests/folded-mnemonic.test.ts::"BIP39 surface resolves under @suaveplan/crypto"` AND `tests/legacy-vault.test.ts::"legacy Vault resolves under @suaveplan/crypto/vault/legacy-vault"` AND `tests/chain-signer-removed.test.ts::"ChainSigner is no longer importable"` AND `tests/no-deleted-package-imports.test.ts::"no consumer imports the deleted packages"`
|
||||
@@ -0,0 +1,54 @@
|
||||
# Tasks — restore-crypto-fold-keys-vault
|
||||
|
||||
## 1. Pre-move audit
|
||||
|
||||
- [ ] 1.1 Confirm no consumer outside `crypto-vault`'s own tests imports `ChainSigner`
|
||||
- [ ] 1.2 List every `@suaveplan/crypto-keys` and `@suaveplan/crypto-vault` consumer with `grep -rln` (expected: only `auth/auth`)
|
||||
- [ ] 1.3 Snapshot test count + coverage across the three packages so post-move parity is measurable
|
||||
|
||||
## 2. Move files (preserve git history with `git mv`)
|
||||
|
||||
- [ ] 2.1 `git mv crypto-keys/src/keypair/* crypto/src/keychain/keypair/`
|
||||
- [ ] 2.2 `git mv crypto-keys/src/keychain/* crypto/src/keychain/storage/`
|
||||
- [ ] 2.3 `git mv crypto-vault/src/mnemonic/* crypto/src/vault/mnemonic/`
|
||||
- [ ] 2.4 `git mv crypto-vault/src/vault/* crypto/src/vault/legacy-vault/`
|
||||
- [ ] 2.5 Merge `crypto-keys/src/errors/codes/*` and `crypto-vault/src/errors/codes/*` into `crypto/src/errors/codes/` (resolve any code collisions; document in the diff)
|
||||
- [ ] 2.6 Walk every internal import in moved files and re-point relative paths to the new home
|
||||
- [ ] 2.7 Update `crypto/src/index.ts` to re-export the moved surface from the new locations
|
||||
|
||||
## 3. Delete `ChainSigner`
|
||||
|
||||
- [ ] 3.1 `git rm -r crypto-vault/src/chain-signer/`
|
||||
- [ ] 3.2 Confirm no remaining import of `ChainSigner` anywhere in `packages/`
|
||||
|
||||
## 4. Delete the two old packages
|
||||
|
||||
- [ ] 4.1 `git rm -r packages/crypto/crypto-keys/`
|
||||
- [ ] 4.2 `git rm -r packages/crypto/crypto-vault/`
|
||||
- [ ] 4.3 Run `bun install` to refresh the workspace lockfile
|
||||
|
||||
## 5. Migrate consumers
|
||||
|
||||
- [ ] 5.1 `auth/auth/package.json`: remove `@suaveplan/crypto-keys` dep; add `@suaveplan/crypto` dep
|
||||
- [ ] 5.2 Codemod-update every `auth/auth/src/**/*.ts` import from `@suaveplan/crypto-keys` to `@suaveplan/crypto` (subpath form may need adjustment to match the new layout)
|
||||
- [ ] 5.3 If any other consumer surfaces in the audit (Section 1.2), repeat for it
|
||||
|
||||
## 6. Manifest + docs
|
||||
|
||||
- [ ] 6.1 Update `CLAUDE.md` package list: remove `crypto-keys`, `crypto-vault`
|
||||
- [ ] 6.2 `bun scripts/folder-reorg/generate-manifest.ts` to refresh `MANIFEST.md`
|
||||
|
||||
## 7. Verification gates
|
||||
|
||||
- [ ] 7.1 `bun run check` — Biome 0/0/0 across monorepo
|
||||
- [ ] 7.2 `bunx turbo lint typecheck test --filter=@suaveplan/crypto` green
|
||||
- [ ] 7.3 `bunx turbo lint typecheck test --filter=@suaveplan/auth` green
|
||||
- [ ] 7.4 `bunx turbo test:coverage --filter=@suaveplan/crypto` 100/100/100/100 over folded modules
|
||||
- [ ] 7.5 `bunx turbo test --filter=...@suaveplan/crypto` (dependent sweep) green
|
||||
- [ ] 7.6 `grep -rln "@suaveplan/crypto-keys\|@suaveplan/crypto-vault" packages/` returns zero (excluding `archive/`)
|
||||
|
||||
## 8. Archive
|
||||
|
||||
- [ ] 8.1 Fold spec delta into `openspec/specs/crypto/spec.md`
|
||||
- [ ] 8.2 Delete `openspec/specs/crypto-keys/` and `openspec/specs/crypto-vault/` if those dirs exist
|
||||
- [ ] 8.3 Move `openspec/changes/restore-crypto-fold-keys-vault/` → `openspec/archive/<yyyy-mm-dd>-restore-crypto-fold-keys-vault/`
|
||||
Reference in New Issue
Block a user