4.9 KiB
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 theKeypairtype (wascrypto-keys/keypair/)@suaveplan/crypto/keychain/storage/owns theKeychainadapter shapes (wascrypto-keys/keychain/)@suaveplan/crypto/vault/mnemonic/owns BIP39 (wascrypto-vault/mnemonic/)@suaveplan/crypto/vault/legacy-vault/owns the existingVaultclass (wascrypto-vault/vault/) — this is a temporary home; slice 3 will replace it with the three-regimeVaultfrom the umbrella spec- The misleadingly-named
ChainSigneris dropped (slice 3 introducesAuthorityto actually earn the name) @suaveplan/authmigrates to import from@suaveplan/cryptoinstead 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 viagit mv)crypto-keys/src/keychain/*→crypto/src/keychain/storage/*crypto-keys/src/errors/*→ folded intocrypto/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 intocrypto/src/errors/codes/
Removed (entire packages)
packages/crypto/crypto-keys/—git rm -rpackages/crypto/crypto-vault/—git rm -r
Removed (specifically not folded)
crypto-vault/src/chain-signer/*— DROPPED. The class is replaced byAuthorityin slice 3; nothing in genesis importsChainSigneroutsidecrypto-vault's own tests.
Modified consumers
@suaveplan/auth—package.jsonremoves@suaveplan/crypto-keysdep, 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-keysandcrypto-vaultfrom the package list bun scripts/folder-reorg/generate-manifest.tsregeneratesMANIFEST.md
Out of scope
- Building
Authority, the three-regimeVault,Packer,ChunkedPacker,RevocationList,AuditLog,RootIdentity,ServerIdentity— slice 3. - The import-allowlist conformance gate,
crypto-cli,slsamigration — slice 4. - Renaming
crypto/src/vault/legacy-vault/to its final home — slice 3 (where the three-regimeVaultreplaces 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/cryptogreen after the move; the previously-passing tests incrypto-keys+crypto-vaultare now run fromcrypto/bunx turbo test:coverage --filter=@suaveplan/crypto100/100/100/100 over folded modulesbunx turbo test --filter=@suaveplan/authgreen after consumer codemodgrep -rln "@suaveplan/crypto-keys\|@suaveplan/crypto-vault" packages/returns zero (excluding archives)MANIFEST.mdregenerated; package list inCLAUDE.mdupdated
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.