diff --git a/src/resedit.ts b/src/resedit.ts index 36aed67..aa9c503 100644 --- a/src/resedit.ts +++ b/src/resedit.ts @@ -2,6 +2,7 @@ import * as fs from 'fs-extra'; // eslint-disable-next-line import/no-unresolved import { load as loadResEdit } from 'resedit/cjs'; import { Win32MetadataOptions } from './types'; +import { FileRecord } from '@electron/asar'; export type ExeMetadata = { productVersion?: string; @@ -9,6 +10,7 @@ export type ExeMetadata = { legalCopyright?: string; productName?: string; iconPath?: string; + asarIntegrity?: Record>; win32Metadata?: Win32MetadataOptions; } @@ -112,6 +114,17 @@ export async function resedit(exePath: string, options: ExeMetadata) { // Output version info versionInfo[0].outputToResourceEntries(res.entries); + // Asar Integrity + if (options.asarIntegrity) { + res.entries.push({ + type: 'Integrity', + id: 'ElectronAsar', + bin: Buffer.from(JSON.stringify(options.asarIntegrity)).buffer, + lang: languageInfo[0].lang, + codepage: languageInfo[0].codepage, + }); + } + res.outputResource(exe); await fs.writeFile(exePath, Buffer.from(exe.generate())); diff --git a/src/win32.ts b/src/win32.ts index 565d37b..631bfbe 100644 --- a/src/win32.ts +++ b/src/win32.ts @@ -33,6 +33,7 @@ export class WindowsApp extends App { fileVersion: this.opts.buildVersion || this.opts.appVersion, legalCopyright: this.opts.appCopyright, productName: this.opts.win32metadata?.ProductName || this.opts.name, + asarIntegrity: this.asarIntegrity, win32Metadata, }; }