mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 09:24:46 +00:00
App grants: hand one secret to an external app, sealed to its per-user inbox
Phase 1 of the CoinPay <-> logicsrc key hub (spec: claude.ai/artifact/LAZgAiqWqeLQ14uJ5JpdKb). - /grant consent page: logicsrc fetches the request manifest from the app's own origin over TLS (/.well-known/logicsrc-grant/<nonce>), public hosts only, so the page shows a verified origin, not a claimed name - The browser decrypts with the identity key (as the vault page does) and seals with @profullstack/sealed-secrets to the app's inbox; the server stores ciphertext + metadata only (app_grant_requests, app_grants) - Signed Standard Webhooks to the app: grant.delivered / updated / revoked - Signing keys (wallet, seed, SSH) are refused for apps - rotate-keys re-seals the new value to every app grant on the old fingerprint (resealAppGrants); /apps lists and revokes grants Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
64eb42e2c1
commit
f19b817c70
13 changed files with 957 additions and 4 deletions
|
|
@ -10,6 +10,7 @@ import { authRouter } from "./routes/auth.mjs";
|
|||
import { passkeyRouter } from "./routes/passkey.mjs";
|
||||
import { coinpayRouter } from "./routes/coinpay.mjs";
|
||||
import { credshareRouter } from "./routes/credshare.mjs";
|
||||
import { appGrantsRouter } from "./routes/app-grants.mjs";
|
||||
import { rotationRouter } from "./routes/rotation.mjs";
|
||||
import { autoRotationRouter } from "./routes/auto-rotation.mjs";
|
||||
import { sweepAutoRotation } from "./lib/auto-rotation.mjs";
|
||||
|
|
@ -61,6 +62,10 @@ const sodiumWrappers = requireHere.resolve("libsodium-wrappers");
|
|||
const sodiumCore = createRequire(sodiumWrappers).resolve("libsodium");
|
||||
app.get("/vendor/libsodium.js", (_req, res) => res.sendFile(sodiumCore));
|
||||
app.get("/vendor/libsodium-wrappers.js", (_req, res) => res.sendFile(sodiumWrappers));
|
||||
// @profullstack/sealed-secrets for app grants (public/app-grant.js): plain ESM over
|
||||
// WebCrypto, served as its own src/ so the browser seals exactly as the apps open.
|
||||
const sealedSecretsSrc = path.join(path.dirname(requireHere.resolve("@profullstack/sealed-secrets/package.json")), "src");
|
||||
app.use("/vendor/sealed-secrets", express.static(sealedSecretsSrc, { maxAge: "1h", index: false }));
|
||||
// The signup profile's progressive enhancement, as a file: the CSP allows no inline script.
|
||||
app.get("/vendor/profile-enhance.js", (_req, res) => res.type("application/javascript").set("Cache-Control", "public, max-age=3600").send(PROFILE_ENHANCE_SCRIPT));
|
||||
|
||||
|
|
@ -82,6 +87,7 @@ app.use(authRouter); // GET / (+ /auth/login|register|logout)
|
|||
app.use(passkeyRouter);
|
||||
app.use(coinpayRouter);
|
||||
app.use(credshareRouter); // /api/credshare/* (session or lsk_ Bearer)
|
||||
app.use(appGrantsRouter); // /grant consent, /apps, /api/v1/app-grants/* (keys sealed to external apps)
|
||||
app.use(autoRotationRouter); // paid automatic rotation: CoinPay checkout + /api/coinpay/webhook
|
||||
app.use(rotationRouter); // /api/credshare/teams/:slug/rotation* + /teams/:slug/rotation (plan + run queue, never values)
|
||||
app.use(apiKeysRouter); // /api/keys (session or a person's lsk_ key; never a machine key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue