Files
archie/ui/src/sources/source-signing.ts
T
sam 684ec1263a feat(eda): sources own signing, with UUIDv7 paths and approved unsigned option
A source is the capture endpoint: a UUIDv7 path by default or a unique
URL-safe custom path, signed by default with an Archie-generated secret
(encrypted via the bindings cipher), or unsigned after an approval.
Intake verifies X-Hub-Signature-256/X-Signature-256 against the source
secret before redaction; an unauthenticated event on a signed source is
captured but never dispatched, an event on an approved unsigned source
dispatches and is marked unsigned. The binding secret is retired; migration
0006 derives sources from existing binding and capture source strings,
moving each binding's secret onto its source. SourceStore crosses the
State Store gRPC contract. The dashboard gains a sources panel and flags
unsigned in the capture inspector, binding list and task timeline.
2026-09-24 14:26:21 +10:00

42 lines
1.1 KiB
TypeScript

/**
* The sources vocabulary: the wire shape GET /api/sources returns and the
* signing states it carries. A source's secret is only ever in the response
* to the write that generated it.
*/
export interface Source {
path: string;
signing?: string;
/** Present only on create and on a new secret. */
secret?: string;
created_at?: string;
}
export type SigningKind = "ok" | "info" | "warn" | "idle";
const LABELS: Record<string, string> = {
signed: "signed",
unsigned_pending_approval: "unsigned pending approval",
unsigned: "unsigned",
};
const KINDS: Record<string, SigningKind> = {
signed: "ok",
unsigned_pending_approval: "info",
unsigned: "warn",
};
export function signingLabel(signing?: string): string {
if (!signing) return "unknown";
return LABELS[signing] ?? signing;
}
export function signingKind(signing?: string): SigningKind {
return KINDS[signing ?? ""] ?? "idle";
}
/** The URL a sender posts to. */
export function sourceURL(origin: string, path: string): string {
return `${origin}/webhooks/capture/${encodeURIComponent(path)}`;
}