From a4dc9f58137b54902cb80474cbde2ed8492f4df8 Mon Sep 17 00:00:00 2001 From: GrapeGreen Date: Tue, 7 May 2024 19:28:10 +0200 Subject: [PATCH] Incorporate ECDSA P-256 SHA-256 signing scheme into telnet-client (#39) * Incorporate ECDSA P-256 SHA-256 signing scheme into telnet-client * Update nodejs.yml --------- Co-authored-by: Andrew Rayskiy --- .github/workflows/nodejs.yml | 4 ++-- README.md | 8 +++++++- package-lock.json | 37 ++++++++++++++++++------------------ package.json | 4 ++-- webpack.wbn.js | 8 ++++---- 5 files changed, 34 insertions(+), 27 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 99b7b01..e84dbf8 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -30,11 +30,11 @@ jobs: run: npm run build env: CI: true - ED25519KEY: ${{ secrets.BUNDLE_SIGNING_KEY }} + KEY: ${{ secrets.BUNDLE_SIGNING_KEY }} - name: Lint run: npm run lint - + - name: Upload artifacts uses: actions/upload-artifact@v3 with: diff --git a/README.md b/README.md index cd64676..ef3802f 100644 --- a/README.md +++ b/README.md @@ -65,12 +65,18 @@ Types. ### Building a Signed Web Bundle Signing a Web Bundle requires generating a private key. This only needs to be -done once, +done once; the supported algorithms are Ed25519 and ECDSA P-256 SHA-256. ```sh openssl genpkey -algorithm ed25519 -out private.pem ``` +or + +```sh +openssl ecparam -name prime256v1 -genkey -noout -out private.pem +``` + To build, ```sh diff --git a/package-lock.json b/package-lock.json index 580c11e..3517c21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,8 +27,8 @@ "style-loader": "^3.3.1", "ts-loader": "^9.3.0", "typescript": "^4.6.4", - "wbn-sign": "0.1.0", - "webbundle-webpack-plugin": "0.1.3", + "wbn-sign": "0.1.3", + "webbundle-webpack-plugin": "0.1.5", "webpack": "^5.76.0", "webpack-cli": "^4.9.2", "webpack-dev-server": "^4.9.0", @@ -5279,9 +5279,9 @@ } }, "node_modules/wbn-sign": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/wbn-sign/-/wbn-sign-0.1.0.tgz", - "integrity": "sha512-OraI48wQK2US1i/PPyHauLGk8wdI+OI1tk/kvE+EV1WbqpbSMohuqvQH/7K5PbguQuDAU0VnL0sJ0YHsSLRLmA==", + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/wbn-sign/-/wbn-sign-0.1.3.tgz", + "integrity": "sha512-WMePt7JZV00dd8Nve/0zfat1yAGNdZqoVZJpJzbok89IFH1+Rp8GhJj49pkhT73MFurL6vNv0F9lY/0faRACZg==", "dev": true, "dependencies": { "base32-encode": "^2.0.0", @@ -5290,10 +5290,11 @@ "read": "^2.0.0" }, "bin": { + "wbn-dump-id": "bin/wbn-dump-id.js", "wbn-sign": "bin/wbn-sign.js" }, "engines": { - "node": ">= 14.0.0", + "node": ">= 16.0.0", "npm": ">= 8.0.0" } }, @@ -5337,18 +5338,18 @@ } }, "node_modules/webbundle-webpack-plugin": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/webbundle-webpack-plugin/-/webbundle-webpack-plugin-0.1.3.tgz", - "integrity": "sha512-vJpEOR4s6QjD5kImAcIo+w8jrFxydZBOiJNk0LXbnJ/tfWDxC/+R+Lq0G3X2WeCZAD+TONwRyjGBGkHYvlKd3A==", + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/webbundle-webpack-plugin/-/webbundle-webpack-plugin-0.1.5.tgz", + "integrity": "sha512-hBPGN2QFqxFmdq+kocdAW6830MOalkXepD0yZ/phBIxEYs5InCFv/4b++A6EH/6f5cfyuIAdSmhtG4zqfPNHBw==", "dev": true, "dependencies": { "mime": "^2.4.4", "wbn": "0.0.9", - "wbn-sign": "0.1.0", + "wbn-sign": "0.1.3", "zod": "^3.21.4" }, "engines": { - "node": ">= 14.0.0" + "node": ">= 16.0.0" }, "peerDependencies": { "webpack": ">=4.0.1 <6.0.0" @@ -9764,9 +9765,9 @@ } }, "wbn-sign": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/wbn-sign/-/wbn-sign-0.1.0.tgz", - "integrity": "sha512-OraI48wQK2US1i/PPyHauLGk8wdI+OI1tk/kvE+EV1WbqpbSMohuqvQH/7K5PbguQuDAU0VnL0sJ0YHsSLRLmA==", + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/wbn-sign/-/wbn-sign-0.1.3.tgz", + "integrity": "sha512-WMePt7JZV00dd8Nve/0zfat1yAGNdZqoVZJpJzbok89IFH1+Rp8GhJj49pkhT73MFurL6vNv0F9lY/0faRACZg==", "dev": true, "requires": { "base32-encode": "^2.0.0", @@ -9793,14 +9794,14 @@ } }, "webbundle-webpack-plugin": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/webbundle-webpack-plugin/-/webbundle-webpack-plugin-0.1.3.tgz", - "integrity": "sha512-vJpEOR4s6QjD5kImAcIo+w8jrFxydZBOiJNk0LXbnJ/tfWDxC/+R+Lq0G3X2WeCZAD+TONwRyjGBGkHYvlKd3A==", + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/webbundle-webpack-plugin/-/webbundle-webpack-plugin-0.1.5.tgz", + "integrity": "sha512-hBPGN2QFqxFmdq+kocdAW6830MOalkXepD0yZ/phBIxEYs5InCFv/4b++A6EH/6f5cfyuIAdSmhtG4zqfPNHBw==", "dev": true, "requires": { "mime": "^2.4.4", "wbn": "0.0.9", - "wbn-sign": "0.1.0", + "wbn-sign": "0.1.3", "zod": "^3.21.4" }, "dependencies": { diff --git a/package.json b/package.json index fb73264..d98f5c9 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "style-loader": "^3.3.1", "ts-loader": "^9.3.0", "typescript": "^4.6.4", - "wbn-sign": "0.1.0", - "webbundle-webpack-plugin": "0.1.3", + "wbn-sign": "0.1.3", + "webbundle-webpack-plugin": "0.1.5", "webpack": "^5.76.0", "webpack-cli": "^4.9.2", "webpack-dev-server": "^4.9.0", diff --git a/webpack.wbn.js b/webpack.wbn.js index 2361684..1a474fa 100644 --- a/webpack.wbn.js +++ b/webpack.wbn.js @@ -19,12 +19,12 @@ const common = require('./webpack.common.js'); const WebBundlePlugin = require('webbundle-webpack-plugin'); const { WebBundleId, parsePemKey } = require('wbn-sign'); const fs = require("fs"); -require('dotenv').config({ path: '.env' }); +require('dotenv').config({ path: '.env' }); -const privateKeyFile = process.env.ED25519KEYFILE || "private.pem"; +const privateKeyFile = process.env.KEYFILE || "private.pem"; let privateKey; -if (process.env.ED25519KEY) { - privateKey = process.env.ED25519KEY; +if (process.env.KEY) { + privateKey = process.env.KEY; } else if (fs.existsSync(privateKeyFile)) { privateKey = fs.readFileSync(privateKeyFile); }