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-builder-encryptor

v2.3.2

Published

simple electron package encryption tool

Downloads

146

Readme

electron-builder-encryptor npm

ci

English | 简体中文

simple electron package encryption tool

Examples

Features

  • 🐵 Very easy to use, just add a few lines of code
  • 💚 Framework agnostic, easy to add to your existing projects
  • 🤷‍♂️ It only takes effect when packaging with electron-builder, and does not affect development and debugging
  • 🔒 Use bytenode to encrypt the main process and custom method to encrypt the renderer process
  • 👀 Prevent tampering with the app.asar file

Usage

npm i electron-builder-encryptor -D

# These 5 libraries need to be added to the project
npm i adm-zip bytenode mime original-fs yaml

Add afterPack to electron-builder configuration

// package.json
{
    "build": {
        "asar": true,
        "afterPack": "node_modules/electron-builder-encryptor"
    }
}

or

// electron-builder.json
{
    "asar": true,
    "afterPack": "node_modules/electron-builder-encryptor"
}

in mian process

if (!app.isPackaged) {
    // address before packing
    mainWindow.loadFile('renderer/index.html')
} else {
    // address after packing
    mainWindow.loadURL('myclient://apps/index.html')
}

Note: The renderer process that needs to be encrypted must be placed in the renderer folder under the directory where the entry file main.js is located

Configuration

// encryptor.config.ts or encryptor.config.js
import { defineConfig } from 'electron-builder-encryptor'

export default defineConfig({
    /**
     * encryption key
     */
    key: 'xxx000777',
})

all configuration

export declare interface UserConfig {
    /**
     * encryption key
     */
    key?: string
    /**
     * renderer protocol scheme
     * @default 'myclient'
     */
    protocol?: string
    /**
     * electron custom schemes to be registered with options.
     * @default
     * {standard: true, secure: true, bypassCSP: true, allowServiceWorkers: true, supportFetchAPI: true, corsEnabled: true, stream: true}
     */
    privileges?: Privileges
    /**
     * preload.js directory, with the program execution directory as the root node
     * @default preload.js
     */
    preload?: string | string[]
    renderer?: {
        /**
         * renderer entry directory, with the program execution directory as the root node
         * @default 'renderer'
         */
        entry: string
        /**
         * The encrypted storage path of the rendering process, with the program execution directory as the root node
         * @default 'resources/renderer.pkg'
         */
        output: string
    }
    /**
     * Synchronously detect whether the program has been tampered with when starting the app
     */
    syncValidationChanges?: boolean
    /**
     * Automatically run the renderer process after the main process is started. After setting it to false, you can use the __runRenderer() method to start it manually.
     * @default true
     */
    autoRunRenderer?: boolean
}

Migrating from v0.x

In order to update renderer and mian separately, 1.x separates the encrypted renderer.pkg by default. If you need to restore the behavior of 0.x, you can set renderer.output to ''

export default defineConfig({
    renderer: {
        entry: 'renderer',
        output: ''
    }
})

When package.json exists in the renderer folder, the renderer.yml file will be generated in the packaged renderer.pkg directory

License

MIT License