MCPcopy Create free account
hub / github.com/avoidwork/tenso / jwtAuthCheck

Function jwtAuthCheck

benchmarks/auth.js:211–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209
210 // Mock JWT validation (simplified - in real scenario would use jsonwebtoken library)
211 const jwtAuthCheck = req => {
212 const auth = req.headers.authorization;
213 if (!auth || !auth.startsWith("Bearer ")) return false;
214
215 const token = auth.slice(7);
216 // Simplified JWT structure check
217 const parts = token.split(".");
218 if (parts.length !== 3) return false;
219
220 // Mock validation - in real scenario would verify signature
221 try {
222 const payload = JSON.parse(Buffer.from(parts[1], "base64").toString());
223
224 return payload.sub && payload.iat;
225 } catch {
226 return false;
227 }
228 };
229
230 suite
231 .add("JWT Auth - Valid token", () => {

Callers 1

benchmarkJwtAuthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected