Skip to content

Commit b300fbd

Browse files
committed
spread
1 parent 8b93253 commit b300fbd

File tree

4 files changed

+150
-228
lines changed

4 files changed

+150
-228
lines changed

config/makers/appx.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,20 @@ module.exports = {
2929
{
3030
name: '@electron-forge/maker-appx',
3131
config: {
32-
publisher: 'CN=developmentca',
33-
devCert: 'C:\\devcert.pfx',
34-
certPass: 'abcd'
32+
publisher: 'CN=UUID',
33+
publisherDisplayName: 'CompanyName',
34+
displayName: 'AppName',
35+
version: '1.0.0',
36+
identityName: 'CompanyName.AppName'
3537
}
3638
}
3739
]
3840
};
3941
```
4042
{% endcode %}
4143

44+
The UUID in the ```publisher``` field can be found on the Microsoft website that you use to create the app listing. The only trick is that Windows doesn't like dashes in any file or folder names.
45+
4246
Configuration options are documented in [`MakerAppXConfig`](https://js.electronforge.io/interfaces/\_electron\_forge\_maker\_appx.MakerAppXConfig.html).
4347

4448
## Debugging

config/makers/pkg.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ module.exports = {
3535
makers: [
3636
{
3737
name: '@electron-forge/maker-pkg',
38+
platform: ['mas'],
3839
config: {
39-
keychain: 'my-secret-ci-keychain'
40-
// other configuration options
40+
identity: '3rd Party Mac Developer Installer: FirstName LastName (TEAMID)'
4141
}
4242
}
4343
]

guides/code-signing/code-signing-macos.md

Lines changed: 102 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,18 @@ Although Electron does not integrate tightly with the IDE itself, Xcode is a hel
2929

3030
Code signing certificates for macOS apps can only be obtained through Apple by purchasing a membership to the [Apple Developer Program](https://developer.apple.com/programs/).
3131

32-
To sign Electron apps, you may require two separate certificates:
32+
If you want to submit your app to the Mac App Store, you will need to create the following certificates:
3333

34-
* The **Developer ID Installer** certificate is for apps distributed to the Mac App Store.
35-
* The **Developer ID Application** certificate is for apps distributed outside the Mac App Store.
34+
- Apple Development
35+
- Apple Distribution
36+
- Mac Installer Distribution
3637

37-
Once you have an Apple Developer Program membership, you first need to install them onto your machine. We recommend [loading them through Xcode](https://help.apple.com/xcode/mac/current/#/dev3a05256b8).
38+
If you want to distribution your app outside of the App Store, you will need the following certificates:
39+
40+
- Developer ID Application
41+
- Developer ID Installer
42+
43+
All of these certificates should be created through Xcode after you have signed up for an Apple Developer Account. If you have created them any other way, you will have to delete them.
3844

3945
{% hint style="success" %}
4046
**Verifying your certificate is installed**
@@ -46,6 +52,12 @@ security find-identity -p codesigning -v
4652
```
4753
{% endhint %}
4854

55+
### Creating provisioning profiles
56+
57+
Once you have created the certificates, you need to go to your Apple Developer Account and create provisioning profiles. If you are submiting your app to the app store, you will need a development profile and a distribution profile. If you are submiting it outside of the app store, you will need a profile for the ```Developer ID Application``` certificate.
58+
59+
You need to download these after creating them and double clicking them to install them on your computer. Not all of them can be installed locally, but just double-click on them anyway.
60+
4961
## Configuring Forge
5062

5163
In Electron Forge, macOS apps are signed and notarized at the **Package** step by the `electron-packager` library. There is a separate option within your Forge `packagerConfig` for each one of these settings.
@@ -62,44 +74,98 @@ To enable code signing on macOS, ensure that `packagerConfig.osxSign` exists in
6274
```javascript
6375
module.exports = {
6476
packagerConfig: {
65-
osxSign: {} // object must exist even if empty
77+
osxSign: {
78+
binaries: [
79+
'./resources/bin/ffmpeg_intel_mac',
80+
'./resources/bin/ffmpeg_mac'
81+
],
82+
identity: 'Apple Development',
83+
platform: 'mas',
84+
type: 'development',
85+
provisioningProfile: 'development.provisionprofile',
86+
optionsForFile: (filePath) => {
87+
const entitlements = filePath.includes('.app/') ? 'entitlements.child.plist' : 'entitlements.plist';
88+
return {
89+
hardenedRuntime: false,
90+
entitlements
91+
}
92+
}
93+
}
6694
}
6795
};
6896
```
6997
{% endcode %}
7098

71-
The `osxSign` config comes with defaults that work out of the box in most cases, so we recommend you start with an empty configuration object.
99+
```binaries```: if your electron app calls any binaries, they need to be listed here so that they can be signed.
72100

