UNPKG

basic-electron-updater

Version:

A secure, cross-platform auto-update library for Electron Forge apps using GitHub Releases.

37 lines (36 loc) 1.39 kB
export interface DownloadProgress { percent: number; transferred: number; total: number; } /** * Downloader handles secure asset downloads, SHA256, and GPG validation. * Used internally by Updater. */ export declare class Downloader { /** * Downloads an asset to the given path, with optional progress and SHA256 validation. * @param assetUrl URL to download * @param destPath Local file path to save * @param onProgress Optional progress callback * @param expectedSha256 Optional SHA256 hash to validate * @returns Path to downloaded file * @throws Error if download or hash validation fails */ downloadAsset(assetUrl: string, destPath: string, onProgress?: (progress: DownloadProgress) => void, expectedSha256?: string): Promise<string>; /** * Validates a file's SHA256 hash. * @param filePath Path to file * @param expected Expected SHA256 hash * @throws Error if hash does not match */ validateSha256(filePath: string, expected: string): Promise<void>; /** * Validates a file's GPG signature using a detached .sig file. * @param filePath Path to file * @param sigPath Path to .sig file * @param keyringPath Optional keyring * @throws Error if signature is invalid */ validateGpg(filePath: string, sigPath: string, keyringPath?: string): Promise<void>; }