Codesigning electron app for windows (on windows) - electron

As it says in the title, this is what im trying to do: using windows 10, codesign my electron app using the certificate purchased from a third party vendor (which is in p12 format).
I've read the docs here: https://www.electron.build/configuration/win and here: https://www.electron.build/code-signing
And realise that I need to provide a path to the certificate file and password (if one is set) using the appropriate keys (certificateFile and certificatePassword).
I've also seen these answers:
How to sign in windows installer using electron builder
(There's also loads of questions and answers referring to people building for windows on mac, but that's not what im doing here)
But this doesnt seem to address the question.
These are how the lines in my package.json are set referring to the relevant path/password:
"certificateFile ": "./certificate_file.p12",
"certificatePassword ": "password"
I realise that it is better to have these set in a .env file and read them from there, which I intend to do later. But as I understand it, this should suffice shouldnt it?
My build command is:
"build": "electron-builder build"
And this produces the following:
But there is no mention of signing taking place at all. If Im being royally stupid, please feel free to point out where ^_^ many thanks in advance!
Updates
Queried with project maintainers on github, code signing is supposed to take place automatically provided the variables are set correctly, see convo here: https://github.com/electron-userland/electron-builder/issues/6895)

It may be significantly simpler to sign your exe OUTSIDE of electron builder. In which case, the approach I took was to use SSL.com's SSL manager GUI.
You can read about it toward the bottom of this page and see their documentation of the tool here.
About a week looking into codesigning with electron builder, still not entirely sure how to do it.
About 5 mins using this tool. Done.

I don't remember the whole process but I had to fumble around for a few days to get it working.
In my package.json file I have a build object like this:
"build":
...
"win": {
"certificateFile": "private/mycertificate.pfx",
"verifyUpdateCodeSignature": true,
"publisherName": [
"My Company Name"
]
},
Then before publishing I run this in windows powershell to set the env variable:
setx CSC_KEY_PASSWORD my-certifcate-password-here
Then finally:
electron-builder -w

Related

Can a (Delphi) desktop-bridge app be restarted via the windows.updateTasks Extension?

I have successfully packaged a Delphi app in an MSIX container, but I've run into a problem with one of my app's requirements: Upon updating the app from the Store, its background process (a console exe) is shut down (of course) and replaced with a new copy that is designated in AppxManifest.xml to run when the main app is first opened:
<Extensions>
<desktop:Extension Category="windows.startupTask" Executable="CwHelper.exe" EntryPoint="Windows.FullTrustApplication">
<desktop:StartupTask TaskId="CwHelper" Enabled="true" DisplayName="Capture Manager" />
</desktop:Extension>
</Extensions>
This all works fine, but it means that the background exe is left not running until the main app is opened subsequent to the update. This is highly undesirable.
My Internet spelunking of the MSFT docs leads me to think that I should be able to automatically restart the background app by inserting into the above <Extensions>...</Extensions> block a second Extension something like this:
<Extension Category="windows.updateTask" Executable="<some>.exe" EntryPoint="<some entrypoint>" >
</Extension>
So far, I have not been able to discover what should be my (Delphi-created) <some>.exe and its EntryPoint. Indeed, I have not found any example of this specific use of that Extension Category. Can it actually be used in this way by a desktop-bridge app? If so, can anyone give me pointers as to what I should put into those blanks?
Note added: I've tried repeating the exe's name and Windows.FullTrustApplication in the updateTask definition fields and that actually passed Certification, but it generates a fatal downloading error when the Store tries to install it.
Another note added: #StefanWick kindly pointed out that he has published an example of the very thing I need here using MSFT's toolset. Unfortunately, it is not clear to me how to translate his C# and Visual Studio labels into a Delphi app. Any advice on that would be greatly appreciated.
Answering my own question after about a month's research, I found out that the answer for now is "no" because the necessary IBackgroundTasks interface is not (yet?) available to Delphi according to Embarcadero Customer Support.
But the good news is that this is probably not needed because the "right" way to restart an app after a Store update is described in MSFT docs here.

Heroku one-click-deploy of golang application with docker

