MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / classifyJwtVerificationError

Function classifyJwtVerificationError

apps/cloud/src/mcp/jwt.ts:51–67  ·  view source on GitHub ↗
(cause: unknown)

Source from the content-addressed store, hash-verified

49const isJoseErrorCode = (code: string): boolean => code.startsWith("ERR_J");
50
51const classifyJwtVerificationError = (cause: unknown): McpJwtVerificationError =>
52 new McpJwtVerificationError({
53 cause,
54 reason: (() => {
55 const code = getJoseErrorCode(cause);
56 if (code === JWTExpired.code) return "expired";
57 if (
58 code === JWKSTimeout.code ||
59 code === JWKSInvalid.code ||
60 code === null ||
61 !isJoseErrorCode(code)
62 ) {
63 return "system";
64 }
65 return "invalid";
66 })(),
67 });
68
69const isExpectedJwtVerificationError = (error: McpJwtVerificationError): boolean =>
70 error.reason === "expired" || error.reason === "invalid";

Callers

nothing calls this directly

Calls 2

getJoseErrorCodeFunction · 0.85
isJoseErrorCodeFunction · 0.85

Tested by

no test coverage detected