mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 09:24:46 +00:00
App grants: one secret sealed to an external app (key hub phase 1) (#286)
Some checks failed
CI / build (push) Has been cancelled
Deploy to dev2 / deploy (push) Has been cancelled
test / test (push) Has been cancelled
Some checks failed
CI / build (push) Has been cancelled
Deploy to dev2 / deploy (push) Has been cancelled
test / test (push) Has been cancelled
* 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> * App grants: re-check the webhook host is public on every delivery Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
64eb42e2c1
commit
bbf640abeb
13 changed files with 974 additions and 4 deletions
46
apps/pwa/src/migrations/013_app_grants.sql
Normal file
46
apps/pwa/src/migrations/013_app_grants.sql
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
-- App grants: a person hands one named secret to an external app (meshhook,
|
||||
-- smshub, ...), sealed in their browser to that app's per-user inbox key.
|
||||
-- The server stores ciphertext and metadata only, never a value.
|
||||
--
|
||||
-- A request is created from a manifest logicsrc fetched itself from the app's
|
||||
-- origin over TLS (/.well-known/logicsrc-grant/<nonce>), so the consent page
|
||||
-- shows a verified origin, not a name the app claimed.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS app_grant_requests (
|
||||
id TEXT PRIMARY KEY,
|
||||
origin TEXT NOT NULL,
|
||||
nonce TEXT NOT NULL,
|
||||
app_name TEXT NOT NULL,
|
||||
manifest TEXT NOT NULL,
|
||||
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
status TEXT NOT NULL,
|
||||
created_at INTEGER NOT NULL,
|
||||
expires_at INTEGER NOT NULL,
|
||||
decided_at INTEGER,
|
||||
UNIQUE (origin, nonce)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS app_grants (
|
||||
id TEXT PRIMARY KEY,
|
||||
request_id TEXT NOT NULL REFERENCES app_grant_requests(id) ON DELETE CASCADE,
|
||||
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
origin TEXT NOT NULL,
|
||||
app_name TEXT NOT NULL,
|
||||
key_name TEXT NOT NULL,
|
||||
vault_id TEXT NOT NULL,
|
||||
source_name TEXT NOT NULL,
|
||||
fingerprint TEXT NOT NULL,
|
||||
recipient TEXT NOT NULL,
|
||||
recipient_fingerprint TEXT NOT NULL,
|
||||
webhook_url TEXT NOT NULL,
|
||||
webhook_secret TEXT NOT NULL,
|
||||
status TEXT NOT NULL,
|
||||
created_at INTEGER NOT NULL,
|
||||
revoked_at INTEGER,
|
||||
last_delivered_at INTEGER,
|
||||
last_error TEXT
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_app_grants_user ON app_grants(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_app_grants_fingerprint ON app_grants(fingerprint);
|
||||
CREATE INDEX IF NOT EXISTS idx_app_grants_vault ON app_grants(vault_id);
|
||||
Loading…
Add table
Add a link
Reference in a new issue