MCPcopy Create free account
hub / github.com/HKUDS/AgentSpace / buildCallbackRouteProof

Function buildCallbackRouteProof

scripts/feishu/smoke.ts:2188–2209  ·  view source on GitHub ↗
(
  callbackUrl: string | undefined,
)

Source from the content-addressed store, hash-verified

2186}
2187
2188function buildCallbackRouteProof(
2189 callbackUrl: string | undefined,
2190): Pick<SmokeStep, "callbackRoute" | "callbackRouteFingerprint"> {
2191 if (!callbackUrl) {
2192 return {};
2193 }
2194 try {
2195 const url = new URL(callbackUrl);
2196 const workspaceId = url.searchParams.get("workspaceId")?.trim();
2197 const integrationId = url.searchParams.get("integrationId")?.trim();
2198 if (url.pathname !== "/api/integrations/feishu/events" || !workspaceId || !integrationId) {
2199 return {};
2200 }
2201 const routeKey = `${url.pathname}?workspaceId=${workspaceId}&integrationId=${integrationId}`;
2202 return {
2203 callbackRoute: url.pathname,
2204 callbackRouteFingerprint: `sha256:${createHash("sha256").update(routeKey, "utf8").digest("hex").slice(0, 16)}`,
2205 };
2206 } catch {
2207 return {};
2208 }
2209}
2210
2211function hasValidCallbackRouteProof(step: unknown): boolean {
2212 if (!step || typeof step !== "object") {

Callers 1

Calls 1

getMethod · 0.80

Tested by

no test coverage detected