/** * credential-transfer.ts — move stored credentials between devices without * moving the device key. * * Every stored credential is encrypted under a key derived from the local * `machine-key` (`crypto/credentials.ts`). Copying that key to another device * would make the two devices one trust domain, so it is never exported. A * credential crosses devices one of two ways instead: * * - **Sealed** (encrypted backups) — {@link sealCredentials} decrypts every * local credential and seals the plaintexts under a passphrase-derived key * (scrypt + AES-256-GCM, the same envelope as encrypted bundles). * {@link unsealCredentials} on the target device opens that payload and * re-encrypts each credential under the TARGET machine-key. * - **Re-entered** (unencrypted backups) — {@link redactCredentialCiphertexts} * blanks the device-bound ciphertexts in the STAGED snapshot (they are * useless elsewhere) and {@link listCredentialsForReentry} names every * credential with the one command that re-enters it. * * This module also migrates project credentials from the legacy path-bound * KDF to the project-identity KDF ({@link migrateProjectCredentials}), so a * moved project directory keeps its credentials. * * Stores covered: * * | Store | Location | Encryption | * |-------|----------|------------| * | `project-agent` | project `cleo.db` → `tasks_agent_credentials.api_key_encrypted` | project KDF | * | `service-connection` | global `cleo.db` → `service_connections.credentials_enc` | global KDF, id `service::