Gathering detailed insights and metrics for crx
Gathering detailed insights and metrics for crx
Gathering detailed insights and metrics for crx
Gathering detailed insights and metrics for crx
npm install crx
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
517 Stars
239 Commits
70 Forks
12 Watching
12 Branches
24 Contributors
Updated on 18 Nov 2024
Minified
Minified + Gzipped
JavaScript (90.68%)
PureBasic (9.32%)
Cumulative downloads
Total Downloads
Last day
-52.2%
3,230
Compared to previous day
Last week
-12%
26,779
Compared to previous week
Last month
21.1%
115,014
Compared to previous month
Last year
-33.4%
1,822,641
Compared to previous year
crx is a utility to package Google Chrome extensions via a Node API and the command line. It is written purely in JavaScript and does not require OpenSSL!
Packages are available to use crx
with:
Massive hat tip to the node-rsa project for the pure JavaScript encryption!
Compatibility: this extension is compatible with node>=10
.
1$ npm install crx
Asynchronous functions returns a native ECMAScript Promise.
1const fs = require('fs'); 2const path = require('path'); 3 4const ChromeExtension = require('crx'); 5 6const crx = new ChromeExtension({ 7 codebase: 'http://localhost:8000/myExtension.crx', 8 privateKey: fs.readFileSync('./key.pem') 9}); 10 11crx.load( path.resolve(__dirname, './myExtension') ) 12 .then(crx => crx.pack()) 13 .then(crxBuffer => { 14 const updateXML = crx.generateUpdateXML() 15 16 fs.writeFileSync('../update.xml', updateXML); 17 fs.writeFileSync('../myExtension.crx', crxBuffer); 18 }) 19 .catch(err=>{ 20 console.error( err ); 21 });
This module exports the ChromeExtension
constructor directly, which can take an optional attribute object, which is used to extend the instance.
Prepares the temporary workspace for the Chrome Extension located at path
— which is expected to directly contain manifest.json
.
1crx.load('/path/to/extension').then(crx => { 2 // ... 3});
Alternatively, you can pass a list of files — the first manifest.json
file to be found will be considered as the root of the application.
1crx.load(['/my/extension/manifest.json', '/my/extension/background.json']).then(crx => { 2 // ... 3});
Packs the Chrome Extension and resolves the promise with a Buffer containing the .crx
file.
1crx.load('/path/to/extension') 2 .then(crx => crx.pack()) 3 .then(crxBuffer => { 4 fs.writeFileSync('/tmp/foobar.crx', crxBuffer); 5 });
Returns a Buffer containing the update.xml file used for autoupdate
, as specified for update_url
in the manifest. In this case, the instance must have a property called codebase
.
1const crx = new ChromeExtension({ ..., codebase: 'https://autoupdateserver.com/myFirstExtension.crx' });
2
3crx.load('/path/to/extension')
4 .then(crx => crx.pack())
5 .then(crxBuffer => {
6 // ...
7 const xmlBuffer = crx.generateUpdateXML();
8 fs.writeFileSync('/foo/bar/update.xml', xmlBuffer);
9 });
Generates application id (extension id) from given path.
1new crx().generateAppId('/path/to/ext') // epgkjnfaepceeghkjflpimappmlalchn
Pack the specified directory into a .crx package, and output it to stdout. If no directory is specified, the current working directory is used.
Use the --crx-version
option to specify which CRX format version to output. Can be either "2" or "3", defaults to "3".
Use the -o
option to write the signed extension to a file instead of stdout.
Use the --zip-output
option to write the unsigned extension to a file.
Use the -p
option to specify an external private key. If this is not used, key.pem
is used from within the directory. If this option is not used and no key.pem
file exists, one will be generated automatically.
Use the -b
option to specify the maximum buffer allowed to generate extension. By default, will rely on node
internal setting (~200KB).
Generate a 2048-bit RSA private key within the directory. This is called automatically if a key is not specified, and key.pem
does not exist.
Use the --force
option to overwrite an existing private key located in the same given folder.
Show information about using this utility, generated by commander.
Given the following directory structure:
└─┬ myFirstExtension
├── manifest.json
└── icon.png
run this:
1$ cd myFirstExtension 2$ crx pack -o
to generate this:
1├─┬ myFirstExtension 2│ ├── manifest.json 3│ ├── icon.png 4│ └── key.pem 5└── myFirstExtension.crx
You can also name the output file like this:
1$ cd myFirstExtension 2$ crx pack -o myFirstExtension.crx
to get the same results, or also pipe to the file manually like this.
1$ cd myFirstExtension 2$ crx pack > ../myFirstExtension.crx
As you can see a key is generated for you at key.pem
if none exists. You can also specify an external key. So if you have this:
├─┬ myFirstExtension
│ ├── manifest.json
│ └── icon.png
└── myPrivateKey.pem
you can run this:
1$ crx pack myFirstExtension -p myPrivateKey.pem -o
to sign your package without keeping the key in the directory.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
Found 8/17 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
13 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More