feat: Provide a custom verify function interface in NsisUpdater#7337
feat: Provide a custom verify function interface in NsisUpdater#7337mmaietta merged 6 commits intoelectron-userland:masterfrom
Conversation
🦋 Changeset detectedLatest commit: e9295e6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for car-park-attendant-cleat-11576 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Could I add the example to slow-avocados-carry.md ? import { NsisUpdater } from "electron-updater"
import { verifySignatureByPublishName } from "win-verify-signature"
// Or MacUpdater, AppImageUpdater
export default class AppUpdater {
constructor() {
const options = {
requestHeaders: {
// Any request headers to include here
},
provider: 'generic',
url: 'https://example.com/auto-updates'
}
const autoUpdater = new NsisUpdater(options)
autoUpdater.verifyUpdateCodeSignature = (publisherName: string[], path: string) => {
const result = verifySignatureByPublishName(path, publisherName);
if(result.signed) return Promise.resolve(null);
return Promise.resolve(result.message);
}
autoUpdater.addAuthHeader(`Bearer ${token}`)
autoUpdater.checkForUpdatesAndNotify()
}
} |
|
Your example provided looks great though. Perhaps we could add it to the Common Questions for Windows configuration? I can't seem to find any other docs specifically on auto-update configuration, just for publishers but not the AppUpdater itself? (Maybe I need to create a separate Page just for that in the future?) |
|
I have added the example to win.md. Please help check it. |
|
Any chance we could get a bit more info on how this can be implemented? import { autoUpdater } from "electron-updater";How could this be implemented with the "default" updater? |
Replace the PowerShell with a native verify signature module, but not all users will have access to a Windows build machine if their project does not currently require a native module. For instance, compiling with Wine on linux/docker would no longer work.
Providing a custom verify function interface, if the user want to use native verify module, they can pass it and they need to have an access to a windows build machine. If they don't pass it, will use the default verify signature function(https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/src/windowsExecutableCodeSignatureVerifier.ts).
Interface
Example