/** * Token generation for internal use by the agentkit layer. * * - RTC tokens authenticate a specific (appId, channel, uid) combination with * the Agora RTC network. * - ConvoAI tokens are combined RTC + RTM tokens used to authenticate ConvoAI * REST API calls via `Authorization: agora token=`. * * The `agora-token` library handles the JWT signing. */ export declare const MAX_EXPIRY_SECONDS = 86400; /** * Convenience helpers for specifying token expiry durations. * * Agora AccessToken2 tokens are valid for a maximum of 24 hours (86400 seconds). * Use these helpers with `expiresIn` when creating sessions to avoid hardcoding * raw second values. * * @example * ```typescript * agent.createSession({ * name: `conversation-${Date.now()}`, * channel: `demo-channel-${Date.now()}`, * agentUid: '1', * remoteUids: ['100'], * expiresIn: ExpiresIn.hours(12), * }); * ``` */ export declare const ExpiresIn: { MAX: 86400; HOUR: 3600; DAY: 86400; hours(h: number): number; minutes(m: number): number; seconds(s: number): number; }; export interface GenerateTokenOptions { appId: string; appCertificate: string; channel: string; uid: number; role?: number; expirySeconds?: number; } /** * Builds a short-lived RTC token for a numeric UID. * * Both `tokenExpire` and `privilegeExpire` are set to the same value — the * standard approach for most applications. */ export declare function generateRtcToken(opts: GenerateTokenOptions): string; export interface GenerateRtcTokenWithAccountOptions { appId: string; appCertificate: string; channel: string; /** String account identity — used when enableStringUid is true */ account: string; role?: number; expirySeconds?: number; } /** * Builds a short-lived RTC token for a string UID (user account). * * Use this instead of `generateRtcToken` when `enableStringUid` is true and * the agent UID is a non-numeric string. The Agora platform treats * `buildTokenWithUserAccount` tokens as valid for string-UID channels. * * Both `tokenExpire` and `privilegeExpire` are set to the same value. */ export declare function generateRtcTokenWithAccount(opts: GenerateRtcTokenWithAccountOptions): string; export interface GenerateConvoAITokenOptions { appId: string; appCertificate: string; /** The channel the agent will join — must match the channel used in the start request */ channelName: string; /** Numeric ConvoAI participant UID. Use the RTC UID for a user, agent, or avatar. */ uid: number; /** Seconds until the token expires (default: 86400) */ tokenExpire?: number; /** * Seconds until privileges expire. Defaults to the same value as `tokenExpire`. * Per Agora docs, setting this to 0 would expire privileges immediately — the SDK * always substitutes `tokenExpire` when this is 0 or omitted. */ privilegeExpire?: number; } /** * Builds a combined RTC + RTM token for ConvoAI REST API authentication. * * The resulting token is used as: `Authorization: agora token=` * * Uses `buildTokenWithRtm` which bundles both RTC channel access and RTM * messaging privileges in a single AccessToken2 token. */ export declare function generateConvoAIToken(opts: GenerateConvoAITokenOptions): string;