@@ -33,7 +33,24 @@ tool, [postject][]:
3333   $ cp $(command -v node) hello 
3434   ``` 
3535
36- 3 .  Inject the JavaScript file into the copied binary by running ` postject `  with
36+ 3 .  Remove the signature of the binary:
37+ 
38+    *  On macOS:
39+ 
40+    ``` console 
41+    $ codesign --remove-signature hello 
42+    ``` 
43+ 
44+    *  On Windows (optional):
45+ 
46+    [ signtool] [ ]  can be used from the installed [ Windows SDK] [ ] . If this step is
47+    skipped, ignore any signature-related warning from postject.
48+ 
49+    ``` console 
50+    $ signtool remove /s hello 
51+    ``` 
52+ 
53+ 4 .  Inject the JavaScript file into the copied binary by running ` postject `  with
3754   the following options:
3855
3956   *  ` hello `  - The name of the copy of the ` node `  executable created in step 2.
@@ -61,7 +78,24 @@ tool, [postject][]:
6178         --macho-segment-name NODE_JS 
6279     ```
6380
64- 4. Run the binary: 
81+ 5. Sign the binary: 
82+ 
83+    * On macOS: 
84+ 
85+    ```console 
86+    $ codesign --sign - hello 
87+    ``` 
88+ 
89+    *  On Windows (optional):
90+ 
91+    A certificate needs to be present for this to work. However, the unsigned
92+    binary would still be runnable.
93+ 
94+    ``` console 
95+    $ signtool sign /fd SHA256 hello 
96+    ``` 
97+ 
98+ 6 .  Run the binary:
6599   ``` console 
66100   $ ./hello world 
67101   Hello, world! 
@@ -132,9 +166,11 @@ to help us document them.
132166[ ELF ] : https://en.wikipedia.org/wiki/Executable_and_Linkable_Format 
133167[ Mach-O ] : https://en.wikipedia.org/wiki/Mach-O 
134168[ PE ] : https://en.wikipedia.org/wiki/Portable_Executable 
169+ [ Windows SDK ] : https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ 
135170[ `process.execPath` ] : process.md#processexecpath 
136171[ `require()` ] : modules.md#requireid 
137172[ `require.main` ] : modules.md#accessing-the-main-module 
138173[ fuse ] : https://www.electronjs.org/docs/latest/tutorial/fuses 
139174[ postject ] : https://github.com/nodejs/postject 
175+ [ signtool ] : https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool 
140176[ single executable applications ] : https://github.com/nodejs/single-executable 
0 commit comments