npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

electron-windows-sign

v1.0.0

Published

Codesign Electron Windows apps

Downloads

11,939

Readme

electron-windows-sign npm

Codesign your app for Windows. Made for Electron but really supports any folder with binary files.

About

electron-windows-sign scans a folder for binary files (.exe, .msi, .dll, .node) and codesigns them with both SHA-1 and SHA-256. It can be used either programmatically or on the command line.

Usage

As a module

electron-windows-codesign is built to both esm and cjs.

The short version:

import { sign } from "electron-windows-sign"
// or const { sign } = require("electron-windows-sign")

sign({ 
  appDirectory: "C:\\Path\\To\\App",
  certificateFile: "C:\\Cert.pfx", // or process.env.WINDOWS_CERTIFICATE_FILE
  certificatePassword: "hunter99"  // or process.env.WINDOWS_CERTIFICATE_PASSWORD
})
  .then(() => console.log("Success!"))
  .catch((error) => console.log(error))

The long version:

import { sign, SignOptions } from "electron-windows-sign"

const options: SignOptions = {
  // Path to the application directory. We will scan this
  // directory for any .dll, .exe, .msi, or .node files and
  // codesign them with signtool.exe
  appDirectory: "C:\\Path\\To\\App",
  // Path to a .pfx code signing certificate. Will use
  // process.env.WINDOWS_CERTIFICATE_FILE if not provided.
  certificateFile: "C:\\Path\\To\\App\\MyCert.pfx",

  // --- Sometimes optional ---

  // Password to said certificate. If you don't provide this,
  // you need to provide a `signWithParams` option. Will use
  // process.env.WINDOWS_CERTIFICATE_PASSWORD if not provided.
  certificatePassword: string,
  
  // --- Options below are optional ---

  // Path to a timestamp server. Defaults to http://timestamp.digicert.com
  timestampServer = "http://timestamp.digicert.com"
  // Description of the signed content. Will be passed to signtool.exe as /d
  description = "My content"
  // URL of the signed content. Will be passed to signtool.exe as /du
  website = "https://mywebsite.com"
  // Path to signtool.exe. Will use vendor/signtool.exe if not provided
  signToolPath = "C:\\Path\\To\\signtool.exe"
  // Additional parameters to pass to signtool.exe.
  signWithParams = ""
  // Enable debug logging
  debug = true;
  // Automatically select the best signing certificate, passed as 
  // /a to signtool.exe, on by default
  automaticallySelectCertificate = true
}

await sign(options)

As a CLI tool

SYNOPSIS
  electron-windows-sign app [options ...]

DESCRIPTION
  app
    Path to the application to sign.  It must be a directory.

  certificate-file
    Path to the certificate file (.pfx) to use for signing. Uses 
    environment variable WINDOWS_CERTIFICATE_FILE if not provided.

  certificate-password
    Password to use for the certificate. Uses environment variable
    WINDOWS_CERTIFICATE_PASSWORD if not provided.

  sign-tool-path
    Path to the signtool.exe binary.  If not specified, the tool will attempt
    use a built-in version.

  timestamp-server
    URL of the timestamp server to use.  If not specified, the tool will
    attempt to use a built-in server (http://timestamp.digicert.com)

  description
    Description to use for the signed files. Passed as /d to signtool.exe.

  website
    URL of the website to use for the signed files. Passed as /du to
    signtool.exe.

  sign-with-params
    Additional parameters to pass to signtool.exe.  This can be used to
    specify additional certificates to use for cross-signing.

  automatically-select-certificate
    Automatically select the best certificate to use for signing. On by default.

  help
    Print this usage information.

  debug
    Print additional debug information.

License

BSD 2-Clause "Simplified". Please see LICENSE for details.