73-
For a full list of configuration options, see the [`OsxSignOptions`](https://js.electronforge.io/modules/\_electron\_forge\_shared\_types.InternalOptions.html#OsxSignOptions) type in the Forge API docs. For more detailed information on how to configure these options, see the [`@electron/osx-sign` documentation](https://github.com/electron/osx-sign).
101+
```identity```: the name of the certificate.
74102

75-
#### Customizing entitlements
103+
- App store development: Apple Development
104+
- App store distribution: Apple Distribution: FirstName LastName (TEAMID)
105+
- Outside distribution: Developer ID Application: FirstName LastName (TEAMID)
76106

77-
A common use case for modifying the default `osxSign` configuration is to customize its entitlements. In macOS, **entitlements** are privileges that grant apps certain capabilities (e.g. access to the camera, microphone, or USB devices). These are stored within the code signature in an app's executable file.
107+
```platform```: for the app store it is ```mas``` and for outside the app store it is ```darwin```
78108

79-
By default, the `@electron/osx-sign` tool comes with a set of entitlements that should work on both MAS or direct distribution targets. See the complete set of default entitlement files [on GitHub](https://github.com/electron/osx-sign/tree/main/entitlements).
109+
```provisioningProfile```: the appropriate provisioning profile, as mentioned earlier.
80110

81-
{% code title="forge.config.js" %}
82-
```javascript
83-
module.exports = {
84-
// ...
85-
packagerConfig: {
86-
// ...
87-
osxSign: {
88-
optionsForFile: (filePath) => {
89-
// Here, we keep it simple and return a single entitlements.plist file.
90-
// You can use this callback to map different sets of entitlements
91-
// to specific files in your packaged app.
92-
return {
93-
entitlements: 'path/to/entitlements.plist'
94-
};
95-
}
96-
}
97-
}
98-
// ...
99-
};
111+
```optionsForFile```: for distribution outside of the app store, you may be able to rely on the defaults if you app doesn't need any extra entitlements. For the app store, you will definitely need to provide this.
112+
113+
You need to add logic to determine which set of entitlements to use. If you specify more entitlements then your app uses, it will probably be rejected by the review process.
114+
115+
For submission to the app store, ```hardenedRuntime``` should be false, but for distribution outside of the app store, it should be true.
116+
117+
For a full list of configuration options, see the [`OsxSignOptions`](https://js.electronforge.io/modules/\_electron\_forge\_shared\_types.InternalOptions.html#OsxSignOptions) type in the Forge API docs. For more detailed information on how to configure these options, see the [`@electron/osx-sign` documentation](https://github.com/electron/osx-sign).
118+
119+
#### Entitlements
120+
121+
In macOS, **entitlements** are privileges that grant apps certain capabilities (e.g. access to the camera, microphone, or USB devices). These are stored within the code signature in an app's executable file.
122+
123+
Here is an example main entitlements file. Add or remove entitlements depending on the needs of your app.
124+
125+
{% code title="entitlements.plist" %}
126+
```xml
127+
<?xml version="1.0" encoding="UTF-8"?>
128+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
129+
<plist version="1.0">
130+
<dict>
131+
<key>com.apple.security.app-sandbox</key>
132+
<true/>
133+
<key>com.apple.security.files.user-selected.read-write</key>
134+
<true/>
135+
<key>com.apple.security.files.bookmarks.app-scope</key>
136+
<true/>
137+
<key>com.apple.security.network.client</key>
138+
<true/>
139+
<key>com.apple.security.print</key>
140+
<true/>
141+
<key>com.apple.security.device.usb</key>
142+
<true/>
143+
<key>com.apple.security.files.downloads.read-write</key>
144+
<true />
145+
</dict>
146+
</plist>
147+
```
148+
{% endcode %}
149+
150+
Here is an example child entitlements file.
151+
152+
{% code title="entitlements.child.plist" %}
153+
```xml
154+
<?xml version="1.0" encoding="UTF-8"?>
155+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
156+
<plist version="1.0">
157+
<dict>
158+
<key>com.apple.security.app-sandbox</key>
159+
<true/>
160+
<key>com.apple.security.inherit</key>
161+
<true/>
162+
</dict>
163+
</plist>
100164
```
101165
{% endcode %}
102166

167+
Forge will add additional keys related to your provisioning profile. You should remove the ```app-sandbox``` key in both files when creating the set of entitlements you want to use outside of the app store, as that version does not run in a sandbox.
168+
103169
For further reading on entitlements, see the following pages in Apple developer documentation:
104170

105171
* [Entitlements](https://developer.apple.com/documentation/bundleresources/entitlements)
@@ -225,6 +291,7 @@ module.exports = {
225291
packagerConfig: {
226292
osxSign: {},
227293
osxNotarize: {
294+
tool: 'notarytool',
228295
appleId: process.env.APPLE_ID,
229296
appleIdPassword: process.env.APPLE_PASSWORD,
230297
teamId: process.env.APPLE_TEAM_ID
@@ -233,3 +300,9 @@ module.exports = {
233300
};
234301
```
235302
{% endcode %}
303+
304+
```appleId```: usually the email address you used to create your Apple account.
305+
306+
```appleIdPassword```: a one-time password you can create. This is mentioned in the documentation. You create it via the Apple Developer website or something like that.
307+
308+
```teamId```: that set of characters inside the brackets at the end of your identity name.

0 commit comments

Comments
 (0)