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:
Anthony Ettinger 2026-11-11 13:16:13 +00:00
parent 64eb42e2c1
commit f19b817c70
13 changed files with 957 additions and 4 deletions

View file

@ -180,6 +180,19 @@ export interface RemoteRotationRun {
summary: string | null;
}
/** One secret sealed to an external app (see apps/pwa/src/routes/app-grants.mjs). */
export interface AppGrant {
id: string;
app_name: string;
origin: string;
key_name: string;
vault_id: string;
source_name: string;
fingerprint: string;
recipient: { format: string; app: string; scope: string; user_id: string; inbox_public_key: string };
status: string;
}
export class TeamClient {
private readonly apiUrl: string;
private token?: string;
@ -193,6 +206,16 @@ export class TeamClient {
this.token = token;
}
/** App grants holding a value (by fingerprint) in vaults this identity can open. */
listAppGrants(fingerprint: string): Promise<{ grants: AppGrant[] }> {
return this.requestAt(`/api/v1/app-grants?fingerprint=${encodeURIComponent(fingerprint)}`, "GET");
}
/** Hand an app the re-sealed value after a rotation (ciphertext only). */
deliverAppGrant(grantId: string, sealed: string, fingerprint: string): Promise<{ ok: boolean; delivered: boolean; error?: string }> {
return this.requestAt(`/api/v1/app-grants/${encodeURIComponent(grantId)}/deliveries`, "POST", { sealed, fingerprint });
}
private request<T>(method: string, path: string, body?: unknown): Promise<T> {
return this.requestAt<T>(`/api/credshare${path}`, method, body);
}