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

@ -0,0 +1,12 @@
-- A revocable, read-only share link for the PUBLIC halves of a person's SSH
-- keys (GET /k/<token>.json and /k/<token>.keys). One per user. Only
-- sha256(token) is stored, like sessions and API keys: the token is shown once,
-- on create or rotate. Revoking deletes the row. Additive only.
CREATE TABLE IF NOT EXISTS keyring_shares (
id TEXT PRIMARY KEY,
user_id TEXT NOT NULL UNIQUE REFERENCES users(id) ON DELETE CASCADE,
token_hash TEXT NOT NULL UNIQUE,
created_at INTEGER NOT NULL,
rotated_at INTEGER
);