UNPKG

@zestic/oauth-core

Version:

Framework-agnostic OAuth authentication library with support for multiple OAuth flows

57 lines 2.05 kB
/** * URL parameter parsing utilities for OAuth callbacks */ export declare class UrlParser { /** * Parse URL search parameters from a URL string or URLSearchParams */ static parseParams(input: string | URLSearchParams): URLSearchParams; /** * Extract specific parameters from URLSearchParams */ static extractParams(params: URLSearchParams, keys: string[]): Record<string, string | undefined>; /** * Check if required parameters are present */ static hasRequiredParams(params: URLSearchParams, requiredKeys: string[]): boolean; /** * Check if any of the specified parameters are present */ static hasAnyParams(params: URLSearchParams, keys: string[]): boolean; /** * Get the first non-null parameter value from a list of possible keys */ static getFirstParam(params: URLSearchParams, keys: string[]): string | null; /** * Convert URLSearchParams to a plain object */ static toObject(params: URLSearchParams): Record<string, string>; /** * Create URLSearchParams from an object */ static fromObject(obj: Record<string, string | number | boolean | undefined | null>): URLSearchParams; /** * Validate that a parameter matches expected format */ static validateParam(params: URLSearchParams, key: string, validator: (value: string) => boolean): boolean; /** * Extract OAuth error information from parameters */ static extractOAuthError(params: URLSearchParams): { error?: string; errorDescription?: string; }; /** * Check if parameters contain OAuth error */ static hasOAuthError(params: URLSearchParams): boolean; /** * Sanitize parameters by removing sensitive information for logging */ static sanitizeForLogging(params: URLSearchParams): Record<string, string>; /** * Merge multiple URLSearchParams objects */ static merge(...paramSets: URLSearchParams[]): URLSearchParams; } //# sourceMappingURL=UrlParser.d.ts.map