generateToken

View as MarkdownOpen in Claude

Generate a signed, base64url-encoded token binding a function name to a call ID. The token encodes the call ID, function name, expiry timestamp, a random nonce, and an HMAC-SHA256 signature.

Parameters

functionName
stringRequired

The SWAIG function name to bind.

callId
stringRequired

The call ID to bind.

Returns

string — A base64url-encoded token string.

Example

1import { SessionManager } from '@signalwire/sdk';
2
3const sm = new SessionManager();
4const token = sm.generateToken('get_weather', 'call-abc123');
5console.log(token);