debugToken

View as MarkdownOpen in Claude

Decode token components for debugging without validating the signature. Useful for inspecting token contents and checking expiration.

Parameters

token
stringRequired

The base64url-encoded token to decode.

Returns

{ callId: string; functionName: string; expiry: number; nonce: string; signature: string; expired: boolean } | null — The decoded token fields and expiration status, or null if malformed.

Example

1import { SessionManager } from '@signalwire/sdk';
2
3const sm = new SessionManager();
4const token = sm.generateToken('get_weather', 'call-abc123');
5const info = sm.debugToken(token);
6if (info) {
7 console.log('Function:', info.functionName);
8 console.log('Expired:', info.expired);
9}