UNPKG

@signalwire/js

Version:
44 lines 1.47 kB
import { SessionOptions } from './utils/interfaces'; import { BaseSession } from './BaseSession'; import { type SWCloseEvent } from './utils'; export declare class BaseJWTSession extends BaseSession { options: SessionOptions; /** * Can set a value different than zero to * force the JWT as expired within X seconds. * TODO: Remove this workaround. */ private readonly _expiredDiffSeconds; private readonly _refreshTokenNotificationDiff; /** * Check the JWT expiration every 20seconds */ private readonly _checkTokenExpirationDelay; private _checkTokenExpirationTimer; constructor(options: SessionOptions); get expiresAt(): number; get expiresIn(): number; get expired(): boolean; /** * Authenticate with the SignalWire Network * using JWT * @return Promise<void> */ authenticate(): Promise<void>; retrieveRelayProtocol(): Promise<string>; persistRelayProtocol(): Promise<void>; /** * Reauthenticate with the SignalWire Network * using a newer JWT. If the session has expired * will reconnect it. * @return Promise<void> */ reauthenticate(): Promise<void>; protected _onSocketClose(event: SWCloseEvent): void; /** * Set a timer to dispatch a notification when the JWT is going to expire. * @return void */ protected _checkTokenExpiration(): Promise<void>; } //# sourceMappingURL=BaseJWTSession.d.ts.map