MCPcopy Index your code
hub / github.com/codeaashu/claude-code / decodeJwtPayload

Function decodeJwtPayload

src/bridge/jwtUtils.ts:21–32  ·  view source on GitHub ↗
(token: string)

Source from the content-addressed store, hash-verified

19 * token is malformed or the payload is not valid JSON.
20 */
21export function decodeJwtPayload(token: string): unknown | null {
22 const jwt = token.startsWith('sk-ant-si-')
23 ? token.slice('sk-ant-si-'.length)
24 : token
25 const parts = jwt.split('.')
26 if (parts.length !== 3 || !parts[1]) return null
27 try {
28 return jsonParse(Buffer.from(parts[1], 'base64url').toString('utf8'))
29 } catch {
30 return null
31 }
32}
33
34/**
35 * Decode the `exp` (expiry) claim from a JWT without verifying the signature.

Callers 1

decodeJwtExpiryFunction · 0.85

Calls 2

jsonParseFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected