mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 09:24:46 +00:00
vault: opt-in paid email recovery for the personal vault ($5 lifetime) (#298)
* vault: opt-in paid email recovery for the personal vault ($5 lifetime)
A second way back into a logicsrc personal vault when the master password and
the offline recovery key are both gone, without the server holding anything
that alone (even with the DB and server env) opens the vault.
Client (packages/opencreds): random escrow key E encrypts the user key K
(AES-256-GCM, AAD "<ns>:vault:email-escrow:v1|<createdAt>"); E is split into
S (random, to the server) and U = E XOR S (emailed once as a checksummed
Crockford recovery code, never stored). `recover --email` checks the code's
check group first, asks the server for a one-time code, claims S, recombines
E, proves K against an item, sets a new password, issues a new offline
recovery key and re-enrolls with fresh shares (warns loudly if that fails).
New `recovery status|buy|enable|disable` commands; the CLI client lives in
packages/cli/src/vault-sync.ts.
Server (apps/pwa): /api/opencreds/recovery/{checkout,enroll,start,claim} +
status/disable. S is sealed under VAULT_ESCROW_KEY (versioned for rotation,
AAD binds the user). Enrollment is pending until the email with U is sent,
else rolled back. One-time codes: 8 digits, HMAC at rest, 15 min, 5 tries,
single use, 3 starts/hour; claims are audited and announced by email.
Purchase via CoinPay checkout (purpose vault_recovery); /api/coinpay/webhook
now verifies once and dispatches by purpose, auto_rotation unchanged.
Settings card with status and a Buy button. Migration 014 in both dialects.
Docs: security.md and crypto.md "Email recovery (opt-in, paid)" sections with
the honest trade-off; cli.md command reference.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* vault email recovery: state that the mailbox alone is enough
The account password resets by email, so mailbox control = sign-in + one-time
code + the enrollment code U. Say so in security.md and stop the one-time-code
email from implying the vault stays safe if someone else reads the mailbox.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* vault email recovery: leave .env.example as on master
Touching it made the credential gate re-scan the existing SESSION_SECRET
placeholder (false positive). VAULT_ESCROW_KEY / _VERSION / VAULT_RECOVERY_PRICE_USD
are documented in docs/opencreds/security.md and crypto.md; prod values live in
vault app-logicsrc-com--prod.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4e4fedd35e
commit
41ad9f0987
20 changed files with 2363 additions and 7 deletions
|
|
@ -52,6 +52,24 @@ opencreds recover # unlock with the recovery key, set a new password
|
|||
A password change re-wraps the user key. Not one item is re-encrypted, which is
|
||||
why it is instant on a vault of any size.
|
||||
|
||||
### Email recovery (`logicsrc vault` only)
|
||||
|
||||
```bash
|
||||
logicsrc vault recovery status [--json] # enrolled? since? email (masked)? purchased?
|
||||
logicsrc vault recovery buy # CoinPay checkout link ($5, lifetime)
|
||||
logicsrc vault recovery enable # enroll; emails a recovery code to keep
|
||||
logicsrc vault recovery disable # server deletes its escrow share and blob
|
||||
logicsrc vault recover --email # recovery code + fresh one-time code, then a new password
|
||||
```
|
||||
|
||||
An opt-in, paid account feature; the standalone `opencreds` binary has no
|
||||
account and exits 1 with a pointer to `logicsrc login`. `enable` exits 1 and
|
||||
prints the checkout link when the purchase is missing. `recover --email` works
|
||||
with the vault locked, exits 3 when the recovery code does not match, prints the
|
||||
new offline recovery key once, and re-enrolls automatically (it warns loudly,
|
||||
exit 0, if that last step fails). The trade-off is in
|
||||
[security.md](./security.md#email-recovery-opt-in-paid).
|
||||
|
||||
## Items
|
||||
|
||||
```bash
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue