Skip to content

Commit 19c8ee4

Browse files
akorchevdevelar
authored andcommitted
feat: support additional certificate file (#1467)
1 parent 773905f commit 19c8ee4

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

packages/electron-builder/src/options/winOptions.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ export interface WinBuildOptions extends PlatformSpecificBuildOptions {
77
/**
88
* Target package type: list of `nsis`, `nsis-web` (Web installer), `portable` (portable app without installation), `appx`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. Defaults to `nsis`.
99
* AppX package can be built only on Windows 10.
10-
*
10+
*
1111
* To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.
1212
*/
1313
readonly target?: TargetConfigType
1414

1515
/**
1616
* Array of signing algorithms used. Defaults to `['sha1', 'sha256']`
17-
*
17+
*
1818
* For AppX `sha256` is always used.
1919
*/
2020
readonly signingHashAlgorithms?: Array<"sha1" | "sha256"> | null
@@ -52,6 +52,11 @@ export interface WinBuildOptions extends PlatformSpecificBuildOptions {
5252
*/
5353
readonly certificateSha1?: string
5454

55+
/**
56+
* The path to an additional certificate file you want to add to the signature block.
57+
*/
58+
readonly additionalCertificateFile?: string
59+
5560
/**
5661
* The URL of the RFC 3161 time stamp server. Defaults to `http://timestamp.comodoca.com/rfc3161`.
5762
*/
@@ -87,9 +92,9 @@ export interface NsisOptions extends CommonNsisOptions, TargetSpecificOptions {
8792
*/
8893
readonly oneClick?: boolean
8994

90-
/***
95+
/***
9196
* If `oneClick` is `true` (default): Install per all users (per-machine).
92-
*
97+
*
9398
* If `oneClick` is `false`: no install mode installer page (choice per-machine or per-user), always install per-machine.
9499
* @default false
95100
*/
@@ -160,10 +165,10 @@ export interface NsisOptions extends CommonNsisOptions, TargetSpecificOptions {
160165

161166
/**
162167
* The path to EULA license file. Defaults to `license.rtf` or `license.txt` or `eula.rtf` or `eula.txt` (or uppercase variants, e.g. `EULA.txt` or `LICENSE.TXT`).
163-
*
168+
*
164169
* Multiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`)). For example, create files `license_de.txt` and `license_en.txt` in the build resources.
165170
* If OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).
166-
*
171+
*
167172
* Appropriate license file will be selected by user OS language.
168173
*/
169174
readonly license?: string | null
@@ -226,15 +231,15 @@ export interface PortableOptions extends TargetSpecificOptions, CommonNsisOption
226231
readonly requestExecutionLevel?: "user" | "highest" | "admin"
227232
}
228233

229-
/**
234+
/**
230235
* Web Installer Specific Options ([nsisWeb](#Config-nsisWeb)).
231236
*/
232237
export interface NsisWebOptions extends NsisOptions {
233238
/**
234239
* The application package download URL. Optional — by default computed using publish configuration.
235-
*
240+
*
236241
* URL like `https://example.com/download/latest` allows web installer to be version independent (installer will download latest application package).
237-
*
242+
*
238243
* Custom `X-Arch` http header is set to `32` or `64`.
239244
*/
240245
readonly appPackageUrl?: string | null
@@ -253,9 +258,9 @@ export interface NsisWebOptions extends NsisOptions {
253258
export interface SquirrelWindowsOptions extends WinBuildOptions {
254259
/**
255260
* A URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features). Defaults to the Electron icon.
256-
*
261+
*
257262
* Please note — [local icon file url is not accepted](https://github.com/atom/grunt-electron-installer/issues/73), must be https/http.
258-
*
263+
*
259264
* If you don't plan to build windows installer, you can omit it.
260265
* If your project repository is public on GitHub, it will be `https://github.com/${u}/${p}/blob/master/build/icon.ico?raw=true` by default.
261266
*/

packages/electron-builder/src/windowsCodeSign.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ async function spawnSign(options: SignOptions, inputPath: string, outputPath: st
128128
args.push(isWin ? "/p" : "-pass", options.password)
129129
}
130130

131+
if (options.options.additionalCertificateFile) {
132+
args.push(isWin ? "/ac" : "-ac", options.options.additionalCertificateFile)
133+
}
134+
131135
if (isWin) {
132136
// must be last argument
133137
args.push(inputPath)

0 commit comments

Comments
 (0)