I am quite new to heroku and I want to offer people to easily install my application on their own instance via a "Deploy to heroku" button as described here https://devcenter.heroku.com/articles/heroku-button.
I've now created an app.json on my develop branch: https://github.com/scribble-rs/scribble.rs/blob/develop/app.json
{
"name": "Scribble.rs",
"description": "A multiplayer drawing game for the browser",
"repository": "https://github.com/scribble-rs/scribble.rs",
"keywords": ["game", "multiplayer", "ephemeral"]
}
However, actually testing the button by calling https://dashboard.heroku.com/new?template=https%3A%2F%2Fgithub.com%2Fscribble-rs%2Fscribble.rs%2Ftree%2Fdevelop will result in Heroku running the default build procedure for go-projects. However, due to the fact that the resulting binary doesn't contain the resources necessary for running the application, the app will build, but crash on startup.
In order to fix this, I'd need to instead run it with a docker-buildpack. However, I couldn't really find any documentation on this specific usecase, even though it seemed quite general. For deploying via GitHub using the GitHub-connection on the "Deploy" tab of an app, you can specify a heroku.yml, which I did: https://github.com/scribble-rs/scribble.rs/blob/develop/heroku.yml
build:
docker:
web: Dockerfile
However, in case of the on-click-deploy, this file seems to be ignored and what I am supposed to do instead, is to explicitly specify a buildpack via the app.json. While I've found some GitHub repositories with docker-buildpacks, I kind of dislike this solution, as I'd have to trust some random repository that could either break or vanish any moment.
What exactly is the best way to go about this problem?
It appears you have to specify the stack inside of the app.json. This wasn't very clear by reading the docs: https://devcenter.heroku.com/articles/app-json-schema#stack
I've set this to:
"stack": "container"

Electron builder - GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"

I have an electron app for which I want to set up an auto-updater. I followed this blog post and made a small demo, it worked great with some small changes.
Then I tried to implement it with my real project and now I am getting an error.
GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"
I already have electron-builder.yml file and i even tried setting up GT_TOKEN anv variable but it still throws same error.
Forget about that post, I tried to implement it but faced many issues with that.
Try this one.
But take a note that For macOS, you will need a code-signing certificate.
For windows and Linux it works seemlessly.
Just follow the instructions.
For exporting the token, you need to add the export line at the end of the .bashrc or .profile in Linux/Mac. Google it if you don't know how.
Make sure to restart IDE/Terminal to inherit latest env variable.
Well, I found the solution, I set env key in .bash_profile and it worked. I don't know why setting GH_TOKEN in the main.js file and in electron_builder.yml file didn't work. It works in the beginning but then when I added more configuration to package.json file it started throwing this error.

QA-C: license file

I'm trying to run QA-C 7.2 on a Nightly Build that I program using Python.
It does run but the problem I encounter is, that I cannot save the license file configuration settings because IM not a 'license admin'. Hence, everytime I run QA-C it requires me to browse to the license.dat
Does anyone know a way around this, for example passing the license file configuration (eg path2license_dat) as a parameter when I call the exe? Or somehow saving this information?
I found out that it works when setting the environment variable LM_LICENSE_FILE to the path to license.dat

How to install s3sync

This seems like an excellent script but lacks a key part to its installation I can't seem to figure out. Maybe someone out there can help a newb.
What I've done so far :
Installed the s3sync package.
Downloaded the s3 certificate
Downloaded the s3 ssl package
ran it with sh ssh.certs.shar
Edited the s3conf.yml file to have the correct AWS id and password and a path to the cert file
When I run the s3cmd.rb I get the error "You didn't set up your environment variables; see README.txt"
To which I agree, there is no information written regarding where I specify destination or target.
Guesses :
-The cert file has to be in a specific place to which it isn't, or its in the incorrect cert file
-the s3conf.yml may not have the correct information written in it.
UPDATE:
Uninstalled everything, and installed it as a gem. Made sure the s3config.yml is still in /etc/s3conf/ . Still nothing though.
Some b/s here but I went into the s3config.rb
Found this line :
confpath = ["#{ENV['S3CONF']}", "#{ENV['HOME']}/.s3conf", "/etc/s3conf"]
and ripped it apart to this :
confpath = ["/etc/s3conf"]
Done, problem solved.
Yes. The environment variables are not being found. This troubled me for a while. It is because the locations you are setting in that initial line of confpath code ["#{ENV['S3CONF']}", ... is not actually the location of the variables contained in the .yaml file.
As Trip says, hard setting that value to the dir containing the .yaml file solved this problem for me.
You could actually set the values using 'export' but really, this is much easier!

Resources