import { AvatarSDKConfig, AvatarSessionConfig } from "../types"; import { AvatarSession } from "./AvatarSession"; import { LogManager } from "../logging/LogManager"; /** * AvatarSDK main class * * @note Best practice: Create one instance per application process lifecycle and use it as a singleton. * @warning Most config properties are immutable after initialization. * Only authentication credentials can be updated via dedicated methods. * * SDK supports three authentication methods: * 1. Permanent AK/SK: Set appKey and secretKey only. No refresh needed. * 2. Temporary AK/SK + STS: Set appKey, secretKey, and stsToken. * All three need to be refreshed together via updateTempAKSK(). * 3. WSS Token: Set wssToken only. Refresh via updateWssToken(). * * Authentication priority: AK/SK > WSS Token */ export declare class AvatarSDK { /** Current version of the Avatar Web SDK, populated at build time from package.json. */ static readonly version: string; /** Configuration for AvatarSDK (structural parts are readonly) */ private _config; private _appKey; private _secretKey; private _stsToken; private _wssToken; readonly logger: LogManager; /** * Initialize AvatarSDK with configuration * @param config - Configuration for AvatarSDK * @throws Error if no valid authentication method is provided * * @note Best practice: Create one instance per application process lifecycle and use it as a singleton. * @warning Most config properties are immutable after initialization. * Only authentication credentials can be updated via dedicated methods. * * SDK supports three authentication methods: * 1. Permanent AK/SK: Set appKey and secretKey only. No refresh needed. * 2. Temporary AK/SK + STS: Set appKey, secretKey, and stsToken. * All three need to be refreshed together via updateTempAKSK(). * 3. WSS Token: Set wssToken only. Refresh via updateWssToken(). * * Authentication priority: AK/SK > WSS Token */ constructor(config: AvatarSDKConfig); /** * Get the current configuration (read-only view) */ get config(): Readonly; /** * Update temporary AK/SK credentials along with STS Token. * Use this method when your AK/SK credentials are temporary and need to be refreshed together with STS Token. * @param appKey - The new App Key for temporary AK/SK authentication * @param secretKey - The new Secret Key for temporary AK/SK authentication * @param stsToken - The new STS Token for temporary AK/SK authentication * @note The updated credentials will take effect on the next connection attempt. * @note This method is for temporary AK/SK scenarios. For permanent AK/SK, no refresh is needed. */ updateTempAKSK(appKey: string | null, secretKey: string | null, stsToken: string | null): void; /** * Update WSS Token for WebSocket authentication. * Use this method when using WSS Token authentication (without AK/SK). * @param wssToken - The new WSS token. Pass null to clear. * @note The updated token will take effect on the next connection attempt. */ updateWssToken(wssToken: string | null): void; /** * Create AvatarSession instance with config * @param config - Session configuration * @returns AvatarSession instance */ createSession(config: AvatarSessionConfig): AvatarSession; }