UNPKG

@fusedashlabs/ui9000-workspace

Version:

UI9000 workspace MCP. One tool, show_workspace, draws a chart from your table. Set TYPESAFE_API_KEY to let Jev choose the chart.

32 lines (31 loc) • 1.55 kB
/** * HMAC-SHA256 data-link signatures — copied from mcp-ui `src/utils/signature.ts`. * * The algorithm is load-bearing for interop: a link signed by mcp-ui must verify * here and vice versa. Do not "improve" the canonical string (`${id}.${exp}`), * the base64url digest encoding, or the epoch-seconds `exp`. Changing any of * them silently invalidates every link the other side issued. * * mcp-ui's exported `signDataLink` (id/exp/secret -> digest) is named * `computeDataLinkSignature` here so it does not collide with this package's * public `signDataLink(payload) -> SignedLink`. The body is unchanged. */ export type SignatureParams = { id: string; exp: number; secret: string; }; export type SignedUrlParams = { id: string; sig: string; exp: number; }; /** mcp-ui `signDataLink`: base64url HMAC-SHA256 over `${id}.${exp}`. */ export declare function computeDataLinkSignature({ id, exp, secret }: SignatureParams): string; /** Constant-time compare, and expired links never verify. */ export declare function verifyDataLinkSignature(id: string, exp: number, sig: string, secret: string): boolean; /** Opaque handle shape: `/v1/data-links/:id?sig=&exp=` and nothing else. */ export declare function createSignedDataUrl(baseUrl: string, id: string, exp: number, secret: string): string; export declare function parseSignedUrlParams(url: string): SignedUrlParams | null; export declare function generateExpiration(hoursFromNow?: number): number; export declare function isExpired(timestamp: number): boolean;