/** * 小红书请求签名生成工具 TypeScript 版本 * 完全对应 Python 版本的功能实现 * 兼容ES5/ES2015版本 */ export declare class CryptoConfig { static readonly MAX_32BIT = 4294967295; static readonly MAX_SIGNED_32BIT = 2147483647; static readonly MAX_BYTE = 255; static readonly STANDARD_BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static readonly CUSTOM_BASE64_ALPHABET = "ZmserbBoHQtNP+wOcza/LpngG8yJq42KWYj0DSfdikx3VT16IlUAFM97hECvuRX5"; static readonly X3_BASE64_ALPHABET = "MfgqrsbcyzPQRStuvC7mn501HIJBo2DEFTKdeNOwxWXYZap89+/A4UVLhijkl63G"; static readonly HEX_KEY = "71a302257793271ddd273bcee3e4b98d9d7935e1da33f5765e2ea8afb6dc77a51a499d23b67c20660025860cbf13d4540d92497f58686c574e508f46e1956344f39139bf4faf22a3eef120b79258145b2feb5193b6478669961298e79bedca646e1a693a926154a5a7a1bd1cf0dedb742f917a747a1e388b234f2277"; static readonly EXPECTED_HEX_LENGTH = 32; static readonly OUTPUT_BYTE_COUNT = 8; static readonly HEX_CHUNK_SIZE = 2; static readonly VERSION_BYTES: number[]; static readonly SEQUENCE_VALUE_MIN = 15; static readonly SEQUENCE_VALUE_MAX = 50; static readonly WINDOW_PROPS_LENGTH_MIN = 900; static readonly WINDOW_PROPS_LENGTH_MAX = 1200; static readonly CHECKSUM_VERSION = 1; static readonly CHECKSUM_XOR_KEY = 115; static readonly CHECKSUM_FIXED_TAIL: number[]; static readonly ENV_FINGERPRINT_XOR_KEY = 41; static readonly ENV_FINGERPRINT_TIME_OFFSET_MIN = 10; static readonly ENV_FINGERPRINT_TIME_OFFSET_MAX = 50; static readonly SIGNATURE_DATA_TEMPLATE: { x0: string; x1: string; x2: string; x3: string; x4: string; }; static readonly X3_PREFIX = "mns0301_"; static readonly XYS_PREFIX = "XYS_"; static readonly HEX_CHARS = "abcdef0123456789"; static readonly XRAY_TRACE_ID_SEQ_MAX = 8388607; static readonly XRAY_TRACE_ID_TIMESTAMP_SHIFT = 23; static readonly B3_TRACE_ID_LENGTH = 16; static readonly PUBLIC_USERAGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0"; static readonly SIGNATURE_XSCOMMON_TEMPLATE: { s0: number; s1: string; x0: string; x1: string; x2: string; x3: string; x4: string; x5: string; x6: string; x7: string; x8: string; x9: number; x10: number; x11: string; }; } export declare class BitOperations { private config; normalizeTo32bit(value: number): number; xorTransformArray(inputArray: number[]): Uint8Array; private hexStringToBytes; } export declare class RandomGenerator { private config; generateRandomBytes(byteCount: number): number[]; generateRandomByteInRange(minVal: number, maxVal: number): number; generateRandomInt(): number; generateB3TraceId(): string; generateXrayTraceId(timestamp?: number, seq?: number): string; } export declare class Base64Encoder { private config; encode(dataToEncode: string): string; decode(encodedString: string): string; encodeX3(dataBytes: Uint8Array): string; decodeX3(encodedString: string): Uint8Array; } export type HttpMethod = 'GET' | 'POST'; export declare class RequestSignatureValidator { static validateMethod(method: any): HttpMethod; static validateUri(uri: any): string; static validateA1Value(a1Value: any): string; static validateXsecAppid(xsecAppid: any): string; static validatePayload(payload: any): Record | null; } export declare class CryptoProcessor { config: typeof CryptoConfig; bitOps: BitOperations; b64encoder: Base64Encoder; randomGen: RandomGenerator; private intToLeBytes; private envFingerprintA; private envFingerprintB; buildPayloadArray(hexParameter: string, a1Value: string, appIdentifier?: string, stringParam?: string, timestamp?: number): number[]; } export declare class CRC32 { private static readonly CRC32_TABLE; static crc32JsInt(input: string | number[] | Uint8Array, signed?: boolean): number; private static stringToBytes; } export declare class FingerprintData { static readonly GPU_VENDORS: string[]; static readonly SCREEN_RESOLUTIONS: { resolutions: string[]; weights: number[]; }; static readonly COLOR_DEPTH_OPTIONS: { values: number[]; weights: number[]; }; static readonly DEVICE_MEMORY_OPTIONS: { values: number[]; weights: number[]; }; static readonly CORE_OPTIONS: { values: number[]; weights: number[]; }; static readonly BROWSER_PLUGINS = "PDF Viewer,Chrome PDF Viewer,Chromium PDF Viewer,Microsoft Edge PDF Viewer,WebKit built-in PDF"; static readonly CANVAS_HASH = "742cc32c"; static readonly VOICE_HASH_OPTIONS = "10311144241322244122"; static readonly FONTS = "system-ui, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\", -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif, BlinkMacSystemFont, \"Helvetica Neue\", Arial, \"PingFang SC\", \"PingFang TC\", \"PingFang HK\", \"Microsoft Yahei\", \"Microsoft JhengHei\""; } export declare class FingerprintHelpers { /** * 加权随机选择 */ static weightedRandomChoice(options: T[], weights: number[]): T; /** * 获取随机渲染器信息 */ static getRendererInfo(): { vendor: string; renderer: string; }; /** * 获取屏幕配置 */ static getScreenConfig(): { width: number; height: number; availWidth: number; availHeight: number; }; /** * 生成 Canvas 哈希 */ static generateCanvasHash(): string; /** * 生成 WebGL 哈希 */ static generateWebglHash(): string; } export declare class ARC4 { private s; constructor(key: Uint8Array); /** * 加密数据 */ encrypt(data: Uint8Array): Uint8Array; } export declare class FingerprintGenerator { private config; private b1Key; private encoder; constructor(); /** * 生成完整的浏览器指纹 * 完全对应 Python 版本的实现 */ generate(cookies: Record, userAgent: string): Record; /** * 生成 b1 参数 * 完全对应 Python 版本的实现 */ generateB1(fp: Record): string; /** * 更新指纹 * 完全对应 Python 版本的实现 */ update(fp: Record, cookies: Record, url: string): void; } export declare class XsCommonSigner { private config; private fpGenerator; private encoder; constructor(); sign(cookieDict: Record): string; } export declare class Xhshow { private cryptoProcessor; private xsCommonSigner; private buildContentString; private generateDValue; private buildSignature; signXs(method: HttpMethod, uri: string, a1Value: string, xsecAppid?: string, payload?: Record | null, timestamp?: number): string; signXsGet(uri: string, a1Value: string, xsecAppid?: string, params?: Record | null, timestamp?: number): string; signXsPost(uri: string, a1Value: string, xsecAppid?: string, payload?: Record | null, timestamp?: number): string; signXsCommon(cookieDict: Record | string): string; signXsc(cookieDict: Record | string): string; private parseCookies; signHeaders(method: HttpMethod, uri: string, cookies: Record | string, xsecAppid?: string, params?: Record | null, payload?: Record | null, timestamp?: number): Record; signHeadersGet(uri: string, cookies: Record | string, xsecAppid?: string, params?: Record | null, timestamp?: number): Record; signHeadersPost(uri: string, cookies: Record | string, xsecAppid?: string, payload?: Record | null, timestamp?: number): Record; decodeX3(x3Signature: string): Uint8Array; decodeXs(xsSignature: string): Record; getB3TraceId(): string; getXrayTraceId(timestamp?: number, seq?: number): string; getXT(timestamp?: number): number; buildUrl(baseUrl: string, params?: Record): string; buildJsonBody(payload: Record): string; } declare const _default: Xhshow; export default _default;