/** * Verification SDK - Redirect-based age verification * * Lightweight SDK for integrating age verification using redirect flow. * Provides a secure, easy-to-implement solution with comprehensive * security features and flexible integration options. */ import type { SDKConfig, VerificationOptions } from '../types/base'; export interface UrlConfig { apiUrl: string; verifyUiUrl: string; engineUrl: string; wsUrl: string; trustedOrigins: string[]; } export interface BrandUrls { production: UrlConfig; staging: UrlConfig; } export interface BrandConstants { name: string; hmacSecretProd: string; hmacSecretStaging: string; messageType: string; legacyMessageType?: string; popupName: string; docsUrl: string; } /** * SDK Main Class * * Primary SDK class that manages verification sessions with comprehensive * security and error handling. Supports both redirect and new-tab modes with * automatic session management and PostMessage communication. */ export declare class VerificationSDK { private config; private readonly brandUrls; private readonly brandConstants; private popupWindow; private messageListener; private popupMonitorInterval; private unloadListener; private isVerificationInProgress; private currentSessionId; private hasReceivedResult; private lastVerifyUrl; private lastSessionToken; private lastExternalUserId; private lastSandboxMode; private temporaryHandoffToken; private static readonly LOCAL_HOSTNAMES; /** * Initialize SDK * * Validates configuration, sets up security measures, and prepares the SDK * for verification operations. Performs comprehensive environment validation * and security initialization. */ constructor(config: SDKConfig, brandUrls: BrandUrls, brandConstants: BrandConstants); /** * Initiate verification with race condition protection */ verify(options?: VerificationOptions): Promise; /** * Build verification URL with HMAC-signed state */ private buildVerificationUrl; /** * Redirect in same tab */ private redirect; /** * Open in new tab with PostMessage communication and proper cleanup */ private openNewTab; /** * Set up automatic cleanup on page unload to prevent memory leaks */ private setupAutoCleanup; /** * Auto-detect environment based on current URL */ private detectEnvironment; /** * Get the current environment */ getEnvironment(): 'production' | 'staging'; /** * Unlock verification process to allow new verifications */ private unlockVerification; /** * Internal cleanup method to prevent memory leaks */ private cleanup; private handleCancellation; private redirectToCancelUrl; /** * Remove auto-cleanup listeners */ private removeAutoCleanupListeners; /** * Public cleanup method for manual resource management */ destroy(): void; /** * Get Portal API URL based on environment and brand */ private getPortalApiUrl; /** * Get Engine URL based on environment and brand */ private getEngineUrl; /** * Get WebSocket URL based on environment and brand */ private getWebSocketUrl; /** * Detect if this is a public key (pk_ prefix) vs private key (sk_ prefix) */ private isPublicKey; /** * Create session internally for public keys */ private createInternalSession; private isBillingBlockError; private openBillingBlockPage; private getUrlConfig; private getTrustedOrigins; private getAllowedCustomOrigins; private getLocalOrigin; private applyLocalVerifyOverride; private getHmacSecret; }