UNPKG

edockit

Version:

A JavaScript library for listing, parsing, and verifying the contents and signatures of electronic documents (eDoc) and Associated Signature Containers (ASiC-E), supporting EU eIDAS standards for digital signatures and electronic seals.

61 lines (60 loc) 2.09 kB
/** * Cross-platform HTTP fetch for OCSP and CRL requests * Works in both browser and Node.js environments */ export interface FetchOptions { /** Request timeout in milliseconds */ timeout?: number; /** HTTP method (default: GET) */ method?: "GET" | "POST"; /** Request body for POST requests */ body?: ArrayBuffer | Uint8Array; /** Content-Type header */ contentType?: string; /** Accept header */ accept?: string; /** * CORS proxy URL for browser environments. * When set, the original URL will be URL-encoded and appended to this proxy URL. * Example: "https://cors-proxy.example.com/?url=" */ proxyUrl?: string; } export interface FetchResult { ok: boolean; status: number; data?: ArrayBuffer; error?: string; } /** * Fetch binary data from a URL with timeout support * @param url URL to fetch * @param options Fetch options * @returns FetchResult with binary data or error */ export declare function fetchBinary(url: string, options?: FetchOptions): Promise<FetchResult>; /** * Fetch OCSP response * @param url OCSP responder URL * @param request DER-encoded OCSP request * @param timeout Timeout in milliseconds * @param proxyUrl Optional CORS proxy URL * @returns FetchResult with OCSP response data */ export declare function fetchOCSP(url: string, request: ArrayBuffer, timeout?: number, proxyUrl?: string): Promise<FetchResult>; /** * Fetch CRL from distribution point * @param url CRL distribution point URL * @param timeout Timeout in milliseconds * @param proxyUrl Optional CORS proxy URL * @returns FetchResult with CRL data */ export declare function fetchCRL(url: string, timeout?: number, proxyUrl?: string): Promise<FetchResult>; /** * Fetch issuer certificate from AIA extension * @param url CA Issuers URL * @param timeout Timeout in milliseconds * @param proxyUrl Optional CORS proxy URL * @returns FetchResult with certificate data */ export declare function fetchIssuerCertificate(url: string, timeout?: number, proxyUrl?: string): Promise<FetchResult>;