`logicsrc keyring` (alias `kr`; `keys` is API keys): add/gen/list/show/restore/ rm/export --pub/sync/status. A keyring is an OpenCreds user-profile vault (same PBKDF2-600k + HKDF + AES-256-GCM scheme as `logicsrc vault`, recovery key); each private key is an OpenCreds `key` item envelope, public halves stay readable. Works fully local under ~/.config/logicsrc/keyring; `keyring sync` pushes ciphertext to the account. restore writes the default file name, 600/644, refuses a different existing key without --force and backs it up first; private keys are printed only with --print-private. - apps/pwa: /api/keyring (person Bearer key; session read-only; machine keys refused), additive migration 008_keyring, server refuses any upload that carries plaintext private key material (incl. base64'd PEM "ciphertext"); /keyring page lists public halves and decrypts in the browser (WebCrypto, same derivation) for download. - logicsrc-mcp: list/show/export_authorized_keys/add (sealed only)/remove/ restore instructions; never returns a private key. - docs/keyring.md served at /docs/keyring. - Tests: crypto round trip, ssh-keygen fingerprint parity, AAD binding, restore perms + overwrite guard + backup, two-machine sync, server stores ciphertext only, browser decrypt opens CLI-sealed envelopes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| public | ||
| src | ||
| test | ||
| .env.example | ||
| .gitignore | ||
| package.json | ||
| Procfile | ||
| railway.json | ||
| README.md | ||
@logicsrc/pwa — LogicSRC credentials
Express app on Postgres for team credential sharing: auth (email/password,
passkeys, CoinPay OAuth, sessions, lsk_ CLI API keys) + end-to-end-encrypted
team vaults. Zero-knowledge — the server only stores ciphertext, per-member
sealed vault keys, and identity public keys. Decryption happens in the
logicsrc CLI.
cp .env.example .env # set SESSION_SECRET; DATABASE_URL=postgres://… for prod (else a local libSQL file db)
npm install
npm start # migrates on boot, serves on :8080
Database
Production runs on Postgres: DATABASE_URL must be a postgres:// URL and the
app refuses to start on anything else there (a leftover libsql:// value is
called out by name). The client is
@profullstack/libsql-pg, which
keeps the @libsql/client surface the code was written against and rewrites
the remaining SQLite idioms per statement. Development and the tests use libSQL
itself (file:./data/local.db by default, :memory: in tests).
Migrations run at boot and live in two dialect copies with the same file names:
src/migrations/ (SQLite) and src/migrations-pg/ (Postgres, generated with
npx libsql-pg convert-schema and reviewed). npm run migrate applies the copy
matching DATABASE_URL. To move an existing Turso database:
DATABASE_URL=postgres://… npm run migrate # schema
npx libsql-pg copy --from "$TURSO_DATABASE_URL" --token "$TURSO_AUTH_TOKEN" \
--to "$DATABASE_URL" --verify # rows
Set PWA_TEST_DATABASE_URL=postgres://… to run the test suite against a real
Postgres (it drops and recreates the public schema of that database).
The CLI connects with LOGICSRC_API=<origin> logicsrc login (browser OAuth-PKCE
loopback → an lsk_ key). See docs/credential-sharing.md in the repo root.
Deploy boxes and CI use a machine key instead (logicsrc keys create, or
Settings ▸ API keys): one team, optional vault list, read-only by default,
optional expiry, and its own identity public key on the api_keys row. Vault
keys reach it through credshare_key_grants. Routes: GET|POST /api/keys,
DELETE /api/keys/:id (session or a person's key only) and
GET|POST /api/credshare/vaults/:id/key-grants,
DELETE /api/credshare/vaults/:id/key-grants/:keyId. Migration
005_machine_keys.sql; tests in test/machine-keys.test.mjs.