feat(keyring): revocable share link for SSH public keys (#267)

* feat(keyring): revocable share link for SSH public keys (/k/<token>.json|.keys)

Migration 009_keyring_shares (one per user, sha256(token) only). POST/GET/DELETE
/api/keyring/share for a person key or a browser session (CSRF header on
writes; machine keys 403). Public /k/<lks_ token>.json and .keys expose only
ssh-* public halves with ssh-keygen fingerprints computed from the key, CORS *,
public max-age=60, 404 when unknown or revoked, per-IP rate limit. /keyring
gets a Share public keys box (create, copy, rotate, revoke); docs updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(keyring-share): assemble the private-key fixture at runtime (ThreatCrush)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Anthony Ettinger <anthony@profullstack.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sh1pt-actions-fleet[bot] 2026-10-29 01:57:47 +00:00 • committed by GitHub
parent 8b23cf57b3
commit d03acc0d00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 507 additions and 4 deletions

View file

@ -13,6 +13,7 @@ import { credshareRouter } from "./routes/credshare.mjs";
import { apiKeysRouter } from "./routes/apikeys.mjs";
import { opencredsRouter } from "./routes/opencreds.mjs";
import { keyringRouter } from "./routes/keyring.mjs";
import { keyringShareRouter, publicKeysRouter } from "./routes/keyring-share.mjs";
import { cliRouter } from "./routes/cli.mjs";
import { pagesRouter } from "./routes/pages.mjs";
import { profileRouter } from "./lib/profile.mjs";
@ -66,6 +67,10 @@ app.get("/.well-known/openwebring.json", (_req, res) =>
app.get("/healthz", (_req, res) => res.json({ ok: true, env: config.env }));
// The keyring share link (/k/<token>.json|.keys): public, CORS-open, no session
// (mounted before the session middleware so it never sets a cookie on a cacheable answer).
app.use(publicKeysRouter);
app.use(sessionMiddleware);
app.use(csrfGuard);
@ -76,6 +81,7 @@ app.use(coinpayRouter);
app.use(credshareRouter); // /api/credshare/* (session or lsk_ Bearer)
app.use(apiKeysRouter); // /api/keys (session or a person's lsk_ key; never a machine key)
app.use(opencredsRouter); // /api/opencreds/* — personal vault sync (session or lsk_ Bearer)
app.use(keyringShareRouter); // /api/keyring/share: the public-keys share link (session or person key)
app.use(keyringRouter); // /api/keyring/* + /keyring — SSH keys / key pairs, ciphertext only
app.use(cliRouter); // /cli/authorize, /cli/token, /api/me
app.use(profileRouter); // /api/v1/me/profile (session cookie)