Upload via GUI (7543 Dateien)
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Contributors to the Electron project
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
# @electron/get
|
||||
|
||||
> Download Electron release artifacts
|
||||
|
||||
[](https://github.com/electron/get/actions/workflows/test.yml)
|
||||
[](https://npm.im/@electron/get)
|
||||
[](https://packages.electronjs.org/get)
|
||||
|
||||
## Usage
|
||||
|
||||
For full API details, see the [API documentation](https://packages.electronjs.org/get).
|
||||
|
||||
### Simple: Downloading an Electron Binary ZIP
|
||||
|
||||
```typescript
|
||||
import { download } from '@electron/get';
|
||||
|
||||
// NB: Use this syntax within an async function, Node does not have support for
|
||||
// top-level await as of Node 12.
|
||||
const zipFilePath = await download('4.0.4');
|
||||
```
|
||||
|
||||
### Advanced: Downloading a macOS Electron Symbol File
|
||||
|
||||
```typescript
|
||||
import { downloadArtifact } from '@electron/get';
|
||||
|
||||
// NB: Use this syntax within an async function, Node does not have support for
|
||||
// top-level await as of Node 12.
|
||||
const zipFilePath = await downloadArtifact({
|
||||
version: '4.0.4',
|
||||
platform: 'darwin',
|
||||
artifactName: 'electron',
|
||||
artifactSuffix: 'symbols',
|
||||
arch: 'x64',
|
||||
});
|
||||
```
|
||||
|
||||
### Specifying a mirror
|
||||
|
||||
To specify another location to download Electron assets from, the following options are
|
||||
available:
|
||||
|
||||
* `mirrorOptions` Object
|
||||
* `mirror` String (optional) - The base URL of the mirror to download from.
|
||||
* `nightlyMirror` String (optional) - The Electron nightly-specific mirror URL.
|
||||
* `customDir` String (optional) - The name of the directory to download from, often scoped by version number.
|
||||
* `customFilename` String (optional) - The name of the asset to download.
|
||||
* `resolveAssetURL` Function (optional) - A function allowing customization of the url used to download the asset.
|
||||
|
||||
Anatomy of a download URL, in terms of `mirrorOptions`:
|
||||
|
||||
```
|
||||
https://github.com/electron/electron/releases/download/v4.0.4/electron-v4.0.4-linux-x64.zip
|
||||
| | | |
|
||||
------------------------------------------------------- -----------------------------
|
||||
| |
|
||||
mirror / nightlyMirror | | customFilename
|
||||
------
|
||||
||
|
||||
customDir
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
import { download } from '@electron/get';
|
||||
|
||||
const zipFilePath = await download('4.0.4', {
|
||||
mirrorOptions: {
|
||||
mirror: 'https://mirror.example.com/electron/',
|
||||
customDir: 'custom',
|
||||
customFilename: 'unofficial-electron-linux.zip'
|
||||
}
|
||||
});
|
||||
// Will download from https://mirror.example.com/electron/custom/unofficial-electron-linux.zip
|
||||
|
||||
const nightlyZipFilePath = await download('8.0.0-nightly.20190901', {
|
||||
mirrorOptions: {
|
||||
nightlyMirror: 'https://nightly.example.com/',
|
||||
customDir: 'nightlies',
|
||||
customFilename: 'nightly-linux.zip'
|
||||
}
|
||||
});
|
||||
// Will download from https://nightly.example.com/nightlies/nightly-linux.zip
|
||||
```
|
||||
|
||||
`customDir` can have the placeholder `{{ version }}`, which will be replaced by the version
|
||||
specified (without the leading `v`). For example:
|
||||
|
||||
```javascript
|
||||
const zipFilePath = await download('4.0.4', {
|
||||
mirrorOptions: {
|
||||
mirror: 'https://mirror.example.com/electron/',
|
||||
customDir: 'version-{{ version }}',
|
||||
platform: 'linux',
|
||||
arch: 'x64'
|
||||
}
|
||||
});
|
||||
// Will download from https://mirror.example.com/electron/version-4.0.4/electron-v4.0.4-linux-x64.zip
|
||||
```
|
||||
|
||||
#### Using environment variables for mirror options
|
||||
Mirror options can also be specified via the following environment variables:
|
||||
* `ELECTRON_CUSTOM_DIR` - Specifies the custom directory to download from.
|
||||
* `ELECTRON_CUSTOM_FILENAME` - Specifies the custom file name to download.
|
||||
* `ELECTRON_MIRROR` - Specifies the URL of the server to download from if the version is not a nightly version.
|
||||
* `ELECTRON_NIGHTLY_MIRROR` - Specifies the URL of the server to download from if the version is a nightly version.
|
||||
|
||||
### Overriding the version downloaded
|
||||
|
||||
The version downloaded can be overriden by setting the `ELECTRON_CUSTOM_VERSION` environment variable.
|
||||
Setting this environment variable will override the version passed in to `download` or `downloadArtifact`.
|
||||
|
||||
## How It Works
|
||||
|
||||
This module downloads Electron to a known place on your system and caches it
|
||||
so that future requests for that asset can be returned instantly. The cache
|
||||
locations are:
|
||||
|
||||
* Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
|
||||
* MacOS: `~/Library/Caches/electron/`
|
||||
* Windows: `%LOCALAPPDATA%/electron/Cache` or `~/AppData/Local/electron/Cache/`
|
||||
|
||||
By default, the module uses the built-in [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
|
||||
as the downloader. As a result, you can pass [`RequestInit`](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit)
|
||||
options via `downloadOptions`.
|
||||
|
||||
### Progress Bar
|
||||
|
||||
By default, a progress bar is shown when downloading an artifact for more than 30 seconds. To
|
||||
disable, set the `ELECTRON_GET_NO_PROGRESS` environment variable to any non-empty value, or set
|
||||
`quiet` to `true` in `downloadOptions`. If you need to monitor progress yourself via the API, set
|
||||
`getProgressCallback` in `downloadOptions`, which receives a `Progress` object with `transferred`,
|
||||
`total`, and `percent` properties.
|
||||
|
||||
### Proxies
|
||||
|
||||
Downstream packages should utilize the `initializeProxy` function to add HTTP(S) proxy support. If
|
||||
the environment variable `ELECTRON_GET_USE_PROXY` is set, it is called automatically.
|
||||
|
||||
### Debug
|
||||
|
||||
[`debug`](https://www.npmjs.com/package/debug) is used to display logs and messages.
|
||||
Set the `DEBUG=@electron/get*` environment variable to log additional
|
||||
debug information from this module.
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EACL,yBAAyB,GAG1B,MAAM,YAAY,CAAC;AAEpB,KAAK,UAAU,qBAAqB,CAClC,SAAiB,EACjB,EAAqC;IAErC,IAAI,MAAS,CAAC;IACd,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,kBAA0B,EAAE,CAAC,MAAM,EAAE;IACjE,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;IACjD,OAAO,MAAM,EAAE,CAAC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F;IAE7F,OAAO,eAAe,CAAC,SAAS,IAAI,yBAAyB,CAAC,SAAS,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,SAAoC;IACrE,OAAO,CACL,SAAS,KAAK,yBAAyB,CAAC,QAAQ;QAChD,SAAS,KAAK,yBAAyB,CAAC,SAAS,CAClD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,SAAoC;IACnE,OAAO,CACL,SAAS,KAAK,yBAAyB,CAAC,SAAS;QACjD,SAAS,KAAK,yBAAyB,CAAC,SAAS,CAClD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,SAAoC;IAC/E,OAAO,CACL,SAAS,KAAK,yBAAyB,CAAC,MAAM;QAC9C,SAAS,KAAK,yBAAyB,CAAC,QAAQ,CACjD,CAAC;AACJ,CAAC"}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "@electron/get",
|
||||
"version": "5.1.0",
|
||||
"type": "module",
|
||||
"exports": "./dist/index.js",
|
||||
"description": "Utility for downloading artifacts from different versions of Electron",
|
||||
"repository": "https://github.com/electron/get",
|
||||
"author": "Samuel Attard",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"provenance": true
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build:docs": "typedoc",
|
||||
"lint": "oxfmt --check . && oxlint",
|
||||
"lint:fix": "oxfmt --write . && oxlint --fix",
|
||||
"prepare": "husky",
|
||||
"prepublishOnly": "npm run build",
|
||||
"test": "vitest run --coverage",
|
||||
"test:nonetwork": "npm run lint && vitest run --coverage --testPathIgnorePatterns network.spec"
|
||||
},
|
||||
"files": [
|
||||
"dist/",
|
||||
"README.md"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=22.12.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": "^4.1.1",
|
||||
"env-paths": "^3.0.0",
|
||||
"graceful-fs": "^4.2.11",
|
||||
"progress": "^2.0.3",
|
||||
"semver": "^7.6.3",
|
||||
"sumchecker": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/node22": "^22.0.0",
|
||||
"@types/debug": "^4.1.4",
|
||||
"@types/graceful-fs": "^4.1.9",
|
||||
"@types/node": "~22.12.0",
|
||||
"@types/progress": "^2.0.3",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@vitest/coverage-v8": "^4.1.2",
|
||||
"esbuild-plugin-file-path-extensions": "^2.1.4",
|
||||
"husky": "^9.1.7",
|
||||
"lint-staged": "^16.2.7",
|
||||
"oxfmt": "^0.44.0",
|
||||
"oxlint": "^1.59.0",
|
||||
"oxlint-tsgolint": "^0.20.0",
|
||||
"typedoc": "~0.28.0",
|
||||
"typescript": "^6.0.2",
|
||||
"vitest": "^4.1.2"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts}": [
|
||||
"oxfmt --write",
|
||||
"oxlint --fix"
|
||||
],
|
||||
"*.{json}": [
|
||||
"oxfmt --write"
|
||||
]
|
||||
},
|
||||
"keywords": [
|
||||
"electron",
|
||||
"download",
|
||||
"prebuild",
|
||||
"get",
|
||||
"artifact",
|
||||
"release"
|
||||
],
|
||||
"optionalDependencies": {
|
||||
"undici": "^7.24.4"
|
||||
},
|
||||
"resolutions": {
|
||||
"fsevents": "npm:@electron/fsevents@2.3.3-fork"
|
||||
},
|
||||
"packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Copyright 2018 Samuel Attard and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
Electron Notarize
|
||||
-----------
|
||||
|
||||
> Notarize your Electron apps seamlessly for macOS
|
||||
|
||||
[](https://circleci.com/gh/electron/notarize)
|
||||
[](https://npm.im/@electron/notarize)
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @electron/notarize --save-dev
|
||||
```
|
||||
|
||||
## What is app "notarization"?
|
||||
|
||||
From Apple's docs in XCode:
|
||||
|
||||
> A notarized app is a macOS app that was uploaded to Apple for processing before it was distributed.
|
||||
> When you export a notarized app from Xcode, it code signs the app with a Developer ID certificate
|
||||
> and staples a ticket from Apple to the app. The ticket confirms that you previously uploaded the app to Apple.
|
||||
|
||||
> On macOS 10.14 and later, the user can launch notarized apps when Gatekeeper is enabled.
|
||||
> When the user first launches a notarized app, Gatekeeper looks for the app’s ticket online.
|
||||
> If the user is offline, Gatekeeper looks for the ticket that was stapled to the app.
|
||||
|
||||
As macOS 10.15 (Catalina), Apple has made notarization a hard requirement for all applications
|
||||
distributed outside of the Mac App Store. App Store applications do not need to be notarized.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
For notarization, you need the following things:
|
||||
|
||||
1. Xcode 13 or later installed on your Mac.
|
||||
1. An [Apple Developer](https://developer.apple.com/) account.
|
||||
1. [An app-specific password for your ADC account’s Apple ID](https://support.apple.com/HT204397).
|
||||
1. Your app may need to be signed with `hardenedRuntime: true` option, with the `com.apple.security.cs.allow-jit` entitlement.
|
||||
|
||||
> [!NOTE]
|
||||
> If you are using Electron 11 or below, you must add the `com.apple.security.cs.allow-unsigned-executable-memory` entitlement too.
|
||||
> When using version 12+, this entitlement should not be applied as it increases your app's attack surface.
|
||||
|
||||
### Notarization on older macOS versions
|
||||
|
||||
Xcode 13 is available from macOS 11.3, but notarization can be performed on systems down to macOS 10.15
|
||||
(see [TN3147](https://developer.apple.com/documentation/technotes/tn3147-migrating-to-the-latest-notarization-tool#Enable-notarization-on-an-older-version-of-macOS) for more information).
|
||||
|
||||
To achieve this, you can copy notarytool binary from a newer macOS version and provide its path as `notarytoolPath` option.
|
||||
|
||||
## API
|
||||
|
||||
`@electron/notarize` exposes a single `notarize` function that accepts the following parameters:
|
||||
* `appPath` — the absolute path to your codesigned and packaged Electron application.
|
||||
* `notarytoolPath` - String (optional) - Path of the notarytool binary ([more details](#notarization-on-older-macos-versions))
|
||||
* additional options required for authenticating your Apple ID (see below)
|
||||
|
||||
The method returns a void Promise once app notarization is complete. Please note that notarization may take
|
||||
many minutes.
|
||||
|
||||
If the notarization process is unusually log for your application, see Apple Developer's docs to
|
||||
[Avoid long notarization response times and size limits](https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow#3561440).
|
||||
|
||||
### Usage with app-specific password
|
||||
|
||||
You can generate an [app-specific password](https://support.apple.com/en-us/102654) for your Apple ID
|
||||
to notarize your Electron applications.
|
||||
|
||||
This method also requires you to specify the [Team ID](https://developer.apple.com/help/account/manage-your-team/locate-your-team-id/)
|
||||
of the Developer Team you want to notarize under. An Apple ID may be part of multiple Teams.
|
||||
|
||||
```javascript
|
||||
import { notarize } from '@electron/notarize';
|
||||
|
||||
await notarize({
|
||||
appPath,
|
||||
appleId, // Login name of your Apple Developer account
|
||||
appleIdPassword, // App-specific password
|
||||
teamId, // Team ID for your developer team
|
||||
});
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Never hard code your app-specific password into your packaging scripts.** Use an environment
|
||||
> variable at a minimum.
|
||||
|
||||
### Usage with App Store Connect API key
|
||||
|
||||
Alternatively, you can also authenticate via JSON Web Token (JWT) with App Store Connect.
|
||||
|
||||
You can obtain an API key from [App Store Connect](https://appstoreconnect.apple.com/access/integrations/api).
|
||||
Create a **Team Key** (not an _Individual Key_) with **App Manager** access.
|
||||
|
||||
Note down the Issuer ID (UUID format) and Key ID (10-character alphanumeric string),
|
||||
and download the `.p8` API key file (`AuthKey_<appleApiKeyId>.p8`).
|
||||
For security purposes, the private key can only be downloaded once.
|
||||
|
||||
Provide the absolute path to your API key as the `appleApiKey` argument.
|
||||
|
||||
```javascript
|
||||
import { notarize } from '@electron/notarize';
|
||||
|
||||
await notarize({
|
||||
appPath,
|
||||
appleApiKey, // Absolute path to API key (e.g. `/path/to/AuthKey_X0X0X0X0X0.p8`)
|
||||
appleApiIssuer, // Issuer ID (e.g. `d5631714-a680-4b4b-8156-b4ed624c0845`)
|
||||
});
|
||||
```
|
||||
|
||||
### Usage with Keychain credentials
|
||||
|
||||
As an alternative to passing authentication options, you can also store your authentication
|
||||
credentials (for both API key and app-specific password strategies) in the macOS Keychain
|
||||
via the `xcrun notarytool` command-line utility.
|
||||
|
||||
This method has the advantage of validating your notarization credentials before submitting
|
||||
your application for notarization.
|
||||
|
||||
For example:
|
||||
|
||||
```sh
|
||||
# App-specific password strategy
|
||||
xcrun notarytool store-credentials "my-app-password-profile"
|
||||
--apple-id "<AppleID>"
|
||||
--team-id <DeveloperTeamID>
|
||||
--password <app_specific_password>
|
||||
```
|
||||
|
||||
```sh
|
||||
# App Store Connect API key strategy
|
||||
xcrun notarytool store-credentials "my-api-key-profile"
|
||||
--key "<PathToAPIKey>"
|
||||
--key-id <KeyID>
|
||||
--issuer <IssuerID>
|
||||
```
|
||||
|
||||
Successful storage of your credentials will look like this:
|
||||
|
||||
```
|
||||
This process stores your credentials securely in the Keychain. You reference these credentials later using a profile name.
|
||||
|
||||
Validating your credentials...
|
||||
Success. Credentials validated.
|
||||
Credentials saved to Keychain.
|
||||
To use them, specify `--keychain-profile "my-api-key-profile"`
|
||||
```
|
||||
|
||||
After successfully storing your credentials, pass the keychain profile name into
|
||||
the `keychainProfile` parameter.
|
||||
|
||||
```javascript
|
||||
import { notarize } from '@electron/notarize';
|
||||
|
||||
await notarize({
|
||||
appPath,
|
||||
keychainProfile,
|
||||
});
|
||||
```
|
||||
## Troubleshooting
|
||||
|
||||
### Debug logging
|
||||
|
||||
[`debug`](https://www.npmjs.com/package/debug) is used to display logs and messages.
|
||||
Run your notarization scripts with the `DEBUG=electron-notarize*` environment variable to log additional
|
||||
debug information from this module.
|
||||
|
||||
### Validating credentials
|
||||
|
||||
When notarizing your application, you may run into issues with validating your notarization
|
||||
credentials.
|
||||
|
||||
```
|
||||
Error: HTTP status code: 401. Invalid credentials. Username or password is incorrect.
|
||||
Use the app-specific password generated at appleid.apple.com. Ensure that all authentication arguments are correct.
|
||||
```
|
||||
|
||||
[Storing your credentials in Keychain](#usage-with-keychain-credentials) will validate your credentials before
|
||||
even GitHub.
|
||||
|
||||
### Validating app notarization
|
||||
|
||||
To validate that notarization worked, you can use the `stapler` command-line utility:
|
||||
|
||||
```sh
|
||||
stapler validate path/to/notarized.app
|
||||
```
|
||||
|
||||
### Apple documentation
|
||||
|
||||
Apple also provides additional debugging documentation on
|
||||
[Resolving common notarization issues](https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/resolving_common_notarization_issues).
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import { NotaryToolNotarizeAppOptions } from './types';
|
||||
export declare function checkSignatures(opts: NotaryToolNotarizeAppOptions): Promise<void>;
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.checkSignatures = void 0;
|
||||
const path = __importStar(require("path"));
|
||||
const spawn_1 = require("./spawn");
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const d = (0, debug_1.default)('electron-notarize');
|
||||
const codesignDisplay = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const result = yield (0, spawn_1.spawn)('codesign', ['-dv', '-vvvv', '--deep', path.basename(opts.appPath)], {
|
||||
cwd: path.dirname(opts.appPath),
|
||||
});
|
||||
return result;
|
||||
});
|
||||
const codesign = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
d('attempting to check codesign of app:', opts.appPath);
|
||||
const result = yield (0, spawn_1.spawn)('codesign', ['-vvv', '--deep', '--strict', path.basename(opts.appPath)], {
|
||||
cwd: path.dirname(opts.appPath),
|
||||
});
|
||||
return result;
|
||||
});
|
||||
function checkSignatures(opts) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const fileExt = path.extname(opts.appPath);
|
||||
if (fileExt === '.dmg' || fileExt === '.pkg') {
|
||||
d('skipping codesign check for dmg or pkg file');
|
||||
return;
|
||||
}
|
||||
const [codesignResult, codesignInfo] = yield Promise.all([codesign(opts), codesignDisplay(opts)]);
|
||||
let error = '';
|
||||
if (codesignInfo.code !== 0) {
|
||||
d('codesignInfo failed');
|
||||
error = `Failed to display codesign info on your application with code: ${codesignInfo.code}\n\n${codesignInfo.output}\n`;
|
||||
}
|
||||
if (codesignResult.code !== 0) {
|
||||
d('codesign check failed');
|
||||
error += `Failed to codesign your application with code: ${codesignResult.code}\n\n${codesignResult.output}\n\n${codesignInfo.output}`;
|
||||
}
|
||||
if (error) {
|
||||
throw new Error(error);
|
||||
}
|
||||
d('codesign assess succeeded');
|
||||
});
|
||||
}
|
||||
exports.checkSignatures = checkSignatures;
|
||||
//# sourceMappingURL=check-signature.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"check-signature.js","sourceRoot":"","sources":["../src/check-signature.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,mCAAgC;AAEhC,kDAA0B;AAC1B,MAAM,CAAC,GAAG,IAAA,eAAK,EAAC,mBAAmB,CAAC,CAAC;AAErC,MA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AC,qBAAqB,CAAC,CAAC;YACzB,KAAK,GAAG,kEAAkE,YAAY,CAAC,IAAI,OAAO,YAAY,CAAC,MAAM,IAAI,CAAC;SAC3H;QACD,IAAI,cAAc,CAAC,IAAI,KAAK,CAAC,EAAE;YAC7B,CAAC,CAAC,uBAAuB,CAAC,CAAC;YAC3B,KAAK,IAAI,kDAAkD,cAAc,CAAC,IAAI,OAAO,cAAc,CAAC,MAAM,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;SACxI;QAED,IAAI,KAAK,EAAE;YACT,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;QACD,CAAC,CAAC,2BAA2B,CAAC,CAAC;IACjC,CAAC;CAAA;AAtBD,0CAsBC"}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
export declare function withTempDir<T>(fn: (dir: string) => Promise<T>): Promise<T>;
|
||||
export declare function makeSecret(s: string): string;
|
||||
export declare function isSecret(s: string): boolean;
|
||||
export interface NotarizationInfo {
|
||||
uuid: string;
|
||||
date: Date;
|
||||
status: 'invalid' | 'in progress' | 'success';
|
||||
logFileUrl: string | null;
|
||||
statusCode?: 0 | 2;
|
||||
statusMessage?: string;
|
||||
}
|
||||
export declare function parseNotarizationInfo(info: string): NotarizationInfo;
|
||||
export declare function delay(ms: number): Promise<void>;
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.delay = exports.parseNotarizationInfo = exports.isSecret = exports.makeSecret = exports.withTempDir = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const d = (0, debug_1.default)('electron-notarize:helpers');
|
||||
function withTempDir(fn) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const dir = yield fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-notarize-'));
|
||||
d('doing work inside temp dir:', dir);
|
||||
let result;
|
||||
try {
|
||||
result = yield fn(dir);
|
||||
}
|
||||
catch (err) {
|
||||
d('work failed');
|
||||
yield fs.remove(dir);
|
||||
throw err;
|
||||
}
|
||||
d('work succeeded');
|
||||
yield fs.remove(dir);
|
||||
return result;
|
||||
});
|
||||
}
|
||||
exports.withTempDir = withTempDir;
|
||||
class Secret {
|
||||
constructor(value) {
|
||||
this.value = value;
|
||||
}
|
||||
toString() {
|
||||
return this.value;
|
||||
}
|
||||
inspect() {
|
||||
return '******';
|
||||
}
|
||||
}
|
||||
function makeSecret(s) {
|
||||
return new Secret(s);
|
||||
}
|
||||
exports.makeSecret = makeSecret;
|
||||
function isSecret(s) {
|
||||
return s instanceof Secret;
|
||||
}
|
||||
exports.isSecret = isSecret;
|
||||
function parseNotarizationInfo(info) {
|
||||
const out = {};
|
||||
const matchToProperty = (key, r, modifier) => {
|
||||
const exec = r.exec(info);
|
||||
if (exec) {
|
||||
out[key] = modifier ? modifier(exec[1]) : exec[1];
|
||||
}
|
||||
};
|
||||
matchToProperty('uuid', /\n *RequestUUID: (.+?)\n/);
|
||||
matchToProperty('date', /\n *Date: (.+?)\n/, d => new Date(d));
|
||||
matchToProperty('status', /\n *Status: (.+?)\n/);
|
||||
matchToProperty('logFileUrl', /\n *LogFileURL: (.+?)\n/);
|
||||
matchToProperty('statusCode', /\n *Status Code: (.+?)\n/, n => parseInt(n, 10));
|
||||
matchToProperty('statusMessage', /\n *Status Message: (.+?)\n/);
|
||||
if (out.logFileUrl === '(null)') {
|
||||
out.logFileUrl = null;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
exports.parseNotarizationInfo = parseNotarizationInfo;
|
||||
function delay(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
exports.delay = delay;
|
||||
//# sourceMappingURL=helpers.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,6CAA+B;AAC/B,uCAAyB;AACzB,2CAA6B;AAE7B,MAAM,CAAC,GAAG,IA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,CAAC;QAC1B,IAAI,IAAI,EAAE;YACR,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACnD;IACH,CAAC,CAAC;IACF,eAAe,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;IACpD,eAAe,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,eAAe,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;IACjD,eAAe,CAAC,YAAY,EAAE,yBAAyB,CAAC,CAAC;IACzD,eAAe,CAAC,YAAY,EAAE,0BAA0B,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAQ,CAAC,CAAC;IACvF,eAAe,CAAC,eAAe,EAAE,6BAA6B,CAAC,CAAC;IAEhE,IAAI,GAAG,CAAC,UAAU,KAAK,QAAQ,EAAE;QAC/B,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC;KACvB;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAxBD,sDAwBC;AAED,SAAgB,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AACzD,CAAC;AAFD,sBAEC"}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import { NotarizeOptions, NotarizeOptionsLegacy, NotarizeOptionsNotaryTool } from './types';
|
||||
export { NotarizeOptions };
|
||||
export { validateNotaryToolAuthorizationArgs as validateAuthorizationArgs } from './validate-args';
|
||||
/**
|
||||
* Sends your app to Apple for notarization with `notarytool` and staples a successful
|
||||
* notarization result to the app bundle. This includes your {@link NotaryToolNotarizeAppOptions.appPath | appPath}
|
||||
* as well as one of three valid credential authentication strategies.
|
||||
*
|
||||
* See {@link NotaryToolCredentials} for authentication options.
|
||||
*
|
||||
* @category Core
|
||||
* @param args Options for notarization
|
||||
* @returns The Promise resolves once notarization is complete. Note that this may take a few minutes.
|
||||
*/
|
||||
declare function notarize(args: NotarizeOptionsNotaryTool): Promise<void>;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
declare function notarize(args: NotarizeOptionsLegacy): Promise<void>;
|
||||
export { notarize };
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.notarize = exports.validateAuthorizationArgs = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const promise_retry_1 = __importDefault(require("promise-retry"));
|
||||
const check_signature_1 = require("./check-signature");
|
||||
const notarytool_1 = require("./notarytool");
|
||||
const staple_1 = require("./staple");
|
||||
const d = (0, debug_1.default)('electron-notarize');
|
||||
var validate_args_1 = require("./validate-args");
|
||||
Object.defineProperty(exports, "validateAuthorizationArgs", { enumerable: true, get: function () { return validate_args_1.validateNotaryToolAuthorizationArgs; } });
|
||||
function notarize(_a) {
|
||||
var { appPath } = _a, otherOptions = __rest(_a, ["appPath"]);
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (otherOptions.tool === 'legacy') {
|
||||
throw new Error('Notarization with the legacy altool system was decommisioned as of November 2023');
|
||||
}
|
||||
yield (0, check_signature_1.checkSignatures)({ appPath });
|
||||
d('notarizing using notarytool');
|
||||
if (!(yield (0, notarytool_1.isNotaryToolAvailable)())) {
|
||||
throw new Error('notarytool is not available, you must be on at least Xcode 13 or provide notarytoolPath');
|
||||
}
|
||||
yield (0, notarytool_1.notarizeAndWaitForNotaryTool)(Object.assign({ appPath }, otherOptions));
|
||||
yield (0, promise_retry_1.default)(() => (0, staple_1.stapleApp)({ appPath }), {
|
||||
retries: 3,
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.notarize = notarize;
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,kEAAkC;AAElC,uDAAoD;AACpD,6CAAmF;AACnF,qCAAqC;AAQrC,MAAM,CAAC,GAAG,IAAA,eAAK,EAAC,mBAAmB,CAAC,CAAC;AAIrC,iDAAmG;AAA1F,0HAAA,mCAAmC,OAA6B;AAmBzE,SAAe,QAAQ,CAAC,EAA6C;QAA7C,EAAE,OAAO,OAAoC,EAA/B,YAAY,cAA1B,WAA4B,CAAF;;QAChD,IAAI,YAAY,CAAC,IAAI,KAAK,QAAQ,EAAE;YAClC,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAC;SACH;QAED,MAAM,IAAA,iCAAe,EAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAEnC,CAAC,CAAC,6BAA6B,CAAC,CAAC;QACjC,IAAI,CAAC,CAAC,MAAM,IAAA,kCAAqB,GAAE,CAAC,EAAE;YACpC,MAAM,IAAI,KAAK,CACb,yFAAyF,CAC1F,CAAC;SACH;QAED,MAAM,IAAA,yCAA4B,EAAC,gBACjC,OAAO,IACJ,YAAY,CACU,CAAC,CAAC;QAE7B,MAAM,IAAA,uBAAK,EAAC,GAAG,EAAE,CAAC,IAAA,kBAAS,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE;YACxC,OAAO,EAAE,CAAC;SACX,CAAC,CAAC;;CACJ;AAEQ,4BAAQ"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { LegacyNotarizeStartOptions, LegacyNotarizeWaitOptions } from './types';
|
||||
/** @deprecated */
|
||||
export declare function startLegacyNotarize(opts: LegacyNotarizeStartOptions): Promise<never>;
|
||||
/** @deprecated */
|
||||
export declare function waitForLegacyNotarize(opts: LegacyNotarizeWaitOptions): Promise<never>;
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.waitForLegacyNotarize = exports.startLegacyNotarize = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const d = (0, debug_1.default)('electron-notarize:legacy');
|
||||
/** @deprecated */
|
||||
function startLegacyNotarize(opts) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
d('starting notarize process for app:', opts.appPath);
|
||||
throw new Error('Cannot start notarization. Legacy notarization (altool) is no longer available');
|
||||
});
|
||||
}
|
||||
exports.startLegacyNotarize = startLegacyNotarize;
|
||||
/** @deprecated */
|
||||
function waitForLegacyNotarize(opts) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
throw new Error('Cannot wait for notarization. Legacy notarization (altool) is no longer available');
|
||||
});
|
||||
}
|
||||
exports.waitForLegacyNotarize = waitForLegacyNotarize;
|
||||
//# sourceMappingURL=legacy.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"legacy.js","sourceRoot":"","sources":["../src/legacy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAI1B,MAAM,CAAC,GAAG,IAAA,eAAK,EAAC,0BAA0B,CAAC,CAAC;AAE5C,kBAAkB;AAClB,SAAsB,mBAAmB,CAAC,IAAgC;;QACxE,CAAC,CAAC,oCAAoC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;IACpG,CAAC;CAAA;AAHD,kDAGC;AAED,kBAAkB;AAClB,SAAsB,qBAAqB,CAAC,IAA+B;;QACzE,MAAM,IAAI,KAAK,CACb,mFAAmF,CACpF,CAAC;IACJ,CAAC;CAAA;AAJD,sDAIC"}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import { NotaryToolStartOptions } from './types';
|
||||
export declare function isNotaryToolAvailable(notarytoolPath?: string): Promise<boolean>;
|
||||
export declare function notarizeAndWaitForNotaryTool(opts: NotaryToolStartOptions): Promise<void>;
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.notarizeAndWaitForNotaryTool = exports.isNotaryToolAvailable = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const path = __importStar(require("path"));
|
||||
const spawn_1 = require("./spawn");
|
||||
const helpers_1 = require("./helpers");
|
||||
const validate_args_1 = require("./validate-args");
|
||||
const d = (0, debug_1.default)('electron-notarize:notarytool');
|
||||
function runNotaryTool(args, notarytoolPath) {
|
||||
const useXcrun = notarytoolPath === undefined;
|
||||
const cmd = useXcrun ? 'xcrun' : notarytoolPath;
|
||||
return (0, spawn_1.spawn)(cmd, useXcrun ? ['notarytool', ...args] : args);
|
||||
}
|
||||
function authorizationArgs(rawOpts) {
|
||||
const opts = (0, validate_args_1.validateNotaryToolAuthorizationArgs)(rawOpts);
|
||||
if ((0, validate_args_1.isNotaryToolPasswordCredentials)(opts)) {
|
||||
return [
|
||||
'--apple-id',
|
||||
(0, helpers_1.makeSecret)(opts.appleId),
|
||||
'--password',
|
||||
(0, helpers_1.makeSecret)(opts.appleIdPassword),
|
||||
'--team-id',
|
||||
(0, helpers_1.makeSecret)(opts.teamId),
|
||||
];
|
||||
}
|
||||
else if ((0, validate_args_1.isNotaryToolApiKeyCredentials)(opts)) {
|
||||
return [
|
||||
'--key',
|
||||
(0, helpers_1.makeSecret)(opts.appleApiKey),
|
||||
'--key-id',
|
||||
(0, helpers_1.makeSecret)(opts.appleApiKeyId),
|
||||
'--issuer',
|
||||
(0, helpers_1.makeSecret)(opts.appleApiIssuer),
|
||||
];
|
||||
}
|
||||
else {
|
||||
// --keychain is optional -- when not specified, the iCloud keychain is used by notarytool
|
||||
if (opts.keychain) {
|
||||
return ['--keychain', opts.keychain, '--keychain-profile', opts.keychainProfile];
|
||||
}
|
||||
return ['--keychain-profile', opts.keychainProfile];
|
||||
}
|
||||
}
|
||||
function getNotarizationLogs(opts, id) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const logResult = yield runNotaryTool(['log', id, ...authorizationArgs(opts)], opts.notarytoolPath);
|
||||
d('notarization log', logResult.output);
|
||||
return logResult.output;
|
||||
}
|
||||
catch (e) {
|
||||
d('failed to pull notarization logs', e);
|
||||
}
|
||||
});
|
||||
}
|
||||
function isNotaryToolAvailable(notarytoolPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (notarytoolPath !== undefined) {
|
||||
const result = yield (0, spawn_1.spawn)(notarytoolPath, ['--version']);
|
||||
return result.code === 0;
|
||||
}
|
||||
else {
|
||||
const result = yield (0, spawn_1.spawn)('xcrun', ['--find', 'notarytool']);
|
||||
return result.code === 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.isNotaryToolAvailable = isNotaryToolAvailable;
|
||||
function notarizeAndWaitForNotaryTool(opts) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
d('starting notarize process for app:', opts.appPath);
|
||||
return yield (0, helpers_1.withTempDir)((dir) => __awaiter(this, void 0, void 0, function* () {
|
||||
const fileExt = path.extname(opts.appPath);
|
||||
let filePath;
|
||||
if (fileExt === '.dmg' || fileExt === '.pkg') {
|
||||
filePath = path.resolve(dir, opts.appPath);
|
||||
d('attempting to upload file to Apple: ', filePath);
|
||||
}
|
||||
else {
|
||||
filePath = path.resolve(dir, `${path.parse(opts.appPath).name}.zip`);
|
||||
d('zipping application to:', filePath);
|
||||
const zipResult = yield (0, spawn_1.spawn)('ditto', ['-c', '-k', '--sequesterRsrc', '--keepParent', path.basename(opts.appPath), filePath], {
|
||||
cwd: path.dirname(opts.appPath),
|
||||
});
|
||||
if (zipResult.code !== 0) {
|
||||
throw new Error(`Failed to zip application, exited with code: ${zipResult.code}\n\n${zipResult.output}`);
|
||||
}
|
||||
d('zip succeeded, attempting to upload to Apple');
|
||||
}
|
||||
const notarizeArgs = [
|
||||
'submit',
|
||||
filePath,
|
||||
...authorizationArgs(opts),
|
||||
'--wait',
|
||||
'--output-format',
|
||||
'json',
|
||||
];
|
||||
const result = yield runNotaryTool(notarizeArgs, opts.notarytoolPath);
|
||||
const rawOut = result.output.trim();
|
||||
let parsed;
|
||||
try {
|
||||
parsed = JSON.parse(rawOut);
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`Failed to notarize via notarytool. Failed with unexpected result: \n\n${rawOut}`);
|
||||
}
|
||||
let logOutput;
|
||||
if (typeof parsed.id === 'string') {
|
||||
logOutput = yield getNotarizationLogs(opts, parsed.id);
|
||||
}
|
||||
if (result.code === 0 && parsed.status === 'Accepted') {
|
||||
d(`notarization success (id: ${parsed.id})`);
|
||||
return;
|
||||
}
|
||||
let message = `Failed to notarize via notarytool\n\n${result.output}`;
|
||||
if (logOutput) {
|
||||
message += `\n\nDiagnostics from notarytool log: ${logOutput}`;
|
||||
}
|
||||
throw new Error(message);
|
||||
}));
|
||||
});
|
||||
}
|
||||
exports.notarizeAndWaitForNotaryTool = notarizeAndWaitForNotaryTool;
|
||||
//# sourceMappingURL=notarytool.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"notarytool.js","sourceRoot":"","sources":["../src/notarytool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,2CAA6B;AAE7B,mCAAgC;AAChC,uCAAoD;AACpD,mDAIyB;AAGzB,MAAM,CAAC,GAAG,IAAA,eAAK,EAAC,8BAA8B,CAAC,CAAC;AAEhD,SAAS,aAAa,CAAC,IAAc,EAAE,cAAuB;IAC5D,MAAM,QAAQ,GAAG,cAAc,KAAK,SAAS,CAAC;IAC9C,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC;IAChD,OAAO,IAAA,aAAK,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CAAC,OAA8B;IACvD,MAAM,IAAI,GAAG,IAAA,mDAAmC,EAAC,OAAO,CAAC,CAAC;IAC1D,I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AAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC,CAAA,CAAC,CAAC;IACL,CAAC;CAAA;AA/DD,oEA+DC"}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import { SpawnOptions } from 'child_process';
|
||||
export interface SpawnResult {
|
||||
code: number | null;
|
||||
output: string;
|
||||
}
|
||||
export declare const spawn: (cmd: string, args?: string[], opts?: SpawnOptions) => Promise<SpawnResult>;
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.spawn = void 0;
|
||||
const child_process_1 = require("child_process");
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const helpers_1 = require("./helpers");
|
||||
const d = (0, debug_1.default)('electron-notarize:spawn');
|
||||
const spawn = (cmd, args = [], opts = {}) => {
|
||||
d('spawning cmd:', cmd, 'args:', args.map(arg => ((0, helpers_1.isSecret)(arg) ? '*********' : arg)), 'opts:', opts);
|
||||
const child = (0, child_process_1.spawn)(cmd, args, opts);
|
||||
const out = [];
|
||||
const dataHandler = (data) => out.push(data.toString());
|
||||
child.stdout.on('data', dataHandler);
|
||||
child.stderr.on('data', dataHandler);
|
||||
return new Promise((resolve, reject) => {
|
||||
child.on('error', err => {
|
||||
reject(err);
|
||||
});
|
||||
child.on('exit', code => {
|
||||
d(`cmd ${cmd} terminated with code: ${code}`);
|
||||
resolve({
|
||||
code,
|
||||
output: out.join(''),
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
exports.spawn = spawn;
|
||||
//# sourceMappingURL=spawn.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"spawn.js","sourceRoot":"","sources":["../src/spawn.ts"],"names":[],"mappings":";;;;;;AAAA,iDAA+D;AAC/D,kDAA0B;AAC1B,uCAAqC;AAErC,MAAM,CAAC,GAAG,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hB"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import { NotaryToolNotarizeAppOptions } from './types';
|
||||
export declare function stapleApp(opts: NotaryToolNotarizeAppOptions): Promise<void>;
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stapleApp = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const path = __importStar(require("path"));
|
||||
const spawn_1 = require("./spawn");
|
||||
const d = (0, debug_1.default)('electron-notarize:staple');
|
||||
function stapleApp(opts) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
d('attempting to staple app:', opts.appPath);
|
||||
const result = yield (0, spawn_1.spawn)('xcrun', ['stapler', 'staple', '-v', path.basename(opts.appPath)], {
|
||||
cwd: path.dirname(opts.appPath),
|
||||
});
|
||||
if (result.code !== 0) {
|
||||
throw new Error(`Failed to staple your application with code: ${result.code}\n\n${result.output}`);
|
||||
}
|
||||
d('staple succeeded');
|
||||
return;
|
||||
});
|
||||
}
|
||||
exports.stapleApp = stapleApp;
|
||||
//# sourceMappingURL=staple.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"staple.js","sourceRoot":"","sources":["../src/staple.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,2CAA6B;AAE7B,mCAAgC;AAGhC,MAAM,CAAC,GAAG,IAAA,eAAK,EAAC,0BAA0B,CAAC,CAAC;AAE5C,SAAsB,SAAS,CAAC,IAAkC;;QAChE,CAAC,CAAC,2BAA2B,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,MAAM,GAAG,MAAM,IAAA,aAAK,EAAC,OAAO,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE;YAC5F,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;SAChC,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE;YACrB,MAAM,IAAI,KAAK,CACb,gDAAgD,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,MAAM,EAAE,CAClF,CAAC;SACH;QAED,CAAC,CAAC,kBAAkB,CAAC,CAAC;QACtB,OAAO;IACT,CAAC;CAAA;AAdD,8BAcC"}
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
* @deprecated This interface was used for Apple's `altool`, which was sunset in 2023 and no longer works.
|
||||
* @category Legacy
|
||||
*/
|
||||
export interface LegacyNotarizePasswordCredentials {
|
||||
appleId: string;
|
||||
appleIdPassword: string;
|
||||
}
|
||||
/**
|
||||
* You can generate an [app-specific password](https://support.apple.com/en-us/102654) for your Apple ID
|
||||
* to notarize your Electron applications.
|
||||
*
|
||||
* This method also requires you to specify the [Team ID](https://developer.apple.com/help/account/manage-your-team/locate-your-team-id/)
|
||||
* of the Developer Team you want to notarize under. An Apple ID may be part of multiple Teams.
|
||||
*
|
||||
* @category Credential Strategies
|
||||
*/
|
||||
export interface NotaryToolPasswordCredentials {
|
||||
/**
|
||||
* The login username of your Apple Developer account.
|
||||
*/
|
||||
appleId: string;
|
||||
/**
|
||||
* An [app-specific password](https://support.apple.com/en-us/102654) for your
|
||||
* Apple ID (**not** your Apple ID password).
|
||||
*
|
||||
* Do **not** hard code this password into your packaging scripts.
|
||||
*/
|
||||
appleIdPassword: string;
|
||||
/**
|
||||
* The [Team ID](https://developer.apple.com/help/account/manage-your-team/locate-your-team-id/)
|
||||
* for the Developer Team you want to notarize under. Your Apple ID may be a member of multiple
|
||||
* teams.
|
||||
*/
|
||||
teamId: string;
|
||||
}
|
||||
/**
|
||||
* @deprecated This interface was used for Apple's `altool`, which was sunset in 2023 and no longer works.
|
||||
* @category Legacy
|
||||
*/
|
||||
export interface LegacyNotarizeApiKeyCredentials {
|
||||
appleApiKey: string;
|
||||
appleApiIssuer: string;
|
||||
}
|
||||
/**
|
||||
* Credentials required for JSON Web Token (JWT) notarization using App Store Connect API keys.
|
||||
*
|
||||
* @category Credential Strategies
|
||||
*/
|
||||
export interface NotaryToolApiKeyCredentials {
|
||||
/**
|
||||
* File system path to the `.p8` private key of your App Store Connect API key.
|
||||
*/
|
||||
appleApiKey: string;
|
||||
/**
|
||||
* App Store Connect API Key ID (e.g. `T9GPZ92M7K`).
|
||||
*
|
||||
*/
|
||||
appleApiKeyId: string;
|
||||
/**
|
||||
* App Store Connect API Issuer ID. The issuer ID is a UUID format string
|
||||
* (e.g. `c055ca8c-e5a8-4836-b61d-aa5794eeb3f4`).
|
||||
*/
|
||||
appleApiIssuer: string;
|
||||
}
|
||||
/**
|
||||
* Options required for authenticating notarytool by storing
|
||||
* credentials inside the system Keychain item.
|
||||
*
|
||||
* You can store {@link NotaryToolPasswordCredentials} or
|
||||
* {@link NotaryToolApiKeyCredentials} into the Keychain
|
||||
* using `xcrun notarytool store-credentials` and access the
|
||||
* stored secrets when signing your code.
|
||||
*
|
||||
* @category Credential Strategies
|
||||
*/
|
||||
export interface NotaryToolKeychainCredentials {
|
||||
/**
|
||||
* The name of the profile you provided when storing notarization credentials.
|
||||
*/
|
||||
keychainProfile: string;
|
||||
/**
|
||||
* The name of the keychain or path to the keychain you stored notarization credentials in.
|
||||
* @defaultValue If omitted, the system default `login` keychain will be used.
|
||||
*/
|
||||
keychain?: string;
|
||||
}
|
||||
/**
|
||||
* @deprecated This interface was used for Apple's `altool`, which was sunset in 2023 and no longer works.
|
||||
* @category Legacy
|
||||
*/
|
||||
export type LegacyNotarizeCredentials = LegacyNotarizePasswordCredentials | LegacyNotarizeApiKeyCredentials;
|
||||
/**
|
||||
* Credential options for authenticating `notarytool`. There are three valid stategies available:
|
||||
*
|
||||
* - {@link NotaryToolPasswordCredentials} — Using an Apple ID and app-specific password
|
||||
* - {@link NotaryToolApiKeyCredentials} — Using an App Store Connect API key
|
||||
* - {@link NotaryToolKeychainCredentials} — Using one of the two above credential sets stored within the macOS Keychain
|
||||
* @category Credential Strategies
|
||||
*/
|
||||
export type NotaryToolCredentials = NotaryToolPasswordCredentials | NotaryToolApiKeyCredentials | NotaryToolKeychainCredentials;
|
||||
/**
|
||||
* @deprecated This interface was used for Apple's `altool`, which was sunset in 2023 and no longer works.
|
||||
* @category Legacy
|
||||
*/
|
||||
export interface LegacyNotarizeAppOptions {
|
||||
appPath: string;
|
||||
appBundleId: string;
|
||||
}
|
||||
/**
|
||||
* Non-credential options for notarizing your application with `notarytool`.
|
||||
* @category Core
|
||||
*/
|
||||
export interface NotaryToolNotarizeAppOptions {
|
||||
/**
|
||||
* Absolute path to your packaged and codesigned Electron application.
|
||||
*/
|
||||
appPath: string;
|
||||
notarytoolPath?: string;
|
||||
}
|
||||
/**
|
||||
* @deprecated This interface was used for Apple's `altool`, which was sunset in 2023 and no longer works.
|
||||
* @category Legacy
|
||||
*/
|
||||
interface TransporterOptions {
|
||||
ascProvider?: string;
|
||||
}
|
||||
/**
|
||||
* @deprecated This interface was used for Apple's `altool`, which was sunset in 2023 and no longer works.
|
||||
* @category Legacy
|
||||
*/
|
||||
interface NotarizeResult {
|
||||
uuid: string;
|
||||
}
|
||||
/**
|
||||
* @deprecated This type was used for Apple's `altool`, which was sunset in 2023 and no longer works.
|
||||
* @category Legacy
|
||||
*/
|
||||
export type LegacyNotarizeStartOptions = LegacyNotarizeAppOptions & LegacyNotarizeCredentials & TransporterOptions;
|
||||
/**
|
||||
* @deprecated This type was used for Apple's `altool`, which was sunset in 2023 and no longer works.
|
||||
* @category Legacy
|
||||
*/
|
||||
export type LegacyNotarizeWaitOptions = NotarizeResult & LegacyNotarizeCredentials;
|
||||
/**
|
||||
* @deprecated This type was used for Apple's `altool`, which was sunset in 2023 and no longer works.
|
||||
* @category Legacy
|
||||
*/
|
||||
export type NotarizeOptionsLegacy = {
|
||||
tool: 'legacy';
|
||||
} & LegacyNotarizeStartOptions;
|
||||
/**
|
||||
* Options for notarizing your Electron app with `notarytool`.
|
||||
* @category Core
|
||||
*/
|
||||
export type NotaryToolStartOptions = NotaryToolNotarizeAppOptions & NotaryToolCredentials;
|
||||
/**
|
||||
* Helper type that specifies that `@electron/notarize` is using the `notarytool` strategy.
|
||||
* @category Utility Types
|
||||
*/
|
||||
export type NotarizeOptionsNotaryTool = {
|
||||
tool?: 'notarytool';
|
||||
} & NotaryToolStartOptions;
|
||||
/**
|
||||
* Options accepted by the `notarize` method.
|
||||
* @internal
|
||||
*/
|
||||
export type NotarizeOptions = NotarizeOptionsLegacy | NotarizeOptionsNotaryTool;
|
||||
export {};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import { LegacyNotarizeApiKeyCredentials, LegacyNotarizeCredentials, LegacyNotarizePasswordCredentials, NotaryToolApiKeyCredentials, NotaryToolCredentials, NotaryToolKeychainCredentials, NotaryToolPasswordCredentials } from './types';
|
||||
/** @deprecated */
|
||||
export declare function isLegacyPasswordCredentials(opts: LegacyNotarizeCredentials): opts is LegacyNotarizePasswordCredentials;
|
||||
/** @deprecated */
|
||||
export declare function isLegacyApiKeyCredentials(opts: LegacyNotarizeCredentials): opts is LegacyNotarizeApiKeyCredentials;
|
||||
/** @deprecated */
|
||||
export declare function validateLegacyAuthorizationArgs(opts: LegacyNotarizeCredentials): LegacyNotarizeCredentials;
|
||||
export declare function isNotaryToolPasswordCredentials(opts: NotaryToolCredentials): opts is NotaryToolPasswordCredentials;
|
||||
export declare function isNotaryToolApiKeyCredentials(opts: NotaryToolCredentials): opts is NotaryToolApiKeyCredentials;
|
||||
export declare function isNotaryToolKeychainCredentials(opts: NotaryToolCredentials): opts is NotaryToolKeychainCredentials;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function validateNotaryToolAuthorizationArgs(opts: NotaryToolCredentials): NotaryToolCredentials;
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.validateNotaryToolAuthorizationArgs = exports.isNotaryToolKeychainCredentials = exports.isNotaryToolApiKeyCredentials = exports.isNotaryToolPasswordCredentials = exports.validateLegacyAuthorizationArgs = exports.isLegacyApiKeyCredentials = exports.isLegacyPasswordCredentials = void 0;
|
||||
/** @deprecated */
|
||||
function isLegacyPasswordCredentials(opts) {
|
||||
const creds = opts;
|
||||
return creds.appleId !== undefined || creds.appleIdPassword !== undefined;
|
||||
}
|
||||
exports.isLegacyPasswordCredentials = isLegacyPasswordCredentials;
|
||||
/** @deprecated */
|
||||
function isLegacyApiKeyCredentials(opts) {
|
||||
const creds = opts;
|
||||
return creds.appleApiKey !== undefined || creds.appleApiIssuer !== undefined;
|
||||
}
|
||||
exports.isLegacyApiKeyCredentials = isLegacyApiKeyCredentials;
|
||||
/** @deprecated */
|
||||
function validateLegacyAuthorizationArgs(opts) {
|
||||
const isPassword = isLegacyPasswordCredentials(opts);
|
||||
const isApiKey = isLegacyApiKeyCredentials(opts);
|
||||
if (isPassword && isApiKey) {
|
||||
throw new Error('Cannot use both password credentials and API key credentials at once');
|
||||
}
|
||||
if (isPassword) {
|
||||
const passwordCreds = opts;
|
||||
if (!passwordCreds.appleId) {
|
||||
throw new Error('The appleId property is required when using notarization with appleIdPassword');
|
||||
}
|
||||
else if (!passwordCreds.appleIdPassword) {
|
||||
throw new Error('The appleIdPassword property is required when using notarization with appleId');
|
||||
}
|
||||
return passwordCreds;
|
||||
}
|
||||
if (isApiKey) {
|
||||
const apiKeyCreds = opts;
|
||||
if (!apiKeyCreds.appleApiKey) {
|
||||
throw new Error('The appleApiKey property is required when using notarization with appleApiIssuer');
|
||||
}
|
||||
else if (!apiKeyCreds.appleApiIssuer) {
|
||||
throw new Error('The appleApiIssuer property is required when using notarization with appleApiKey');
|
||||
}
|
||||
return apiKeyCreds;
|
||||
}
|
||||
throw new Error('No authentication properties provided (e.g. appleId, appleApiKey)');
|
||||
}
|
||||
exports.validateLegacyAuthorizationArgs = validateLegacyAuthorizationArgs;
|
||||
function isNotaryToolPasswordCredentials(opts) {
|
||||
const creds = opts;
|
||||
return (creds.appleId !== undefined || creds.appleIdPassword !== undefined || creds.teamId !== undefined);
|
||||
}
|
||||
exports.isNotaryToolPasswordCredentials = isNotaryToolPasswordCredentials;
|
||||
function isNotaryToolApiKeyCredentials(opts) {
|
||||
const creds = opts;
|
||||
return (creds.appleApiIssuer !== undefined ||
|
||||
creds.appleApiKey !== undefined ||
|
||||
creds.appleApiKeyId !== undefined);
|
||||
}
|
||||
exports.isNotaryToolApiKeyCredentials = isNotaryToolApiKeyCredentials;
|
||||
function isNotaryToolKeychainCredentials(opts) {
|
||||
const creds = opts;
|
||||
return creds.keychain !== undefined || creds.keychainProfile !== undefined;
|
||||
}
|
||||
exports.isNotaryToolKeychainCredentials = isNotaryToolKeychainCredentials;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function validateNotaryToolAuthorizationArgs(opts) {
|
||||
const isPassword = isNotaryToolPasswordCredentials(opts);
|
||||
const isApiKey = isNotaryToolApiKeyCredentials(opts);
|
||||
const isKeychain = isNotaryToolKeychainCredentials(opts);
|
||||
if ((isPassword ? 1 : 0) + (isApiKey ? 1 : 0) + (isKeychain ? 1 : 0) > 1) {
|
||||
throw new Error('Cannot use password credentials, API key credentials and keychain credentials at once');
|
||||
}
|
||||
if (isPassword) {
|
||||
const passwordCreds = opts;
|
||||
if (!passwordCreds.appleId) {
|
||||
throw new Error('The appleId property is required when using notarization with password credentials');
|
||||
}
|
||||
else if (!passwordCreds.appleIdPassword) {
|
||||
throw new Error('The appleIdPassword property is required when using notarization with password credentials');
|
||||
}
|
||||
else if (!passwordCreds.teamId) {
|
||||
throw new Error('The teamId property is required when using notarization with password credentials');
|
||||
}
|
||||
return passwordCreds;
|
||||
}
|
||||
if (isApiKey) {
|
||||
const apiKeyCreds = opts;
|
||||
if (!apiKeyCreds.appleApiKey) {
|
||||
throw new Error('The appleApiKey property is required when using notarization with ASC credentials');
|
||||
}
|
||||
else if (!apiKeyCreds.appleApiIssuer) {
|
||||
throw new Error('The appleApiIssuer property is required when using notarization with ASC credentials');
|
||||
}
|
||||
else if (!apiKeyCreds.appleApiKeyId) {
|
||||
throw new Error('The appleApiKeyId property is required when using notarization with ASC credentials');
|
||||
}
|
||||
return apiKeyCreds;
|
||||
}
|
||||
if (isKeychain) {
|
||||
const keychainCreds = opts;
|
||||
if (!keychainCreds.keychainProfile) {
|
||||
throw new Error('The keychainProfile property is required when using notarization with keychain credentials');
|
||||
}
|
||||
return keychainCreds;
|
||||
}
|
||||
throw new Error('No authentication properties provided (e.g. appleId, appleApiKey, keychain)');
|
||||
}
|
||||
exports.validateNotaryToolAuthorizationArgs = validateNotaryToolAuthorizationArgs;
|
||||
//# sourceMappingURL=validate-args.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"validate-args.js","sourceRoot":"","sources":["../src/validate-args.ts"],"names":[],"mappings":";;;AAUA,kBAAkB;AAClB,SAAgB,2BAA2B,CACzC,IAA+B;IAE/B,MAAM,KAAK,GAAG,IAAyC,CAAC;IACxD,OAAO,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,eAAe,KAAK,SAAS,CAAC;AAC5E,CAAC;AALD,kEAKC;AAED,kBAAkB;AAClB,SAAgB,yBAAyB,CACvC,IAA+B;IAE/B,MAAM,KAAK,GAAG,IAAuC,CAAC;IACtD,OAAO,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,KAAK,CAAC,cAAc,KAAK,SAAS,CAAC;AAC/E,CAAC;AALD,8DAKC;AAED,kBAAkB;AAClB,SAAgB,+BAA+B,CAC7C,IAA+B;IAE/B,MAAM,UAAU,GAAG,2BAA2B,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,UAAU,IAAI,QAA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I,KAAK,CACb,sFAAsF,CACvF,CAAC;SACH;aAAM,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE;YACrC,MAAM,IAAI,KAAK,CACb,qFAAqF,CACtF,CAAC;SACH;QACD,OAAO,WAAW,CAAC;KACpB;IACD,IAAI,UAAU,EAAE;QACd,MAAM,aAAa,GAAG,IAAqC,CAAC;QAC5D,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE;YAClC,MAAM,IAAI,KAAK,CACb,4FAA4F,CAC7F,CAAC;SACH;QACD,OAAO,aAAa,CAAC;KACtB;IACD,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC;AACjG,CAAC;AAvDD,kFAuDC"}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "@electron/notarize",
|
||||
"version": "2.5.0",
|
||||
"description": "Notarize your Electron app",
|
||||
"main": "lib/index.js",
|
||||
"typings": "lib/index.d.ts",
|
||||
"author": "Samuel Attard",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/electron/notarize#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/electron/notarize.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/electron/notarize/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"lint": "prettier --check \"src/**/*.ts\"",
|
||||
"prepare": "yarn build",
|
||||
"test": "jest"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/debug": "^4.1.5",
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@types/node": "^13.7.7",
|
||||
"@types/promise-retry": "^1.1.3",
|
||||
"jest": "^29.0.0",
|
||||
"prettier": "^1.18.2",
|
||||
"ts-jest": "^29.0.0",
|
||||
"typedoc": "~0.25.13",
|
||||
"typedoc-plugin-missing-exports": "^2.2.0",
|
||||
"typescript": "4.9.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": "^4.1.1",
|
||||
"fs-extra": "^9.0.1",
|
||||
"promise-retry": "^2.0.1"
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
|
||||
NAME
|
||||
electron-osx-flat -- product building for Electron apps
|
||||
|
||||
SYNOPSIS
|
||||
electron-osx-flat app [options ...]
|
||||
|
||||
DESCRIPTION
|
||||
app
|
||||
Path to the application package.
|
||||
Needs file extension ``.app''.
|
||||
|
||||
--help
|
||||
Flag to display all commands.
|
||||
|
||||
--identity=identity
|
||||
Name of certificate to use when signing.
|
||||
Default to selected with respect to --platform from --keychain specified or keychain by system default.
|
||||
|
||||
--identityValidation, --no-identityValidation
|
||||
Flag to enable/disable validation for the signing identity.
|
||||
|
||||
--install=install-path
|
||||
Path to install the bundle.
|
||||
Default to ``/Applications''.
|
||||
|
||||
--keychain=keychain
|
||||
The keychain name.
|
||||
Default to system default keychain.
|
||||
|
||||
--platform=platform
|
||||
Build platform of Electron.
|
||||
Allowed values: ``darwin'', ``mas''.
|
||||
Default to auto detect from application bundle.
|
||||
|
||||
--pkg
|
||||
Path to the output the flattened package.
|
||||
Needs file extension ``.pkg''.
|
||||
|
||||
--scripts
|
||||
Path to a directory containing pre and/or post install scripts.
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const args = require('minimist')(process.argv.slice(2), {
|
||||
boolean: [
|
||||
'help'
|
||||
]
|
||||
});
|
||||
const usage = fs.readFileSync(path.join(__dirname, 'electron-osx-flat-usage.txt')).toString();
|
||||
const flat = require('../').flat;
|
||||
|
||||
args.app = args._.shift();
|
||||
|
||||
if (!args.app || args.help) {
|
||||
console.log(usage);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Remove excess arguments
|
||||
delete args._;
|
||||
delete args.help;
|
||||
|
||||
flat(args, function done (err) {
|
||||
if (err) {
|
||||
console.error('Flat failed:');
|
||||
if (err.message) console.error(err.message);
|
||||
else if (err.stack) console.error(err.stack);
|
||||
else console.log(err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('Application flattened, saved to:', args.pkg);
|
||||
process.exit(0);
|
||||
});
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
|
||||
NAME
|
||||
electron-osx-sign -- code signing for Electron apps
|
||||
|
||||
SYNOPSIS
|
||||
electron-osx-sign app [embedded-binary ...] [options ...]
|
||||
|
||||
DESCRIPTION
|
||||
app
|
||||
Path to the application package.
|
||||
Needs file extension ``.app''.
|
||||
|
||||
embedded-binary ...
|
||||
Path to additional binaries that will be signed along with built-ins of Electron, spaced.
|
||||
|
||||
--help
|
||||
Flag to display all commands.
|
||||
|
||||
--identity=identity
|
||||
Name of certificate to use when signing.
|
||||
Default to selected with respect to --provisioning-profile and --platform from --keychain specified or keychain by system default.
|
||||
|
||||
--identityValidation, --no-identityValidation
|
||||
Flag to enable/disable validation for the signing identity.
|
||||
|
||||
--ignore=path
|
||||
Path to skip signing. The string will be treated as a regular expression when used to match the file paths.
|
||||
|
||||
--keychain=keychain
|
||||
The keychain name.
|
||||
Default to system default keychain.
|
||||
|
||||
--platform=platform
|
||||
Build platform of Electron.
|
||||
Allowed values: ``darwin'', ``mas''.
|
||||
Default to auto detect from application bundle.
|
||||
|
||||
--pre-auto-entitlements, --no-pre-auto-entitlements
|
||||
Flag to enable/disable automation of entitlements file and Info.plist.
|
||||
|
||||
--pre-embed-provisioning-profile, --no-pre-embed-provisioning-profile
|
||||
Flag to enable/disable embedding of provisioning profile.
|
||||
|
||||
--provisioning-profile=file
|
||||
Path to provisioning profile.
|
||||
|
||||
--strictVerify, --strictVerify=options, --no-strictVerify
|
||||
Flag to enable/disable ``--strict'' flag when verifying the signed application bundle.
|
||||
Each component should be separated in ``options'' with comma (``,'').
|
||||
Enabled by default.
|
||||
|
||||
--type=type
|
||||
Specify whether to sign app for development or for distribution.
|
||||
Allowed values: ``development'', ``distribution''.
|
||||
Default to ``distribution''.
|
||||
|
||||
--version=version
|
||||
Build version of Electron.
|
||||
Values may be: ``1.2.0''.
|
||||
Default to latest Electron version.
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const args = require('minimist')(process.argv.slice(2), {
|
||||
string: [
|
||||
'signature-flags'
|
||||
],
|
||||
boolean: [
|
||||
'help',
|
||||
'pre-auto-entitlements',
|
||||
'pre-embed-provisioning-profile',
|
||||
'hardened-runtime',
|
||||
'restrict'
|
||||
],
|
||||
default: {
|
||||
'pre-auto-entitlements': true,
|
||||
'pre-embed-provisioning-profile': true
|
||||
}
|
||||
});
|
||||
const usage = fs.readFileSync(path.join(__dirname, 'electron-osx-sign-usage.txt')).toString();
|
||||
const sign = require('../').sign;
|
||||
|
||||
args.app = args._.shift();
|
||||
args.binaries = args._;
|
||||
|
||||
if (!args.app || args.help) {
|
||||
console.log(usage);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Remove excess arguments
|
||||
delete args._;
|
||||
delete args.help;
|
||||
|
||||
sign(args, function done (err) {
|
||||
if (err) {
|
||||
console.error('Sign failed:');
|
||||
if (err.message) console.error(err.message);
|
||||
else if (err.stack) console.error(err.stack);
|
||||
else console.log(err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('Application signed:', args.app);
|
||||
process.exit(0);
|
||||
});
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import { FlatOptions } from './types';
|
||||
/**
|
||||
* Generates a flat `.pkg` installer for a packaged Electron `.app` bundle.
|
||||
* @returns A void Promise once the flattening operation is complete.
|
||||
*
|
||||
* @category Flat
|
||||
*/
|
||||
export declare function buildPkg(_opts: FlatOptions): Promise<void>;
|
||||
/**
|
||||
* This function is exported with normal callback implementation.
|
||||
*
|
||||
* @deprecated Please use the Promise-based {@link flatAsync} method instead.
|
||||
* @category Flat
|
||||
*/
|
||||
export declare const flat: (opts: FlatOptions, cb?: ((error?: Error) => void) | undefined) => void;
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.flat = exports.buildPkg = void 0;
|
||||
const path = __importStar(require("path"));
|
||||
const util_1 = require("./util");
|
||||
const util_identities_1 = require("./util-identities");
|
||||
const pkgVersion = require('../../package.json').version;
|
||||
/**
|
||||
* This function returns a promise validating all options passed in opts.
|
||||
* @function
|
||||
* @param {Object} opts - Options.
|
||||
* @returns {Promise} Promise.
|
||||
*/
|
||||
async function validateFlatOpts(opts) {
|
||||
await (0, util_1.validateOptsApp)(opts);
|
||||
let pkg = opts.pkg;
|
||||
if (pkg) {
|
||||
if (typeof pkg !== 'string')
|
||||
throw new Error('`pkg` must be a string.');
|
||||
if (path.extname(pkg) !== '.pkg') {
|
||||
throw new Error('Extension of output package must be `.pkg`.');
|
||||
}
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugWarn)('No `pkg` passed in arguments, will fallback to default inferred from the given application.');
|
||||
pkg = path.join(path.dirname(opts.app), path.basename(opts.app, '.app') + '.pkg');
|
||||
}
|
||||
let install = opts.install;
|
||||
if (install) {
|
||||
if (typeof install !== 'string') {
|
||||
return Promise.reject(new Error('`install` must be a string.'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugWarn)('No `install` passed in arguments, will fallback to default `/Applications`.');
|
||||
install = '/Applications';
|
||||
}
|
||||
if (typeof opts.scripts === 'string' && opts.platform === 'mas') {
|
||||
(0, util_1.debugWarn)('Mac App Store packages cannot have `scripts`, ignoring option.');
|
||||
}
|
||||
return Object.assign(Object.assign({}, opts), { pkg,
|
||||
install, platform: await (0, util_1.validateOptsPlatform)(opts) });
|
||||
}
|
||||
/**
|
||||
* This function returns a promise flattening the application.
|
||||
* @param opts - Options for building the .pkg archive
|
||||
*/
|
||||
async function buildApplicationPkg(opts, identity) {
|
||||
if (opts.platform === 'mas') {
|
||||
const args = ['--component', opts.app, opts.install, '--sign', identity.name, opts.pkg];
|
||||
if (opts.keychain) {
|
||||
args.unshift('--keychain', opts.keychain);
|
||||
}
|
||||
(0, util_1.debugLog)('Flattening Mac App Store package... ' + opts.app);
|
||||
await (0, util_1.execFileAsync)('productbuild', args);
|
||||
}
|
||||
else {
|
||||
const componentPkgPath = path.join(path.dirname(opts.app), path.basename(opts.app, '.app') + '-component.pkg');
|
||||
const pkgbuildArgs = [
|
||||
'--install-location',
|
||||
opts.install,
|
||||
'--component',
|
||||
opts.app,
|
||||
componentPkgPath
|
||||
];
|
||||
if (opts.scripts) {
|
||||
pkgbuildArgs.unshift('--scripts', opts.scripts);
|
||||
}
|
||||
(0, util_1.debugLog)('Building component package... ' + opts.app);
|
||||
await (0, util_1.execFileAsync)('pkgbuild', pkgbuildArgs);
|
||||
const args = ['--package', componentPkgPath, opts.install, '--sign', identity.name, opts.pkg];
|
||||
if (opts.keychain) {
|
||||
args.unshift('--keychain', opts.keychain);
|
||||
}
|
||||
(0, util_1.debugLog)('Flattening OS X Installer package... ' + opts.app);
|
||||
await (0, util_1.execFileAsync)('productbuild', args);
|
||||
await (0, util_1.execFileAsync)('rm', [componentPkgPath]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Generates a flat `.pkg` installer for a packaged Electron `.app` bundle.
|
||||
* @returns A void Promise once the flattening operation is complete.
|
||||
*
|
||||
* @category Flat
|
||||
*/
|
||||
async function buildPkg(_opts) {
|
||||
(0, util_1.debugLog)('@electron/osx-sign@%s', pkgVersion);
|
||||
const validatedOptions = await validateFlatOpts(_opts);
|
||||
let identities = [];
|
||||
let identityInUse = null;
|
||||
if (validatedOptions.identity) {
|
||||
(0, util_1.debugLog)('`identity` passed in arguments.');
|
||||
if (validatedOptions.identityValidation === false) {
|
||||
// Do nothing
|
||||
}
|
||||
else {
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOptions.keychain || null, validatedOptions.identity);
|
||||
}
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugWarn)('No `identity` passed in arguments...');
|
||||
if (validatedOptions.platform === 'mas') {
|
||||
(0, util_1.debugLog)('Finding `3rd Party Mac Developer Installer` certificate for flattening app distribution in the Mac App Store...');
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOptions.keychain || null, '3rd Party Mac Developer Installer:');
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Finding `Developer ID Application` certificate for distribution outside the Mac App Store...');
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOptions.keychain || null, 'Developer ID Installer:');
|
||||
}
|
||||
}
|
||||
if (identities.length > 0) {
|
||||
// Provisioning profile(s) found
|
||||
if (identities.length > 1) {
|
||||
(0, util_1.debugWarn)('Multiple identities found, will use the first discovered.');
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Found 1 identity.');
|
||||
}
|
||||
identityInUse = identities[0];
|
||||
}
|
||||
else {
|
||||
// No identity found
|
||||
throw new Error('No identity found for signing.');
|
||||
}
|
||||
(0, util_1.debugLog)('Flattening application...', '\n', '> Application:', validatedOptions.app, '\n', '> Package output:', validatedOptions.pkg, '\n', '> Install path:', validatedOptions.install, '\n', '> Identity:', validatedOptions.identity, '\n', '> Scripts:', validatedOptions.scripts);
|
||||
await buildApplicationPkg(validatedOptions, identityInUse);
|
||||
(0, util_1.debugLog)('Application flattened.');
|
||||
}
|
||||
exports.buildPkg = buildPkg;
|
||||
/**
|
||||
* This function is exported with normal callback implementation.
|
||||
*
|
||||
* @deprecated Please use the Promise-based {@link flatAsync} method instead.
|
||||
* @category Flat
|
||||
*/
|
||||
const flat = (opts, cb) => {
|
||||
buildPkg(opts)
|
||||
.then(() => {
|
||||
(0, util_1.debugLog)('Application flattened, saved to: ' + opts.app);
|
||||
if (cb)
|
||||
cb();
|
||||
})
|
||||
.catch((err) => {
|
||||
(0, util_1.debugLog)('Flat failed:');
|
||||
if (err.message)
|
||||
(0, util_1.debugLog)(err.message);
|
||||
else if (err.stack)
|
||||
(0, util_1.debugLog)(err.stack);
|
||||
else
|
||||
(0, util_1.debugLog)(err);
|
||||
if (cb)
|
||||
cb(err);
|
||||
});
|
||||
};
|
||||
exports.flat = flat;
|
||||
//# sourceMappingURL=flat.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"flat.js","sourceRoot":"","sources":["../../src/flat.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,iCAAmG;AAEnG,uDAA6D;AAI7D,MAAM,UAAU,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAiB,CAAC;AAEnE;;;;;GAKG;AACH,KAAK,UAAU,gBAAgB,CAAE,IAAiB;IAChD,MAAM,IAAA,sBAAe,EAAC,IAAI,CAAC,CAAC;IAE5B,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACnB,IAAI,GAAG,EAAE;QACP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CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAbW,QAAA,IAAI,QAaf"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { sign, signApp } from './sign';
|
||||
import { flat, buildPkg } from './flat';
|
||||
import { walkAsync } from './util';
|
||||
export { sign, flat, signApp as signAsync, signApp, buildPkg as flatAsync, buildPkg, walkAsync };
|
||||
export * from './types';
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.walkAsync = exports.buildPkg = exports.flatAsync = exports.signApp = exports.signAsync = exports.flat = exports.sign = void 0;
|
||||
const sign_1 = require("./sign");
|
||||
Object.defineProperty(exports, "sign", { enumerable: true, get: function () { return sign_1.sign; } });
|
||||
Object.defineProperty(exports, "signAsync", { enumerable: true, get: function () { return sign_1.signApp; } });
|
||||
Object.defineProperty(exports, "signApp", { enumerable: true, get: function () { return sign_1.signApp; } });
|
||||
const flat_1 = require("./flat");
|
||||
Object.defineProperty(exports, "flat", { enumerable: true, get: function () { return flat_1.flat; } });
|
||||
Object.defineProperty(exports, "flatAsync", { enumerable: true, get: function () { return flat_1.buildPkg; } });
|
||||
Object.defineProperty(exports, "buildPkg", { enumerable: true, get: function () { return flat_1.buildPkg; } });
|
||||
const util_1 = require("./util");
|
||||
Object.defineProperty(exports, "walkAsync", { enumerable: true, get: function () { return util_1.walkAsync; } });
|
||||
// TODO: Remove and leave only proper named exports, but for non-breaking change reasons
|
||||
// we need to keep this weirdness for now
|
||||
module.exports = sign_1.sign;
|
||||
module.exports.sign = sign_1.sign;
|
||||
module.exports.signAsync = sign_1.signApp;
|
||||
module.exports.signApp = sign_1.signApp;
|
||||
module.exports.flat = flat_1.flat;
|
||||
module.exports.flatAsync = flat_1.buildPkg;
|
||||
module.exports.buildPkg = flat_1.buildPkg;
|
||||
module.exports.walkAsync = util_1.walkAsync;
|
||||
__exportStar(require("./types"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iCAAuC;AAe9B,qFAfA,WAAI,OAeA;AAAmB,0FAfjB,cAAO,OAemB;AAAE,wFAf5B,cAAO,OAe4B;AAdlD,iCAAwC;AAczB,qFAdN,WAAI,OAcM;AAA6C,0FAdjD,eAAQ,OAckD;AAAE,yFAd5D,eAAQ,OAc4D;AAbnF,iCAAmC;AAakD,0FAb5E,gBAAS,OAa4E;AAX9F,wFAAwF;AACxF,yCAAyC;AACzC,MAAM,CAAC,OAAO,GAAG,WAAI,CAAC;AACtB,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,WAAI,CAAC;AAC3B,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,cAAO,CAAC;AACnC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,cAAO,CAAC;AACjC,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,WAAI,CAAC;AAC3B,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,eAAQ,CAAC;AACpC,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,eAAQ,CAAC;AACnC,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,gBAAS,CAAC;AAGrC,0CAAwB"}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import { SignOptions } from './types';
|
||||
/**
|
||||
* Signs a macOS application.
|
||||
* @returns A void Promise once the signing operation is complete.
|
||||
*
|
||||
* @category Codesign
|
||||
*/
|
||||
export declare function signApp(_opts: SignOptions): Promise<void>;
|
||||
/**
|
||||
* This function is a legacy callback implementation.
|
||||
*
|
||||
* @deprecated Please use the Promise-based {@link signAsync} method instead.
|
||||
* @category Codesign
|
||||
*/
|
||||
export declare const sign: (opts: SignOptions, cb?: ((error?: Error) => void) | undefined) => void;
|
||||
+377
@@ -0,0 +1,377 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sign = exports.signApp = void 0;
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const plist = __importStar(require("plist"));
|
||||
const compare_version_1 = __importDefault(require("compare-version"));
|
||||
const util_1 = require("./util");
|
||||
const util_identities_1 = require("./util-identities");
|
||||
const util_provisioning_profiles_1 = require("./util-provisioning-profiles");
|
||||
const util_entitlements_1 = require("./util-entitlements");
|
||||
const pkgVersion = require('../../package.json').version;
|
||||
const osRelease = os.release();
|
||||
/**
|
||||
* This function returns a promise validating opts.binaries, the additional binaries to be signed along with the discovered enclosed components.
|
||||
*/
|
||||
async function validateOptsBinaries(opts) {
|
||||
if (opts.binaries) {
|
||||
if (!Array.isArray(opts.binaries)) {
|
||||
throw new Error('Additional binaries should be an Array.');
|
||||
}
|
||||
// TODO: Presence check for binary files, reject if any does not exist
|
||||
}
|
||||
}
|
||||
function validateOptsIgnore(ignore) {
|
||||
if (ignore && !(ignore instanceof Array)) {
|
||||
return [ignore];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This function returns a promise validating all options passed in opts.
|
||||
*/
|
||||
async function validateSignOpts(opts) {
|
||||
await validateOptsBinaries(opts);
|
||||
await (0, util_1.validateOptsApp)(opts);
|
||||
if (opts.provisioningProfile && typeof opts.provisioningProfile !== 'string') {
|
||||
throw new Error('Path to provisioning profile should be a string.');
|
||||
}
|
||||
if (opts.type && opts.type !== 'development' && opts.type !== 'distribution') {
|
||||
throw new Error('Type must be either `development` or `distribution`.');
|
||||
}
|
||||
const platform = await (0, util_1.validateOptsPlatform)(opts);
|
||||
const cloned = Object.assign(Object.assign({}, opts), { ignore: validateOptsIgnore(opts.ignore), type: opts.type || 'distribution', platform });
|
||||
return cloned;
|
||||
}
|
||||
/**
|
||||
* This function returns a promise verifying the code sign of application bundle.
|
||||
*/
|
||||
async function verifySignApplication(opts) {
|
||||
// Verify with codesign
|
||||
(0, util_1.debugLog)('Verifying application bundle with codesign...');
|
||||
const strictVerify = opts.strictVerify !== undefined ? opts.strictVerify : true;
|
||||
await (0, util_1.execFileAsync)('codesign', ['--verify', '--deep'].concat(strictVerify !== false && (0, compare_version_1.default)(osRelease, '15.0.0') >= 0 // Strict flag since darwin 15.0.0 --> OS X 10.11.0 El Capitan
|
||||
? [
|
||||
'--strict' +
|
||||
(strictVerify !== true ? '=' + strictVerify : '')
|
||||
]
|
||||
: [], ['--verbose=2', opts.app]));
|
||||
}
|
||||
function defaultOptionsForFile(filePath, platform) {
|
||||
const entitlementsFolder = path.resolve(__dirname, '..', '..', 'entitlements');
|
||||
let entitlementsFile;
|
||||
if (platform === 'darwin') {
|
||||
// Default Entitlements
|
||||
// c.f. https://source.chromium.org/chromium/chromium/src/+/main:chrome/app/app-entitlements.plist
|
||||
// Also include JIT for main process V8
|
||||
entitlementsFile = path.resolve(entitlementsFolder, 'default.darwin.plist');
|
||||
// Plugin helper
|
||||
// c.f. https://source.chromium.org/chromium/chromium/src/+/main:chrome/app/helper-plugin-entitlements.plist
|
||||
if (filePath.includes('(Plugin).app')) {
|
||||
entitlementsFile = path.resolve(entitlementsFolder, 'default.darwin.plugin.plist');
|
||||
// GPU Helper
|
||||
// c.f. https://source.chromium.org/chromium/chromium/src/+/main:chrome/app/helper-gpu-entitlements.plist
|
||||
}
|
||||
else if (filePath.includes('(GPU).app')) {
|
||||
entitlementsFile = path.resolve(entitlementsFolder, 'default.darwin.gpu.plist');
|
||||
// Renderer Helper
|
||||
// c.f. https://source.chromium.org/chromium/chromium/src/+/main:chrome/app/helper-renderer-entitlements.plist
|
||||
}
|
||||
else if (filePath.includes('(Renderer).app')) {
|
||||
entitlementsFile = path.resolve(entitlementsFolder, 'default.darwin.renderer.plist');
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Default entitlements
|
||||
// TODO: Can these be more scoped like the non-mas variant?
|
||||
entitlementsFile = path.resolve(entitlementsFolder, 'default.mas.plist');
|
||||
// If it is not the top level app bundle, we sign with inherit
|
||||
if (filePath.includes('.app/')) {
|
||||
entitlementsFile = path.resolve(entitlementsFolder, 'default.mas.child.plist');
|
||||
}
|
||||
}
|
||||
return {
|
||||
entitlements: entitlementsFile,
|
||||
hardenedRuntime: true,
|
||||
requirements: undefined,
|
||||
signatureFlags: undefined,
|
||||
timestamp: undefined,
|
||||
additionalArguments: []
|
||||
};
|
||||
}
|
||||
async function mergeOptionsForFile(opts, defaults) {
|
||||
const mergedPerFileOptions = Object.assign({}, defaults);
|
||||
if (opts) {
|
||||
if (opts.entitlements !== undefined) {
|
||||
if (Array.isArray(opts.entitlements)) {
|
||||
const entitlements = opts.entitlements.reduce((dict, entitlementKey) => (Object.assign(Object.assign({}, dict), { [entitlementKey]: true })), {});
|
||||
const dir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'tmp-entitlements-'));
|
||||
const entitlementsPath = path.join(dir, 'entitlements.plist');
|
||||
await fs.writeFile(entitlementsPath, plist.build(entitlements), 'utf8');
|
||||
opts.entitlements = entitlementsPath;
|
||||
}
|
||||
mergedPerFileOptions.entitlements = opts.entitlements;
|
||||
}
|
||||
if (opts.hardenedRuntime !== undefined) {
|
||||
mergedPerFileOptions.hardenedRuntime = opts.hardenedRuntime;
|
||||
}
|
||||
if (opts.requirements !== undefined)
|
||||
mergedPerFileOptions.requirements = opts.requirements;
|
||||
if (opts.signatureFlags !== undefined) {
|
||||
mergedPerFileOptions.signatureFlags = opts.signatureFlags;
|
||||
}
|
||||
if (opts.timestamp !== undefined)
|
||||
mergedPerFileOptions.timestamp = opts.timestamp;
|
||||
if (opts.additionalArguments !== undefined)
|
||||
mergedPerFileOptions.additionalArguments = opts.additionalArguments;
|
||||
}
|
||||
return mergedPerFileOptions;
|
||||
}
|
||||
/**
|
||||
* This function returns a promise codesigning only.
|
||||
*/
|
||||
async function signApplication(opts, identity) {
|
||||
function shouldIgnoreFilePath(filePath) {
|
||||
if (opts.ignore) {
|
||||
return opts.ignore.some(function (ignore) {
|
||||
if (typeof ignore === 'function') {
|
||||
return ignore(filePath);
|
||||
}
|
||||
return filePath.match(ignore);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const children = await (0, util_1.walkAsync)((0, util_1.getAppContentsPath)(opts));
|
||||
if (opts.binaries)
|
||||
children.push(...opts.binaries);
|
||||
const args = ['--sign', identity.hash || identity.name, '--force'];
|
||||
if (opts.keychain) {
|
||||
args.push('--keychain', opts.keychain);
|
||||
}
|
||||
/**
|
||||
* Sort the child paths by how deep they are in the file tree. Some arcane apple
|
||||
* logic expects the deeper files to be signed first otherwise strange errors get
|
||||
* thrown our way
|
||||
*/
|
||||
children.sort((a, b) => {
|
||||
const aDepth = a.split(path.sep).length;
|
||||
const bDepth = b.split(path.sep).length;
|
||||
return bDepth - aDepth;
|
||||
});
|
||||
for (const filePath of [...children, opts.app]) {
|
||||
if (shouldIgnoreFilePath(filePath)) {
|
||||
(0, util_1.debugLog)('Skipped... ' + filePath);
|
||||
continue;
|
||||
}
|
||||
const perFileOptions = await mergeOptionsForFile(opts.optionsForFile ? opts.optionsForFile(filePath) : null, defaultOptionsForFile(filePath, opts.platform));
|
||||
// preAutoEntitlements should only be applied to the top level app bundle.
|
||||
// Applying it other files will cause the app to crash and be rejected by Apple.
|
||||
if (!filePath.includes('.app/')) {
|
||||
if (opts.preAutoEntitlements === false) {
|
||||
(0, util_1.debugWarn)('Pre-sign operation disabled for entitlements automation.');
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Pre-sign operation enabled for entitlements automation with versions >= `1.1.1`:', '\n', '* Disable by setting `pre-auto-entitlements` to `false`.');
|
||||
if (!opts.version || (0, compare_version_1.default)(opts.version, '1.1.1') >= 0) {
|
||||
// Enable Mac App Store sandboxing without using temporary-exception, introduced in Electron v1.1.1. Relates to electron#5601
|
||||
const newEntitlements = await (0, util_entitlements_1.preAutoEntitlements)(opts, perFileOptions, {
|
||||
identity,
|
||||
provisioningProfile: opts.provisioningProfile
|
||||
? await (0, util_provisioning_profiles_1.getProvisioningProfile)(opts.provisioningProfile, opts.keychain)
|
||||
: undefined
|
||||
});
|
||||
// preAutoEntitlements may provide us new entitlements, if so we update our options
|
||||
// and ensure that entitlements-loginhelper has a correct default value
|
||||
if (newEntitlements) {
|
||||
perFileOptions.entitlements = newEntitlements;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(0, util_1.debugLog)('Signing... ' + filePath);
|
||||
const perFileArgs = [...args];
|
||||
if (perFileOptions.requirements) {
|
||||
if (perFileOptions.requirements.charAt(0) === '=') {
|
||||
perFileArgs.push(`-r${perFileOptions.requirements}`);
|
||||
}
|
||||
else {
|
||||
perFileArgs.push('--requirements', perFileOptions.requirements);
|
||||
}
|
||||
}
|
||||
if (perFileOptions.timestamp) {
|
||||
perFileArgs.push('--timestamp=' + perFileOptions.timestamp);
|
||||
}
|
||||
else {
|
||||
perFileArgs.push('--timestamp');
|
||||
}
|
||||
let optionsArguments = [];
|
||||
if (perFileOptions.signatureFlags) {
|
||||
if (Array.isArray(perFileOptions.signatureFlags)) {
|
||||
optionsArguments.push(...perFileOptions.signatureFlags);
|
||||
}
|
||||
else {
|
||||
const flags = perFileOptions.signatureFlags.split(',').map(function (flag) {
|
||||
return flag.trim();
|
||||
});
|
||||
optionsArguments.push(...flags);
|
||||
}
|
||||
}
|
||||
if (perFileOptions.hardenedRuntime || optionsArguments.includes('runtime')) {
|
||||
// Hardened runtime since darwin 17.7.0 --> macOS 10.13.6
|
||||
if ((0, compare_version_1.default)(osRelease, '17.7.0') >= 0) {
|
||||
optionsArguments.push('runtime');
|
||||
}
|
||||
else {
|
||||
// Remove runtime if passed in with --signature-flags
|
||||
(0, util_1.debugLog)('Not enabling hardened runtime, current macOS version too low, requires 10.13.6 and higher');
|
||||
optionsArguments = optionsArguments.filter((arg) => {
|
||||
return arg !== 'runtime';
|
||||
});
|
||||
}
|
||||
}
|
||||
if (optionsArguments.length) {
|
||||
perFileArgs.push('--options', [...new Set(optionsArguments)].join(','));
|
||||
}
|
||||
if (perFileOptions.additionalArguments) {
|
||||
perFileArgs.push(...perFileOptions.additionalArguments);
|
||||
}
|
||||
await (0, util_1.execFileAsync)('codesign', perFileArgs.concat('--entitlements', perFileOptions.entitlements, filePath));
|
||||
}
|
||||
// Verify code sign
|
||||
(0, util_1.debugLog)('Verifying...');
|
||||
await verifySignApplication(opts);
|
||||
(0, util_1.debugLog)('Verified.');
|
||||
// Check entitlements if applicable
|
||||
(0, util_1.debugLog)('Displaying entitlements...');
|
||||
const result = await (0, util_1.execFileAsync)('codesign', [
|
||||
'--display',
|
||||
'--entitlements',
|
||||
':-',
|
||||
opts.app
|
||||
]);
|
||||
(0, util_1.debugLog)('Entitlements:', '\n', result);
|
||||
}
|
||||
/**
|
||||
* Signs a macOS application.
|
||||
* @returns A void Promise once the signing operation is complete.
|
||||
*
|
||||
* @category Codesign
|
||||
*/
|
||||
async function signApp(_opts) {
|
||||
(0, util_1.debugLog)('electron-osx-sign@%s', pkgVersion);
|
||||
const validatedOpts = await validateSignOpts(_opts);
|
||||
let identities = [];
|
||||
let identityInUse = null;
|
||||
// Determine identity for signing
|
||||
if (validatedOpts.identity) {
|
||||
(0, util_1.debugLog)('`identity` passed in arguments.');
|
||||
if (validatedOpts.identityValidation === false) {
|
||||
identityInUse = new util_identities_1.Identity(validatedOpts.identity);
|
||||
}
|
||||
else {
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOpts.keychain || null, validatedOpts.identity);
|
||||
}
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugWarn)('No `identity` passed in arguments...');
|
||||
if (validatedOpts.platform === 'mas') {
|
||||
if (validatedOpts.type === 'distribution') {
|
||||
(0, util_1.debugLog)('Finding `3rd Party Mac Developer Application` certificate for signing app distribution in the Mac App Store...');
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOpts.keychain || null, '3rd Party Mac Developer Application:');
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Finding `Mac Developer` certificate for signing app in development for the Mac App Store signing...');
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOpts.keychain || null, 'Mac Developer:');
|
||||
}
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Finding `Developer ID Application` certificate for distribution outside the Mac App Store...');
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOpts.keychain || null, 'Developer ID Application:');
|
||||
}
|
||||
}
|
||||
if (!identityInUse) {
|
||||
if (identities.length > 0) {
|
||||
// Identity(/ies) found
|
||||
if (identities.length > 1) {
|
||||
(0, util_1.debugWarn)('Multiple identities found, will use the first discovered.');
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Found 1 identity.');
|
||||
}
|
||||
identityInUse = identities[0];
|
||||
}
|
||||
else {
|
||||
// No identity found
|
||||
throw new Error('No identity found for signing.');
|
||||
}
|
||||
}
|
||||
// Pre-sign operations
|
||||
if (validatedOpts.preEmbedProvisioningProfile === false) {
|
||||
(0, util_1.debugWarn)('Pre-sign operation disabled for provisioning profile embedding:', '\n', '* Enable by setting `pre-embed-provisioning-profile` to `true`.');
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Pre-sign operation enabled for provisioning profile:', '\n', '* Disable by setting `pre-embed-provisioning-profile` to `false`.');
|
||||
await (0, util_provisioning_profiles_1.preEmbedProvisioningProfile)(validatedOpts, validatedOpts.provisioningProfile
|
||||
? await (0, util_provisioning_profiles_1.getProvisioningProfile)(validatedOpts.provisioningProfile, validatedOpts.keychain)
|
||||
: null);
|
||||
}
|
||||
(0, util_1.debugLog)('Signing application...', '\n', '> Application:', validatedOpts.app, '\n', '> Platform:', validatedOpts.platform, '\n', '> Additional binaries:', validatedOpts.binaries, '\n', '> Identity:', validatedOpts.identity);
|
||||
await signApplication(validatedOpts, identityInUse);
|
||||
// Post-sign operations
|
||||
(0, util_1.debugLog)('Application signed.');
|
||||
}
|
||||
exports.signApp = signApp;
|
||||
/**
|
||||
* This function is a legacy callback implementation.
|
||||
*
|
||||
* @deprecated Please use the Promise-based {@link signAsync} method instead.
|
||||
* @category Codesign
|
||||
*/
|
||||
const sign = (opts, cb) => {
|
||||
signApp(opts)
|
||||
.then(() => {
|
||||
(0, util_1.debugLog)('Application signed: ' + opts.app);
|
||||
if (cb)
|
||||
cb();
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.message)
|
||||
(0, util_1.debugLog)(err.message);
|
||||
else if (err.stack)
|
||||
(0, util_1.debugLog)(err.stack);
|
||||
else
|
||||
(0, util_1.debugLog)(err);
|
||||
if (cb)
|
||||
cb(err);
|
||||
});
|
||||
};
|
||||
exports.sign = sign;
|
||||
//# sourceMappingURL=sign.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+258
@@ -0,0 +1,258 @@
|
||||
/**
|
||||
* macOS applications can be distributed via the Mac App Store (MAS) or directly
|
||||
* downloaded from the developer's website. @electron/osx-sign distinguishes between
|
||||
* MAS apps (`mas`) or non-MAS apps (`darwin`).
|
||||
* @category Utility
|
||||
*/
|
||||
export type ElectronMacPlatform = 'darwin' | 'mas';
|
||||
/**
|
||||
* MAS apps can be signed using Development or Distribution certificates.
|
||||
|
||||
* See [Apple Documentation](https://developer.apple.com/help/account/create-certificates/certificates-overview/) for more info.
|
||||
* @category Utility
|
||||
*/
|
||||
export type SigningDistributionType = 'development' | 'distribution';
|
||||
/**
|
||||
* @interface
|
||||
* @internal
|
||||
*/
|
||||
export type BaseSignOptions = Readonly<{
|
||||
/**
|
||||
* Path to the application package.
|
||||
* Needs to end with the file extension `.app`.
|
||||
*/
|
||||
app: string;
|
||||
/**
|
||||
* The keychain name.
|
||||
*
|
||||
* @defaultValue `login`
|
||||
*/
|
||||
keychain?: string;
|
||||
/**
|
||||
* Build platform of your Electron app.
|
||||
* Allowed values: `darwin` (Direct Download App), `mas` (Mac App Store).
|
||||
*
|
||||
* @defaultValue Determined by presence of `Squirrel.framework` within the application bundle,
|
||||
* which is used for non-MAS apps.
|
||||
*/
|
||||
platform?: ElectronMacPlatform;
|
||||
/**
|
||||
* Name of the certificate to use when signing.
|
||||
*
|
||||
* @defaultValue Selected with respect to {@link SignOptions.provisioningProfile | provisioningProfile}
|
||||
* and {@link SignOptions.platform | platform} from the selected {@link SignOptions.keychain | keychain}.
|
||||
* * `mas` will look for `3rd Party Mac Developer Application: * (*)`
|
||||
* * `darwin` will look for `Developer ID Application: * (*)` by default.
|
||||
*/
|
||||
identity?: string;
|
||||
}>;
|
||||
type OnlyValidatedBaseSignOptions = {
|
||||
platform: ElectronMacPlatform;
|
||||
};
|
||||
/**
|
||||
* A set of signing options that can be overriden on a per-file basis.
|
||||
* Any missing options will use the default values, and providing a partial structure
|
||||
* will shallow merge with the default values.
|
||||
* @interface
|
||||
* @category Codesign
|
||||
*/
|
||||
export type PerFileSignOptions = {
|
||||
/**
|
||||
* String specifying the path to an `entitlements.plist` file.
|
||||
* Can also be an array of entitlement keys that osx-sign will write to an entitlements file for you.
|
||||
*
|
||||
* @defaultValue `@electron/osx-sign`'s built-in entitlements files.
|
||||
*/
|
||||
entitlements?: string | string[];
|
||||
/**
|
||||
* Whether to enable [Hardened Runtime](https://developer.apple.com/documentation/security/hardened_runtime)
|
||||
* for this file.
|
||||
*
|
||||
* Note: Hardened Runtime is a pre-requisite for notarization, which is mandatory for apps running on macOS 10.15 and above.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
hardenedRuntime?: boolean;
|
||||
/**
|
||||
* Either a string beginning with `=` which specifies in plain text the
|
||||
* [signing requirements](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html)
|
||||
* that you recommend to be used to evaluate the code signature, or a string specifying a path to a text or
|
||||
* properly encoded `.rqset` file which contains those requirements.
|
||||
*/
|
||||
requirements?: string;
|
||||
/**
|
||||
* When signing, a set of option flags can be specified to change the behavior of the system when using the signed code.
|
||||
* Accepts an array of strings or a comma-separated string.
|
||||
*
|
||||
* See --options of the `codesign` command.
|
||||
*
|
||||
* https://keith.github.io/xcode-man-pages/codesign.1.html#OPTION_FLAGS
|
||||
*/
|
||||
signatureFlags?: string | string[];
|
||||
/**
|
||||
* String specifying the URL of the timestamp authority server.
|
||||
* Please note that this default server may not support signatures not furnished by Apple.
|
||||
* Disable the timestamp service with `none`.
|
||||
*
|
||||
* @defaultValue Uses the Apple-provided timestamp server.
|
||||
*/
|
||||
timestamp?: string;
|
||||
/**
|
||||
* Additional raw arguments to pass to the `codesign` command.
|
||||
*
|
||||
* These can be things like `--deep` for instance when code signing specific resources that may
|
||||
* require such arguments.
|
||||
*
|
||||
* https://keith.github.io/xcode-man-pages/codesign.1.html#OPTIONS
|
||||
*/
|
||||
additionalArguments?: string[];
|
||||
};
|
||||
/**
|
||||
* @interface
|
||||
* @internal
|
||||
*/
|
||||
export type OnlySignOptions = {
|
||||
/**
|
||||
* Array of paths to additional binaries that will be signed along with built-ins of Electron.
|
||||
*
|
||||
* @defaultValue `undefined`
|
||||
*/
|
||||
binaries?: string[];
|
||||
/**
|
||||
* Function that receives the path to a file and can return the entitlements to use for that file to override the default behavior. The
|
||||
* object this function returns can include any of the following optional keys. Any properties that are returned **override** the default
|
||||
* values that `@electron/osx-sign` generates. Any properties not returned use the default value.
|
||||
*
|
||||
* @param filePath Path to file
|
||||
* @returns Override signing options
|
||||
*/
|
||||
optionsForFile?: (filePath: string) => PerFileSignOptions;
|
||||
/**
|
||||
* Flag to enable/disable validation for the signing identity.
|
||||
* If enabled, the {@link SignOptions.identity | identity} provided
|
||||
* will be validated in the {@link BaseSignOptions.keychain | keychain} specified.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
identityValidation?: boolean;
|
||||
/**
|
||||
* Defines files that will be skipped during the code signing process.
|
||||
* This property accepts a regex, function or an array of regexes and functions.
|
||||
* Elements of other types are treated as `RegExp`.
|
||||
*
|
||||
* File paths matching a regex or returning a `true` value from a function will be ignored.
|
||||
*
|
||||
* @defaultValue `undefined`
|
||||
*/
|
||||
ignore?: string | string[] | ((file: string) => boolean);
|
||||
/**
|
||||
* Flag to enable/disable entitlements automation tasks necessary for code signing most Electron apps.
|
||||
* * Adds [`com.apple.security.application-groups`](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_application-groups) to the entitlements file
|
||||
* * Fills in the `ElectronTeamID` property in `Info.plist` with the provisioning profile's Team Identifier or by parsing the identity name.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
preAutoEntitlements?: boolean;
|
||||
/**
|
||||
* Flag to enable/disable the embedding of a provisioning profile into the app's `Contents` folder.
|
||||
* Will use the profile from {@link OnlySignOptions.provisioningProfile} if provided. Otherwise, it
|
||||
* searches for a `.provisionprofile` file in the current working directory.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
preEmbedProvisioningProfile?: boolean;
|
||||
/**
|
||||
* Path to a provisioning profile, which can be used to grant restricted entitlements to your app.
|
||||
*
|
||||
* See [Apple Documentation](https://developer.apple.com/documentation/technotes/tn3125-inside-code-signing-provisioning-profiles) for more details.
|
||||
*/
|
||||
provisioningProfile?: string;
|
||||
/**
|
||||
* Flag to enable/disable the `--strict` flag when verifying the signed application bundle.
|
||||
* Also supports string values to specify which strict restrictions to use, see codesign man page for supported values.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
strictVerify?: boolean | string;
|
||||
/**
|
||||
* Type of certificate to use when signing a MAS app.
|
||||
* @defaultValue `"distribution"`
|
||||
*/
|
||||
type?: SigningDistributionType;
|
||||
/**
|
||||
* Build version of Electron. Values may be like: `1.1.1`, `1.2.0`. For use for signing legacy versions
|
||||
* of Electron to ensure backwards compatibility.
|
||||
*/
|
||||
version?: string;
|
||||
};
|
||||
type OnlyValidatedSignOptions = {
|
||||
ignore?: (string | ((file: string) => boolean))[];
|
||||
type: SigningDistributionType;
|
||||
};
|
||||
type OnlyFlatOptions = {
|
||||
/**
|
||||
* Flag to enable/disable validation for the signing identity.
|
||||
* If enabled, the {@link BaseSignOptions.identity | identity} provided
|
||||
* will be validated in the {@link BaseSignOptions.keychain | keychain} specified.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
identityValidation?: boolean;
|
||||
/**
|
||||
* Path to install the bundle.
|
||||
* @defaultValue `"/Applications"`
|
||||
*/
|
||||
install?: string;
|
||||
/**
|
||||
* Output path for the flattened installer package.
|
||||
* Needs file extension `.pkg`.
|
||||
*
|
||||
* @defaultValue Inferred from the app name passed into `opts.app`.
|
||||
*/
|
||||
pkg?: string;
|
||||
/**
|
||||
* Path to a directory containing `preinstall.sh` or `postinstall.sh` scripts.
|
||||
* These must be executable and will run on pre/postinstall depending on the file
|
||||
* name.
|
||||
*
|
||||
* This option is only valid if {@link FlatOptions.platform} is set to `darwin`.
|
||||
*/
|
||||
scripts?: string;
|
||||
};
|
||||
type OnlyValidatedFlatOptions = {
|
||||
install: string;
|
||||
pkg: string;
|
||||
};
|
||||
/**
|
||||
* Utility type that represents an `UnValidated` type after validation,
|
||||
* replacing any properties in the unvalidated type that also exist in the
|
||||
* `Validated` type with the validated versions.
|
||||
*
|
||||
* @template UnValidated - The type representing the unvalidated form.
|
||||
* @template Validated - The type representing the validated form.
|
||||
*/
|
||||
type ValidatedForm<UnValidated, Validated> = Omit<UnValidated, keyof Validated> & Validated;
|
||||
type ValidatedBaseSignOptions = Readonly<ValidatedForm<BaseSignOptions, OnlyValidatedBaseSignOptions>>;
|
||||
type _SignOptions = Readonly<OnlySignOptions & BaseSignOptions>;
|
||||
/**
|
||||
* Options for codesigning a packaged `.app` bundle.
|
||||
* @category Codesign
|
||||
*/
|
||||
export interface SignOptions extends _SignOptions {
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type ValidatedSignOptions = Readonly<ValidatedForm<OnlySignOptions, OnlyValidatedSignOptions> & ValidatedBaseSignOptions>;
|
||||
type _FlatOptions = Readonly<OnlyFlatOptions & BaseSignOptions>;
|
||||
/**
|
||||
* Options for creating a flat `.pkg` installer.
|
||||
* @category Flat
|
||||
*/
|
||||
export interface FlatOptions extends _FlatOptions {
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type ValidatedFlatOptions = Readonly<ValidatedForm<OnlyFlatOptions, OnlyValidatedFlatOptions> & ValidatedBaseSignOptions>;
|
||||
export {};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
||||
Reference in New Issue
Block a user