mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 01:14:47 +00:00
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>
30 lines
1.3 KiB
Text
30 lines
1.3 KiB
Text
# LogicSRC credentials app — copy to .env and fill in.
|
|
NODE_ENV=development
|
|
PORT=8080
|
|
PUBLIC_ORIGIN=http://localhost:8080
|
|
|
|
# datastore: Turso (libSQL) in prod, or file:./data/local.db for local dev
|
|
TURSO_DATABASE_URL=file:./data/local.db
|
|
TURSO_AUTH_TOKEN=
|
|
|
|
# auth — generate with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
|
|
SESSION_SECRET=change-me-32-bytes-hex
|
|
|
|
# email invites via Resend (optional — without it, invite tokens are returned in the API response)
|
|
RESEND_API_KEY=
|
|
CREDSHARE_EMAIL_FROM=LogicSRC <noreply@logicsrc.com>
|
|
|
|
# "Sign in with CoinPay" (optional)
|
|
COINPAY_API_BASE=https://coinpayportal.com
|
|
COINPAY_OAUTH_AUTHORIZE_URL=https://coinpayportal.com/oauth/authorize
|
|
COINPAY_OAUTH_TOKEN_URL=https://coinpayportal.com/api/oauth/token
|
|
COINPAY_OAUTH_USERINFO_URL=https://coinpayportal.com/api/oauth/userinfo
|
|
COINPAY_OAUTH_CLIENT_ID=
|
|
|
|
# Vault email recovery (opt-in, paid; needs RESEND_API_KEY and COINPAY_API_KEY/COINPAY_WEBHOOK_SECRET).
|
|
# Escrow key for the server's share: 32 random bytes, base64. Keep it in the vault, not in git:
|
|
# node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
|
|
# Rotation: move the old key to VAULT_ESCROW_KEY_V<n>, set the new one, bump VAULT_ESCROW_KEY_VERSION.
|
|
VAULT_ESCROW_KEY=
|
|
VAULT_ESCROW_KEY_VERSION=1
|
|
VAULT_RECOVERY_PRICE_USD=5
|