From 5e0561df7efc3b96fced8c5dec8eef80d950e16c Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Sun, 11 Jun 2023 22:40:37 -0500 Subject: [PATCH 01/21] Quickstart guidance updates --- .vscode/launch.json | 23 +++++++++++++++++++++++ README.md | 25 ++++++++++++++++--------- 2 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..d0b1191 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,23 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch via yarn", + "runtimeVersion": "18", + "request": "launch", + "runtimeArgs": [ + "dev" + ], + "runtimeExecutable": "yarn", + "skipFiles": [ + "/**" + ], + "type": "node", + "env": { "DOMAIN": "localhost:3000"}, + "outputCapture": "std" + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 138ea5e..81a1633 100644 --- a/README.md +++ b/README.md @@ -41,14 +41,21 @@ Please note that this project has a [Code of Conduct](https://codeberg.org/keyox To run Keyoxide locally on your machine for development: -- install either - - NodeJS - - directly from their [website](https://nodejs.org/en/), or - - using [nvm](https://github.com/nvm-sh/nvm): `nvm install --lts; nvm use --lts` - - [yarn](https://yarnpkg.com/) - - [nix](https://nixos.org/guides/install-nix.html) with - [direnv](https://direnv.net/) will install yarn and other dependencies. -- install dependencies with `npm install` or `yarn` -- run the server with `npm dev` or `yarn dev` +1. Install Node using [nvm](https://github.com/nvm-sh/nvm): `nvm install --lts` +2. Swap over to LTS: `nvm use --lts` +3. Ensure that yarn is installed: `npm install -g yarn` +4. Install node dependencies: `yarn` +5. Run the server a la `DOMAIN='localhost:3000' yarn dev` Keyoxide will now be available at [https://localhost:3000](https://localhost:3000) + +For **vscode/vscodium** development, a `launcher.json` is provided. Ensure that +the first four steps have been performed at least once to ensure the proper +node and yarn binaries are available to vscode, then load the project. The +launcher provides a "Launch via yarn" debug option that will start the project +with the appropriate version and environment variables set. The project will +then be available in a browser. + +There is also a `shell.nix` file to install Node and yarn (steps one through +three above). + From ecc789a4a92b49a220fb25057be154bd07e55ec7 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Sun, 11 Jun 2023 23:41:33 -0500 Subject: [PATCH 02/21] first stab at it from keyoxide-web end --- src/api/v0/index.js | 3 ++- src/api/v2/keyoxide_profile.js | 3 ++- src/index.js | 4 +++- src/server/index.js | 8 ++++---- static-src/kx-claim.js | 7 ++++--- static-src/utils.js | 11 ++++++----- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/api/v0/index.js b/src/api/v0/index.js index 32c7764..c99e526 100644 --- a/src/api/v0/index.js +++ b/src/api/v0/index.js @@ -192,7 +192,8 @@ const doVerification = async (data) => { const verificationOptions = { proxy: { hostname: process.env.PROXY_HOSTNAME, - policy: (process.env.PROXY_HOSTNAME !== '') ? 'adaptive' : 'never' + policy: (process.env.PROXY_HOSTNAME !== '') ? 'adaptive' : 'never', + scheme: (process.env.PROXY_SCHEME !== '') ? process.env.PROXY_SCHEME : (process.env.SCHEME !== '') ? process.env.SCHEME : 'https' } } diff --git a/src/api/v2/keyoxide_profile.js b/src/api/v2/keyoxide_profile.js index f13a7c2..c009808 100644 --- a/src/api/v2/keyoxide_profile.js +++ b/src/api/v2/keyoxide_profile.js @@ -195,7 +195,8 @@ const doVerification = async (data) => { const verificationOptions = { proxy: { hostname: process.env.PROXY_HOSTNAME, - policy: (process.env.PROXY_HOSTNAME !== '') ? 'adaptive' : 'never' + policy: (process.env.PROXY_HOSTNAME !== '') ? 'adaptive' : 'never', + scheme: (process.env.PROXY_SCHEME !== '') ? process.env.PROXY_SCHEME : (process.env.SCHEME !== '') ? process.env.SCHEME : 'https' } } diff --git a/src/index.js b/src/index.js index 4e5008e..691e462 100644 --- a/src/index.js +++ b/src/index.js @@ -48,6 +48,7 @@ app.set('env', process.env.NODE_ENV || 'production') app.engine('pug', pug.__express).set('view engine', 'pug') app.set('port', process.env.PORT || 3000) app.set('domain', process.env.DOMAIN) +app.set('scheme', process.env.SCHEME || 'https') app.set('keyoxide_version', packageData.version) app.set('onion_url', process.env.ONION_URL) @@ -65,7 +66,8 @@ if (app.get('onion_url')) { } app.use(stringReplace({ - PLACEHOLDER__PROXY_HOSTNAME: process.env.PROXY_HOSTNAME || process.env.DOMAIN || 'null' + PLACEHOLDER__PROXY_HOSTNAME: process.env.PROXY_HOSTNAME || process.env.DOMAIN || 'null', + PLACEHOLDER__PROXY_SCHEME: process.env.PROXY_SCHEME || process.env.SCHEME || 'https' }, { contentTypeFilterRegexp: /application\/javascript/ })) diff --git a/src/server/index.js b/src/server/index.js index 06ad467..c348a13 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -46,7 +46,7 @@ const generateWKDProfile = async (id) => { keyData = processKeyData(keyData) const keyoxideData = {} - keyoxideData.url = `https://${process.env.DOMAIN}/wkd/${id}` + keyoxideData.url = `${process.env.SCHEME}://${process.env.DOMAIN}/wkd/${id}` logger.debug('Generating a WKD profile', { component: 'wkd_profile_generator', action: 'done', profile_id: id }) @@ -88,9 +88,9 @@ const generateHKPProfile = async (id, keyserverDomain) => { const keyoxideData = {} if (!keyserverDomain || keyserverDomain === 'keys.openpgp.org') { - keyoxideData.url = `https://${process.env.DOMAIN}/hkp/${id}` + keyoxideData.url = `${process.env.SCHEME}://${process.env.DOMAIN}/hkp/${id}` } else { - keyoxideData.url = `https://${process.env.DOMAIN}/hkp/${keyserverDomain}/${id}` + keyoxideData.url = `${process.env.SCHEME}://${process.env.DOMAIN}/hkp/${keyserverDomain}/${id}` } logger.debug('Generating a HKP profile', @@ -196,7 +196,7 @@ const generateKeybaseProfile = async (username, fingerprint) => { keyData = processKeyData(keyData) const keyoxideData = {} - keyoxideData.url = `https://${process.env.DOMAIN}/keybase/${username}/${fingerprint}` + keyoxideData.url = `${process.env.SCHEME}://${process.env.DOMAIN}/keybase/${username}/${fingerprint}` logger.debug('Generating a Keybase profile', { component: 'keybase_profile_generator', action: 'done', username, fingerprint }) diff --git a/static-src/kx-claim.js b/static-src/kx-claim.js index fa4ab83..5db2adf 100644 --- a/static-src/kx-claim.js +++ b/static-src/kx-claim.js @@ -49,7 +49,8 @@ export class Claim extends HTMLElement { await claim.verify({ proxy: { policy: 'adaptive', - hostname: 'PLACEHOLDER__PROXY_HOSTNAME' + hostname: 'PLACEHOLDER__PROXY_HOSTNAME', + scheme: 'PLACEHOLDER__PROXY_SCHEME' } }); this.setAttribute('data-claim', JSON.stringify(claim)); @@ -192,7 +193,7 @@ export class Claim extends HTMLElement { const subsection_info_text = subsection_info.appendChild(document.createElement('div')); const result_proxyUsed = subsection_info_text.appendChild(document.createElement('p')); - result_proxyUsed.innerHTML = `A proxy was used to fetch the proof: PLACEHOLDER__PROXY_HOSTNAME`; + result_proxyUsed.innerHTML = `A proxy was used to fetch the proof: PLACEHOLDER__PROXY_HOSTNAME`; } // TODO Display errors @@ -217,4 +218,4 @@ export class Claim extends HTMLElement { // }); // } } -} \ No newline at end of file +} diff --git a/static-src/utils.js b/static-src/utils.js index 50e21b5..98135cb 100644 --- a/static-src/utils.js +++ b/static-src/utils.js @@ -46,19 +46,20 @@ export async function computeWKDLocalPart(localPart) { // Generate Keyoxide profile URL export async function generateProfileURL(data) { let hostname = data.hostname || window.location.hostname; + let scheme = data.scheme || window.location.protocol.slice(0,-1); if (data.input == "") { return "Waiting for input…"; } switch (data.source) { case "wkd": - return `https://${hostname}/${data.input}`; + return `${scheme}://${hostname}/${data.input}`; break; case "hkp": if (/.*@.*\..*/.test(data.input)) { - return `https://${hostname}/hkp/${data.input}`; + return `${scheme}://${hostname}/hkp/${data.input}`; } else { - return `https://${hostname}/${data.input}`; + return `${scheme}://${hostname}/${data.input}`; } break; case "keybase": @@ -67,7 +68,7 @@ export async function generateProfileURL(data) { return "Incorrect Keybase public key URL."; } const match = data.input.match(re); - return `https://${hostname}/keybase/${match[1]}/${match[2]}`; + return `${scheme}://${hostname}/keybase/${match[1]}/${match[2]}`; break; } } @@ -240,4 +241,4 @@ export async function verifyBcryptHash(input, hash) { } catch (_) { return false; } -} \ No newline at end of file +} From 9196aeaad636df15432406bc803aa2489f9611c5 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Sun, 11 Jun 2023 23:52:53 -0500 Subject: [PATCH 03/21] Add SCHEME environment variable to vscodium launcher --- .vscode/launch.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index d0b1191..07e5488 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -16,8 +16,8 @@ "/**" ], "type": "node", - "env": { "DOMAIN": "localhost:3000"}, + "env": { "DOMAIN": "localhost:3000", "SCHEME": "http"}, "outputCapture": "std" } ] -} \ No newline at end of file +} From 21bae8df69ccd60c834897c3d79216159b240faf Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Mon, 12 Jun 2023 00:16:52 -0500 Subject: [PATCH 04/21] fix expected URL with SCHEME env var added --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 81a1633..6c582f1 100644 --- a/README.md +++ b/README.md @@ -45,16 +45,16 @@ To run Keyoxide locally on your machine for development: 2. Swap over to LTS: `nvm use --lts` 3. Ensure that yarn is installed: `npm install -g yarn` 4. Install node dependencies: `yarn` -5. Run the server a la `DOMAIN='localhost:3000' yarn dev` +5. Run the server locally a la `SCHEME='http' DOMAIN='localhost:3000' yarn dev` -Keyoxide will now be available at [https://localhost:3000](https://localhost:3000) +Keyoxide will now be available at [http://localhost:3000](http://localhost:3000) For **vscode/vscodium** development, a `launcher.json` is provided. Ensure that -the first four steps have been performed at least once to ensure the proper -node and yarn binaries are available to vscode, then load the project. The -launcher provides a "Launch via yarn" debug option that will start the project -with the appropriate version and environment variables set. The project will -then be available in a browser. +the first four steps have been performed at least once so that the proper node +and yarn binaries are available to vscode, then load the project. The launcher +provides a "Launch via yarn" debug option that will start the project with the +appropriate version and environment variables set. The project will then be +available in a browser. There is also a `shell.nix` file to install Node and yarn (steps one through three above). From 223e39209c719d42062f55177b744d196c5a51ef Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Mon, 12 Jun 2023 01:00:05 -0500 Subject: [PATCH 05/21] Make sure default scheme is set here too --- src/server/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/server/index.js b/src/server/index.js index c348a13..313a15b 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -32,6 +32,10 @@ import * as doipjs from 'doipjs' import { fetchWKD, fetchHKP, fetchSignature, fetchKeybase } from './keys.js' import libravatar from 'libravatar' +const scheme = process.env.PROXY_SCHEME ? process.env.PROXY_SCHEME +: process.env.SCHEME ? process.env.SCHEME +: 'https' + const generateWKDProfile = async (id) => { logger.debug('Generating a WKD profile', { component: 'wkd_profile_generator', action: 'start', profile_id: id }) @@ -46,7 +50,7 @@ const generateWKDProfile = async (id) => { keyData = processKeyData(keyData) const keyoxideData = {} - keyoxideData.url = `${process.env.SCHEME}://${process.env.DOMAIN}/wkd/${id}` + keyoxideData.url = `${scheme}://${process.env.DOMAIN}/wkd/${id}` logger.debug('Generating a WKD profile', { component: 'wkd_profile_generator', action: 'done', profile_id: id }) @@ -88,9 +92,9 @@ const generateHKPProfile = async (id, keyserverDomain) => { const keyoxideData = {} if (!keyserverDomain || keyserverDomain === 'keys.openpgp.org') { - keyoxideData.url = `${process.env.SCHEME}://${process.env.DOMAIN}/hkp/${id}` + keyoxideData.url = `${scheme}://${process.env.DOMAIN}/hkp/${id}` } else { - keyoxideData.url = `${process.env.SCHEME}://${process.env.DOMAIN}/hkp/${keyserverDomain}/${id}` + keyoxideData.url = `${scheme}://${process.env.DOMAIN}/hkp/${keyserverDomain}/${id}` } logger.debug('Generating a HKP profile', @@ -196,7 +200,7 @@ const generateKeybaseProfile = async (username, fingerprint) => { keyData = processKeyData(keyData) const keyoxideData = {} - keyoxideData.url = `${process.env.SCHEME}://${process.env.DOMAIN}/keybase/${username}/${fingerprint}` + keyoxideData.url = `${scheme}://${process.env.DOMAIN}/keybase/${username}/${fingerprint}` logger.debug('Generating a Keybase profile', { component: 'keybase_profile_generator', action: 'done', username, fingerprint }) From cf11a3f343fbb5d68ee62307f051af2d103a7bf2 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Mon, 12 Jun 2023 10:02:43 -0500 Subject: [PATCH 06/21] Linting change --- src/server/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server/index.js b/src/server/index.js index 313a15b..d35dbc3 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -32,9 +32,11 @@ import * as doipjs from 'doipjs' import { fetchWKD, fetchHKP, fetchSignature, fetchKeybase } from './keys.js' import libravatar from 'libravatar' -const scheme = process.env.PROXY_SCHEME ? process.env.PROXY_SCHEME -: process.env.SCHEME ? process.env.SCHEME -: 'https' +const scheme = process.env.PROXY_SCHEME + ? process.env.PROXY_SCHEME + : process.env.SCHEME + ? process.env.SCHEME + : 'https' const generateWKDProfile = async (id) => { logger.debug('Generating a WKD profile', From 916dfcc6d3e0c7c043d85489bd7caee81bc51175 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Tue, 13 Jun 2023 19:12:38 -0500 Subject: [PATCH 07/21] Add empty matrix env vars to launch.json --- .vscode/launch.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 07e5488..dab9439 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -16,7 +16,12 @@ "/**" ], "type": "node", - "env": { "DOMAIN": "localhost:3000", "SCHEME": "http"}, + "env": { + "DOMAIN": "localhost:3000", + "SCHEME": "http", + "MATRIX_ACCESS_TOKEN": "", + "MATRIX_INSTANCE": "" + }, "outputCapture": "std" } ] From 0dfc0cbe103728dae7d2b86082e9b25cb9d67edc Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Tue, 13 Jun 2023 19:24:47 -0500 Subject: [PATCH 08/21] Update tests to pass in `scheme`, update dev quick start instructions --- README.md | 2 +- test/browser.test.js | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6c582f1..c4ea6b3 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ To run Keyoxide locally on your machine for development: 2. Swap over to LTS: `nvm use --lts` 3. Ensure that yarn is installed: `npm install -g yarn` 4. Install node dependencies: `yarn` -5. Run the server locally a la `SCHEME='http' DOMAIN='localhost:3000' yarn dev` +5. Run the server locally a la `SCHEME='http' DOMAIN='localhost:3000' MATRIX_ACCESS_TOKEN='XXXXXXyourTokenXXXXXX' MATRIX_INSTANCE='abc.yourmatrixdomain.tld' yarn dev` Keyoxide will now be available at [http://localhost:3000](http://localhost:3000) diff --git a/test/browser.test.js b/test/browser.test.js index a6c25ef..2315fa8 100644 --- a/test/browser.test.js +++ b/test/browser.test.js @@ -70,7 +70,8 @@ describe('browser', function () { const local = await utils.generateProfileURL({ source: 'wkd', input: 'test@doip.rocks', - hostname: 'keyoxide.instance' + hostname: 'keyoxide.instance', + scheme: 'https' }) local.should.equal('https://keyoxide.instance/test@doip.rocks') }) @@ -78,7 +79,8 @@ describe('browser', function () { const local = await utils.generateProfileURL({ source: 'hkp', input: 'test@doip.rocks', - hostname: 'keyoxide.instance' + hostname: 'keyoxide.instance', + scheme: 'https' }) local.should.equal('https://keyoxide.instance/hkp/test@doip.rocks') }) @@ -86,7 +88,8 @@ describe('browser', function () { const local = await utils.generateProfileURL({ source: 'hkp', input: '3637202523E7C1309AB79E99EF2DC5827B445F4B', - hostname: 'keyoxide.instance' + hostname: 'keyoxide.instance', + scheme: 'https' }) local.should.equal('https://keyoxide.instance/3637202523E7C1309AB79E99EF2DC5827B445F4B') }) @@ -94,10 +97,11 @@ describe('browser', function () { const local = await utils.generateProfileURL({ source: 'keybase', input: 'https://keybase.io/doip/pgp_keys.asc?fingerprint=3637202523E7C1309AB79E99EF2DC5827B445F4B', - hostname: 'keyoxide.instance' + hostname: 'keyoxide.instance', + scheme: 'https' }) local.should.equal('https://keyoxide.instance/keybase/doip/3637202523E7C1309AB79E99EF2DC5827B445F4B') }) }) }) -}) \ No newline at end of file +}) From c75291c201125d0bdf399b96181953adb507fbbe Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Mon, 3 Jul 2023 14:52:28 -0500 Subject: [PATCH 09/21] Revert "Update tests to pass in `scheme`, update dev quick start instructions" This reverts commit 0dfc0cbe103728dae7d2b86082e9b25cb9d67edc. --- README.md | 2 +- test/browser.test.js | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c4ea6b3..6c582f1 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ To run Keyoxide locally on your machine for development: 2. Swap over to LTS: `nvm use --lts` 3. Ensure that yarn is installed: `npm install -g yarn` 4. Install node dependencies: `yarn` -5. Run the server locally a la `SCHEME='http' DOMAIN='localhost:3000' MATRIX_ACCESS_TOKEN='XXXXXXyourTokenXXXXXX' MATRIX_INSTANCE='abc.yourmatrixdomain.tld' yarn dev` +5. Run the server locally a la `SCHEME='http' DOMAIN='localhost:3000' yarn dev` Keyoxide will now be available at [http://localhost:3000](http://localhost:3000) diff --git a/test/browser.test.js b/test/browser.test.js index 2315fa8..a6c25ef 100644 --- a/test/browser.test.js +++ b/test/browser.test.js @@ -70,8 +70,7 @@ describe('browser', function () { const local = await utils.generateProfileURL({ source: 'wkd', input: 'test@doip.rocks', - hostname: 'keyoxide.instance', - scheme: 'https' + hostname: 'keyoxide.instance' }) local.should.equal('https://keyoxide.instance/test@doip.rocks') }) @@ -79,8 +78,7 @@ describe('browser', function () { const local = await utils.generateProfileURL({ source: 'hkp', input: 'test@doip.rocks', - hostname: 'keyoxide.instance', - scheme: 'https' + hostname: 'keyoxide.instance' }) local.should.equal('https://keyoxide.instance/hkp/test@doip.rocks') }) @@ -88,8 +86,7 @@ describe('browser', function () { const local = await utils.generateProfileURL({ source: 'hkp', input: '3637202523E7C1309AB79E99EF2DC5827B445F4B', - hostname: 'keyoxide.instance', - scheme: 'https' + hostname: 'keyoxide.instance' }) local.should.equal('https://keyoxide.instance/3637202523E7C1309AB79E99EF2DC5827B445F4B') }) @@ -97,11 +94,10 @@ describe('browser', function () { const local = await utils.generateProfileURL({ source: 'keybase', input: 'https://keybase.io/doip/pgp_keys.asc?fingerprint=3637202523E7C1309AB79E99EF2DC5827B445F4B', - hostname: 'keyoxide.instance', - scheme: 'https' + hostname: 'keyoxide.instance' }) local.should.equal('https://keyoxide.instance/keybase/doip/3637202523E7C1309AB79E99EF2DC5827B445F4B') }) }) }) -}) +}) \ No newline at end of file From 55847461dc33d00dd1cd6e8d344a4837d089c8a9 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Mon, 3 Jul 2023 14:52:42 -0500 Subject: [PATCH 10/21] Revert "Add empty matrix env vars to launch.json" This reverts commit 916dfcc6d3e0c7c043d85489bd7caee81bc51175. --- .vscode/launch.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index dab9439..07e5488 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -16,12 +16,7 @@ "/**" ], "type": "node", - "env": { - "DOMAIN": "localhost:3000", - "SCHEME": "http", - "MATRIX_ACCESS_TOKEN": "", - "MATRIX_INSTANCE": "" - }, + "env": { "DOMAIN": "localhost:3000", "SCHEME": "http"}, "outputCapture": "std" } ] From 939f118931f0b1d92c4539db7b184e9559337dbd Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Mon, 3 Jul 2023 14:52:54 -0500 Subject: [PATCH 11/21] Revert "fix expected URL with SCHEME env var added" This reverts commit 21bae8df69ccd60c834897c3d79216159b240faf. --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6c582f1..81a1633 100644 --- a/README.md +++ b/README.md @@ -45,16 +45,16 @@ To run Keyoxide locally on your machine for development: 2. Swap over to LTS: `nvm use --lts` 3. Ensure that yarn is installed: `npm install -g yarn` 4. Install node dependencies: `yarn` -5. Run the server locally a la `SCHEME='http' DOMAIN='localhost:3000' yarn dev` +5. Run the server a la `DOMAIN='localhost:3000' yarn dev` -Keyoxide will now be available at [http://localhost:3000](http://localhost:3000) +Keyoxide will now be available at [https://localhost:3000](https://localhost:3000) For **vscode/vscodium** development, a `launcher.json` is provided. Ensure that -the first four steps have been performed at least once so that the proper node -and yarn binaries are available to vscode, then load the project. The launcher -provides a "Launch via yarn" debug option that will start the project with the -appropriate version and environment variables set. The project will then be -available in a browser. +the first four steps have been performed at least once to ensure the proper +node and yarn binaries are available to vscode, then load the project. The +launcher provides a "Launch via yarn" debug option that will start the project +with the appropriate version and environment variables set. The project will +then be available in a browser. There is also a `shell.nix` file to install Node and yarn (steps one through three above). From 59e4281b438f6ba69e293ab7e042c13969dd2299 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Mon, 3 Jul 2023 14:53:06 -0500 Subject: [PATCH 12/21] Revert "Add SCHEME environment variable to vscodium launcher" This reverts commit 9196aeaad636df15432406bc803aa2489f9611c5. --- .vscode/launch.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 07e5488..d0b1191 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -16,8 +16,8 @@ "/**" ], "type": "node", - "env": { "DOMAIN": "localhost:3000", "SCHEME": "http"}, + "env": { "DOMAIN": "localhost:3000"}, "outputCapture": "std" } ] -} +} \ No newline at end of file From f620684f35db8e31cc87a2afa3fb5451f95331e8 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Mon, 3 Jul 2023 14:53:15 -0500 Subject: [PATCH 13/21] Revert "Quickstart guidance updates" This reverts commit 5e0561df7efc3b96fced8c5dec8eef80d950e16c. --- .vscode/launch.json | 23 ----------------------- README.md | 25 +++++++++---------------- 2 files changed, 9 insertions(+), 39 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index d0b1191..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch via yarn", - "runtimeVersion": "18", - "request": "launch", - "runtimeArgs": [ - "dev" - ], - "runtimeExecutable": "yarn", - "skipFiles": [ - "/**" - ], - "type": "node", - "env": { "DOMAIN": "localhost:3000"}, - "outputCapture": "std" - } - ] -} \ No newline at end of file diff --git a/README.md b/README.md index 81a1633..138ea5e 100644 --- a/README.md +++ b/README.md @@ -41,21 +41,14 @@ Please note that this project has a [Code of Conduct](https://codeberg.org/keyox To run Keyoxide locally on your machine for development: -1. Install Node using [nvm](https://github.com/nvm-sh/nvm): `nvm install --lts` -2. Swap over to LTS: `nvm use --lts` -3. Ensure that yarn is installed: `npm install -g yarn` -4. Install node dependencies: `yarn` -5. Run the server a la `DOMAIN='localhost:3000' yarn dev` +- install either + - NodeJS + - directly from their [website](https://nodejs.org/en/), or + - using [nvm](https://github.com/nvm-sh/nvm): `nvm install --lts; nvm use --lts` + - [yarn](https://yarnpkg.com/) + - [nix](https://nixos.org/guides/install-nix.html) with + [direnv](https://direnv.net/) will install yarn and other dependencies. +- install dependencies with `npm install` or `yarn` +- run the server with `npm dev` or `yarn dev` Keyoxide will now be available at [https://localhost:3000](https://localhost:3000) - -For **vscode/vscodium** development, a `launcher.json` is provided. Ensure that -the first four steps have been performed at least once to ensure the proper -node and yarn binaries are available to vscode, then load the project. The -launcher provides a "Launch via yarn" debug option that will start the project -with the appropriate version and environment variables set. The project will -then be available in a browser. - -There is also a `shell.nix` file to install Node and yarn (steps one through -three above). - From ba9ae78d7d90894a746ff4552e2257b64c501f81 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Mon, 3 Jul 2023 15:02:15 -0500 Subject: [PATCH 14/21] Update and add tests for configurable scheme --- test/browser.test.js | 58 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/test/browser.test.js b/test/browser.test.js index a6c25ef..f8130c2 100644 --- a/test/browser.test.js +++ b/test/browser.test.js @@ -66,38 +66,78 @@ describe('browser', function () { }) }) describe('generateProfileURL()', function () { - it('should handle a WKD URL', async function () { + it('should handle a https WKD URL', async function () { const local = await utils.generateProfileURL({ source: 'wkd', input: 'test@doip.rocks', - hostname: 'keyoxide.instance' + hostname: 'keyoxide.instance', + scheme: 'https' }) local.should.equal('https://keyoxide.instance/test@doip.rocks') }) - it('should handle a HKP+email URL', async function () { + it('should handle a http WKD URL', async function () { + const local = await utils.generateProfileURL({ + source: 'wkd', + input: 'test@doip.rocks', + hostname: 'keyoxide.instance', + scheme: 'http' + }) + local.should.equal('http://keyoxide.instance/test@doip.rocks') + }) + it('should handle a https HKP+email URL', async function () { const local = await utils.generateProfileURL({ source: 'hkp', input: 'test@doip.rocks', - hostname: 'keyoxide.instance' + hostname: 'keyoxide.instance', + scheme: 'https' }) local.should.equal('https://keyoxide.instance/hkp/test@doip.rocks') }) - it('should handle a HKP+fingerprint URL', async function () { + it('should handle a http HKP+email URL', async function () { + const local = await utils.generateProfileURL({ + source: 'hkp', + input: 'test@doip.rocks', + hostname: 'keyoxide.instance', + scheme: 'http' + }) + local.should.equal('http://keyoxide.instance/hkp/test@doip.rocks') + }) + it('should handle a https HKP+fingerprint URL', async function () { const local = await utils.generateProfileURL({ source: 'hkp', input: '3637202523E7C1309AB79E99EF2DC5827B445F4B', - hostname: 'keyoxide.instance' + hostname: 'keyoxide.instance', + scheme: 'https' }) local.should.equal('https://keyoxide.instance/3637202523E7C1309AB79E99EF2DC5827B445F4B') }) - it('should handle a keybase URL', async function () { + it('should handle a http HKP+fingerprint URL', async function () { + const local = await utils.generateProfileURL({ + source: 'hkp', + input: '3637202523E7C1309AB79E99EF2DC5827B445F4B', + hostname: 'keyoxide.instance', + scheme: 'http' + }) + local.should.equal('http://keyoxide.instance/3637202523E7C1309AB79E99EF2DC5827B445F4B') + }) + it('should handle a https keybase URL', async function () { const local = await utils.generateProfileURL({ source: 'keybase', input: 'https://keybase.io/doip/pgp_keys.asc?fingerprint=3637202523E7C1309AB79E99EF2DC5827B445F4B', - hostname: 'keyoxide.instance' + hostname: 'keyoxide.instance', + scheme: 'https' }) local.should.equal('https://keyoxide.instance/keybase/doip/3637202523E7C1309AB79E99EF2DC5827B445F4B') }) + it('should handle a http keybase URL', async function () { + const local = await utils.generateProfileURL({ + source: 'keybase', + input: 'https://keybase.io/doip/pgp_keys.asc?fingerprint=3637202523E7C1309AB79E99EF2DC5827B445F4B', + hostname: 'keyoxide.instance', + scheme: 'http' + }) + local.should.equal('http://keyoxide.instance/keybase/doip/3637202523E7C1309AB79E99EF2DC5827B445F4B') + }) }) }) -}) \ No newline at end of file +}) From f5ef4b6623c992e1c748ff0b4088cd94a35cb23b Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Tue, 4 Jul 2023 00:06:33 -0500 Subject: [PATCH 15/21] Initial testing of configurable scheme code with mocks --- package.json | 1 + test/server.test.js | 63 +++++++++++++++++++++++++++++++++++++++++++++ yarn.lock | 5 ++++ 3 files changed, 69 insertions(+) diff --git a/package.json b/package.json index 35b6eb4..088dee9 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "chai": "^4.3.6", "copy-webpack-plugin": "^10.2.4", "css-loader": "^6.6.0", + "esmock": "^2.3.1", "license-check-and-add": "^4.0.5", "mini-css-extract-plugin": "^2.5.3", "mocha": "^10.1.0", diff --git a/test/server.test.js b/test/server.test.js index 42185f9..c19ea92 100644 --- a/test/server.test.js +++ b/test/server.test.js @@ -1,6 +1,10 @@ import 'chai/register-should.js' +import esmock from 'esmock' + import * as utils from '../src/server/utils.js' +const _env = Object.assign({},process.env) + describe('server', function () { describe('utils', function () { describe('computeWKDLocalPart()', function () { @@ -26,4 +30,63 @@ describe('server', function () { }) }) }) + describe('index', function () { + + // Brittle mocking :( + describe('generateHKPProfile', function() { + + it('should handle implicit scheme with implicit keys.openpgp.org keyserver', async function () { + + // Arrange + const fingerprint = '79895B2E0F87503F1DDE80B649765D7F0DDD9BD5' + // the process.env needs to be here, before the esmock setup. + process.env.DOMAIN = "keyoxide.org" + //process.env.SCHEME = "http" + + const index = await esmock('../src/server/index.js', { + '../src/server/keys.js': { + fetchHKP: () => { + return Promise.resolve({ + publicKey: { + getPrimaryUser: () => { + return { + user: { + userID: { + email: "example@example.org" + } + } + } + } + }, + fetchURL: 'example.com' + }) + } + }, + 'doipjs': { + keys: { + process: () => { + return { + key: {}, + 'fingerprint': fingerprint, + users: [] + } + } + } + }, + 'libravatar': { + get_avatar_url: () => { + return "example.org/avatar.png" + } + } + }) + + // Act + const local = await index.generateHKPProfile(fingerprint) + + // Assert + local.keyoxide.url.should.equal(`https://keyoxide.org/hkp/${fingerprint}`) + + }) + }) + }) }) \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 19a39c0..3614114 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2204,6 +2204,11 @@ eslint@^8.13.0: strip-json-comments "^3.1.0" text-table "^0.2.0" +esmock@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/esmock/-/esmock-2.3.1.tgz#27a3afea73d7fb352f27c7ac04f66cfbd2c34316" + integrity sha512-ZxuxfhwGSlStiJFbw6Z+a70fB6SutTcUr0X8dhehx6aqiC5kgBvEYV4xNW94cKaD8gaqD7P00RjBH/pfao2CQA== + espree@^9.4.0: version "9.4.1" resolved "https://registry.yarnpkg.com/espree/-/espree-9.4.1.tgz#51d6092615567a2c2cff7833445e37c28c0065bd" From f74260f79be277149c6e65cabe13d8e718ec5c5f Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Tue, 4 Jul 2023 10:43:41 -0500 Subject: [PATCH 16/21] Use esmock for mocking dependencies --- package.json | 2 +- src/server/index.js | 22 ++++++++-------- test/server.test.js | 62 ++++++++++++++++++++++++++++++++++++++------- 3 files changed, 66 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 088dee9..06b33ac 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "scripts": { "start": "node --experimental-fetch ./", "dev": "LOG_LEVEL=debug yarn run watch & yarn run build:static:dev", - "test": "yarn run standard:check && yarn run rome:check && mocha", + "test": "yarn run standard:check && yarn run rome:check && mocha --loader=esmock", "watch": "./node_modules/.bin/nodemon --config nodemon.json ./", "build": "yarn run build:server & yarn run build:static", "build:server": "ncc build ./src/index.js -o dist", diff --git a/src/server/index.js b/src/server/index.js index d35dbc3..eeef49c 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -32,12 +32,6 @@ import * as doipjs from 'doipjs' import { fetchWKD, fetchHKP, fetchSignature, fetchKeybase } from './keys.js' import libravatar from 'libravatar' -const scheme = process.env.PROXY_SCHEME - ? process.env.PROXY_SCHEME - : process.env.SCHEME - ? process.env.SCHEME - : 'https' - const generateWKDProfile = async (id) => { logger.debug('Generating a WKD profile', { component: 'wkd_profile_generator', action: 'start', profile_id: id }) @@ -52,7 +46,7 @@ const generateWKDProfile = async (id) => { keyData = processKeyData(keyData) const keyoxideData = {} - keyoxideData.url = `${scheme}://${process.env.DOMAIN}/wkd/${id}` + keyoxideData.url = `${getScheme()}://${process.env.DOMAIN}/wkd/${id}` logger.debug('Generating a WKD profile', { component: 'wkd_profile_generator', action: 'done', profile_id: id }) @@ -94,9 +88,9 @@ const generateHKPProfile = async (id, keyserverDomain) => { const keyoxideData = {} if (!keyserverDomain || keyserverDomain === 'keys.openpgp.org') { - keyoxideData.url = `${scheme}://${process.env.DOMAIN}/hkp/${id}` + keyoxideData.url = `${getScheme()}://${process.env.DOMAIN}/hkp/${id}` } else { - keyoxideData.url = `${scheme}://${process.env.DOMAIN}/hkp/${keyserverDomain}/${id}` + keyoxideData.url = `${getScheme()}://${process.env.DOMAIN}/hkp/${keyserverDomain}/${id}` } logger.debug('Generating a HKP profile', @@ -202,7 +196,7 @@ const generateKeybaseProfile = async (username, fingerprint) => { keyData = processKeyData(keyData) const keyoxideData = {} - keyoxideData.url = `${scheme}://${process.env.DOMAIN}/keybase/${username}/${fingerprint}` + keyoxideData.url = `${getScheme()}://${process.env.DOMAIN}/keybase/${username}/${fingerprint}` logger.debug('Generating a Keybase profile', { component: 'keybase_profile_generator', action: 'done', username, fingerprint }) @@ -271,6 +265,14 @@ const computeExtraData = async (key, keyData) => { } } +const getScheme = () => { + return process.env.PROXY_SCHEME + ? process.env.PROXY_SCHEME + : process.env.SCHEME + ? process.env.SCHEME + : 'https' +} + export { generateWKDProfile } export { generateHKPProfile } export { generateAutoProfile } diff --git a/test/server.test.js b/test/server.test.js index c19ea92..192d53f 100644 --- a/test/server.test.js +++ b/test/server.test.js @@ -30,20 +30,27 @@ describe('server', function () { }) }) }) + + // NOTE: This is necessarily brittle. If these tests fail + // in the future, start looking here for what new behaviour + // in the implementation is or isn't getting mocked + // appropriately. describe('index', function () { - // Brittle mocking :( - describe('generateHKPProfile', function() { + describe('generateHKPProfile()', function() { - it('should handle implicit scheme with implicit keys.openpgp.org keyserver', async function () { + let index; + let fingerprint; - // Arrange - const fingerprint = '79895B2E0F87503F1DDE80B649765D7F0DDD9BD5' - // the process.env needs to be here, before the esmock setup. + this.beforeEach(async () => { + + // Common arrangement pieces that don't change per test + fingerprint = '79895B2E0F87503F1DDE80B649765D7F0DDD9BD5' process.env.DOMAIN = "keyoxide.org" - //process.env.SCHEME = "http" - const index = await esmock('../src/server/index.js', { + // mock the appropriate pieces of our dependencies so we + // can test just the `keyoxide.url` return value. + index = await esmock('../src/server/index.js', { '../src/server/keys.js': { fetchHKP: () => { return Promise.resolve({ @@ -52,7 +59,7 @@ describe('server', function () { return { user: { userID: { - email: "example@example.org" + email: "example@example.net" } } } @@ -79,6 +86,16 @@ describe('server', function () { } } }) + }) + + this.afterEach(() => { + process.env = _env + }) + + it('should handle implicit scheme for keyoxide URL', async function () { + + // Arrange + // no setting process.env.SCHEME // Act const local = await index.generateHKPProfile(fingerprint) @@ -87,6 +104,33 @@ describe('server', function () { local.keyoxide.url.should.equal(`https://keyoxide.org/hkp/${fingerprint}`) }) + + it('should handle explicit http scheme for keyoxide URL', async function () { + + // Arrange + process.env.SCHEME = "http" + + // Act + const local = await index.generateHKPProfile(fingerprint) + + // Assert + local.keyoxide.url.should.equal(`http://keyoxide.org/hkp/${fingerprint}`) + + }) + + it('should handle explicit https scheme for keyoxide URL', async function () { + + // Arrange + process.env.SCHEME = "https" + + // Act + const local = await index.generateHKPProfile(fingerprint) + + // Assert + local.keyoxide.url.should.equal(`https://keyoxide.org/hkp/${fingerprint}`) + + }) + }) }) }) \ No newline at end of file From 03d7bf3446813cf869d782925a12db0a9ed40e21 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Fri, 14 Jul 2023 18:38:06 -0500 Subject: [PATCH 17/21] Test adjustments for doipjs 1.0 and v3 API --- package.json | 1 - src/server/index.js | 2 +- test/server.test.js | 43 +++++++++++++------------------------------ 3 files changed, 14 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index beed55f..0acc5e5 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ "scripts": { "start": "node --experimental-fetch ./", "dev": "LOG_LEVEL=debug yarn run watch & yarn run build:static:dev", - "test": "yarn run standard:check && yarn run rome:check && mocha --loader=esmock", "test": "yarn run lint && mocha --loader=esmock", "watch": "./node_modules/.bin/nodemon --config nodemon.json ./", "build": "yarn run build:server & yarn run build:static", diff --git a/src/server/index.js b/src/server/index.js index 19f217f..6990187 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -38,7 +38,7 @@ const generateAspeProfile = async (id) => { return doipjs.asp.fetchASPE(id) .then(profile => { - profile.addVerifier('keyoxide', `https://${process.env.DOMAIN}/${id}`) + profile.addVerifier('keyoxide', `${getScheme()}://${process.env.DOMAIN}/${id}`) profile = processAspProfile(profile) return profile }) diff --git a/test/server.test.js b/test/server.test.js index 192d53f..1674161 100644 --- a/test/server.test.js +++ b/test/server.test.js @@ -1,5 +1,6 @@ import 'chai/register-should.js' import esmock from 'esmock' +import * as doipjs from 'doipjs' import * as utils from '../src/server/utils.js' @@ -41,6 +42,8 @@ describe('server', function () { let index; let fingerprint; + /** @type {import('doipjs').Profile */ + let profile; this.beforeEach(async () => { @@ -48,36 +51,16 @@ describe('server', function () { fingerprint = '79895B2E0F87503F1DDE80B649765D7F0DDD9BD5' process.env.DOMAIN = "keyoxide.org" + const persona = new doipjs.Persona("test", [new doipjs.Claim('dns:domain.tld?type=TXT')]) + + profile = new doipjs.Profile(doipjs.enums.ProfileType.OPENPGP, fingerprint, [persona]) + // mock the appropriate pieces of our dependencies so we // can test just the `keyoxide.url` return value. index = await esmock('../src/server/index.js', { - '../src/server/keys.js': { + '../src/server/openpgpProfiles.js': { fetchHKP: () => { - return Promise.resolve({ - publicKey: { - getPrimaryUser: () => { - return { - user: { - userID: { - email: "example@example.net" - } - } - } - } - }, - fetchURL: 'example.com' - }) - } - }, - 'doipjs': { - keys: { - process: () => { - return { - key: {}, - 'fingerprint': fingerprint, - users: [] - } - } + return Promise.resolve(profile) } }, 'libravatar': { @@ -101,7 +84,7 @@ describe('server', function () { const local = await index.generateHKPProfile(fingerprint) // Assert - local.keyoxide.url.should.equal(`https://keyoxide.org/hkp/${fingerprint}`) + local.verifiers[0].url.should.equal(`https://keyoxide.org/hkp/${fingerprint}`) }) @@ -114,7 +97,7 @@ describe('server', function () { const local = await index.generateHKPProfile(fingerprint) // Assert - local.keyoxide.url.should.equal(`http://keyoxide.org/hkp/${fingerprint}`) + local.verifiers[0].url.should.equal(`http://keyoxide.org/hkp/${fingerprint}`) }) @@ -127,10 +110,10 @@ describe('server', function () { const local = await index.generateHKPProfile(fingerprint) // Assert - local.keyoxide.url.should.equal(`https://keyoxide.org/hkp/${fingerprint}`) + local.verifiers[0].url.should.equal(`https://keyoxide.org/hkp/${fingerprint}`) }) }) }) -}) \ No newline at end of file +}) From ba62125b18e386b99dee5626e7160d82698b2503 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Sat, 19 Aug 2023 15:49:53 -0500 Subject: [PATCH 18/21] Temporary fork while working on new providers --- nodemon.json | 3 ++- package.json | 8 ++++---- yarn.lock | 48 ++++++++++++++++++++++++------------------------ 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/nodemon.json b/nodemon.json index ade96d8..54320a5 100644 --- a/nodemon.json +++ b/nodemon.json @@ -1,6 +1,7 @@ { "execArgs": [ - "--experimental-fetch" + "--experimental-fetch", + "--preserve-symlinks" ], "env": { "NODE_ENV": "development" diff --git a/package.json b/package.json index 0acc5e5..aa46e80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "keyoxide-web", - "version": "3.6.4", + "name": "@aspensmonster/keyoxide-web", + "version": "3.7.0", "description": "Verifying online identity with cryptography", "main": "./src/index.js", "type": "module", @@ -9,7 +9,7 @@ "bent": "^7.3.12", "body-parser": "^1.19.0", "dialog-polyfill": "^0.5.6", - "doipjs": "^1.0.0", + "@aspensmonster/doipjs": "^1.0.1", "dotenv": "^16.0.3", "express": "^4.17.1", "express-validator": "^6.13.0", @@ -43,7 +43,7 @@ "webpack-cli": "^5.0.0" }, "scripts": { - "start": "node --experimental-fetch ./", + "start": "node --experimental-fetch --preserve-symlinks ./", "dev": "LOG_LEVEL=debug yarn run watch & yarn run build:static:dev", "test": "yarn run lint && mocha --loader=esmock", "watch": "./node_modules/.bin/nodemon --config nodemon.json ./", diff --git a/yarn.lock b/yarn.lock index 2844930..0a4aefb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15,6 +15,30 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" +"@aspensmonster/doipjs@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@aspensmonster/doipjs/-/doipjs-1.0.1.tgz#de8e033f67773f6614b40c5101db8f6af0bcc20b" + integrity sha512-HhcFrUGvpbLcFWIyeT3unz+sjhIHs9H3nbp/zO1upiN/J/Ipn2klLVtuXlkqWcOtyG8Sy+lcGn7VwWXOI4TG6g== + dependencies: + "@openpgp/hkp-client" "^0.0.3" + "@openpgp/wkd-client" "^0.0.4" + "@xmpp/client" "^0.13.1" + "@xmpp/debug" "^0.13.0" + axios "^0.25.0" + browser-or-node "^1.3.0" + cors "^2.8.5" + entities "^4.4.0" + express "^4.17.1" + express-validator "^6.10.0" + hash-wasm "^4.9.0" + irc-upd "^0.11.0" + jose "^4.14.4" + merge-options "^3.0.3" + openpgp "^5.5.0" + rfc4648 "^1.5.2" + valid-url "^1.0.9" + validator "^13.9.0" + "@babel/cli@^7.16.0": version "7.22.6" resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.22.6.tgz#63f5be2a0abd587ccfbdc93424fa85f43142cc53" @@ -1830,30 +1854,6 @@ doctypes@^1.1.0: resolved "https://registry.yarnpkg.com/doctypes/-/doctypes-1.1.0.tgz#ea80b106a87538774e8a3a4a5afe293de489e0a9" integrity sha512-LLBi6pEqS6Do3EKQ3J0NqHWV5hhb78Pi8vvESYwyOy2c31ZEZVdtitdzsQsKb7878PEERhzUk0ftqGhG6Mz+pQ== -doipjs@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/doipjs/-/doipjs-1.0.0.tgz#cb0fe9f324a8c3cd3ddb0a4bec009c772f06ab1e" - integrity sha512-KUIbHBE5fdIose6mml9uf4rd5m7cz2g3929DPs1EZamHV/V0M8RgUhGC4u6QGYYHREDrG3fOj43V9RrCG4hv5A== - dependencies: - "@openpgp/hkp-client" "^0.0.3" - "@openpgp/wkd-client" "^0.0.4" - "@xmpp/client" "^0.13.1" - "@xmpp/debug" "^0.13.0" - axios "^0.25.0" - browser-or-node "^1.3.0" - cors "^2.8.5" - entities "^4.4.0" - express "^4.17.1" - express-validator "^6.10.0" - hash-wasm "^4.9.0" - irc-upd "^0.11.0" - jose "^4.14.4" - merge-options "^3.0.3" - openpgp "^5.5.0" - rfc4648 "^1.5.2" - valid-url "^1.0.9" - validator "^13.9.0" - dotenv@^16.0.3: version "16.3.1" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" From 563718ed51056d14feb0605effae5ee9d83108df Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Thu, 31 Aug 2023 20:28:05 -0500 Subject: [PATCH 19/21] Revert "Temporary fork while working on new providers" This reverts commit ba62125b18e386b99dee5626e7160d82698b2503. Accidentally committed this on the wrong branch. --- nodemon.json | 3 +-- package.json | 8 ++++---- yarn.lock | 48 ++++++++++++++++++++++++------------------------ 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/nodemon.json b/nodemon.json index 54320a5..ade96d8 100644 --- a/nodemon.json +++ b/nodemon.json @@ -1,7 +1,6 @@ { "execArgs": [ - "--experimental-fetch", - "--preserve-symlinks" + "--experimental-fetch" ], "env": { "NODE_ENV": "development" diff --git a/package.json b/package.json index aa46e80..0acc5e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@aspensmonster/keyoxide-web", - "version": "3.7.0", + "name": "keyoxide-web", + "version": "3.6.4", "description": "Verifying online identity with cryptography", "main": "./src/index.js", "type": "module", @@ -9,7 +9,7 @@ "bent": "^7.3.12", "body-parser": "^1.19.0", "dialog-polyfill": "^0.5.6", - "@aspensmonster/doipjs": "^1.0.1", + "doipjs": "^1.0.0", "dotenv": "^16.0.3", "express": "^4.17.1", "express-validator": "^6.13.0", @@ -43,7 +43,7 @@ "webpack-cli": "^5.0.0" }, "scripts": { - "start": "node --experimental-fetch --preserve-symlinks ./", + "start": "node --experimental-fetch ./", "dev": "LOG_LEVEL=debug yarn run watch & yarn run build:static:dev", "test": "yarn run lint && mocha --loader=esmock", "watch": "./node_modules/.bin/nodemon --config nodemon.json ./", diff --git a/yarn.lock b/yarn.lock index 0a4aefb..2844930 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15,30 +15,6 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" -"@aspensmonster/doipjs@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@aspensmonster/doipjs/-/doipjs-1.0.1.tgz#de8e033f67773f6614b40c5101db8f6af0bcc20b" - integrity sha512-HhcFrUGvpbLcFWIyeT3unz+sjhIHs9H3nbp/zO1upiN/J/Ipn2klLVtuXlkqWcOtyG8Sy+lcGn7VwWXOI4TG6g== - dependencies: - "@openpgp/hkp-client" "^0.0.3" - "@openpgp/wkd-client" "^0.0.4" - "@xmpp/client" "^0.13.1" - "@xmpp/debug" "^0.13.0" - axios "^0.25.0" - browser-or-node "^1.3.0" - cors "^2.8.5" - entities "^4.4.0" - express "^4.17.1" - express-validator "^6.10.0" - hash-wasm "^4.9.0" - irc-upd "^0.11.0" - jose "^4.14.4" - merge-options "^3.0.3" - openpgp "^5.5.0" - rfc4648 "^1.5.2" - valid-url "^1.0.9" - validator "^13.9.0" - "@babel/cli@^7.16.0": version "7.22.6" resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.22.6.tgz#63f5be2a0abd587ccfbdc93424fa85f43142cc53" @@ -1854,6 +1830,30 @@ doctypes@^1.1.0: resolved "https://registry.yarnpkg.com/doctypes/-/doctypes-1.1.0.tgz#ea80b106a87538774e8a3a4a5afe293de489e0a9" integrity sha512-LLBi6pEqS6Do3EKQ3J0NqHWV5hhb78Pi8vvESYwyOy2c31ZEZVdtitdzsQsKb7878PEERhzUk0ftqGhG6Mz+pQ== +doipjs@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/doipjs/-/doipjs-1.0.0.tgz#cb0fe9f324a8c3cd3ddb0a4bec009c772f06ab1e" + integrity sha512-KUIbHBE5fdIose6mml9uf4rd5m7cz2g3929DPs1EZamHV/V0M8RgUhGC4u6QGYYHREDrG3fOj43V9RrCG4hv5A== + dependencies: + "@openpgp/hkp-client" "^0.0.3" + "@openpgp/wkd-client" "^0.0.4" + "@xmpp/client" "^0.13.1" + "@xmpp/debug" "^0.13.0" + axios "^0.25.0" + browser-or-node "^1.3.0" + cors "^2.8.5" + entities "^4.4.0" + express "^4.17.1" + express-validator "^6.10.0" + hash-wasm "^4.9.0" + irc-upd "^0.11.0" + jose "^4.14.4" + merge-options "^3.0.3" + openpgp "^5.5.0" + rfc4648 "^1.5.2" + valid-url "^1.0.9" + validator "^13.9.0" + dotenv@^16.0.3: version "16.3.1" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" From 4907f094eab526a846d1d6c268d98e07fb093623 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Tue, 12 Sep 2023 16:40:57 -0500 Subject: [PATCH 20/21] Use latest esmock 2.5.0, remove --loader --loader=esmock is required for Node versions less than v20.6.0. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b38dadc..d5cb14d 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "chai": "^4.3.6", "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.6.0", - "esmock": "^2.3.1", + "esmock": "^2.5.0", "license-check-and-add": "^4.0.5", "mini-css-extract-plugin": "^2.5.3", "mocha": "^10.1.0", @@ -45,7 +45,7 @@ "scripts": { "start": "node --experimental-fetch ./", "dev": "LOG_LEVEL=debug yarn run watch && yarn run build:static:dev", - "test": "yarn run lint && mocha --loader=esmock", + "test": "yarn run lint && mocha", "watch": "./node_modules/.bin/nodemon --config nodemon.json ./", "build": "yarn run build:server && yarn run build:static", "build:server": "ncc build ./src/index.js -o dist", From 211d30b2c1fb26ae94036ee65ec27813bbad1526 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Thu, 14 Sep 2023 11:33:10 -0500 Subject: [PATCH 21/21] Include yarn.lock with updated esmock --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 2844930..028e4c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2216,10 +2216,10 @@ eslint@^8.41.0: strip-json-comments "^3.1.0" text-table "^0.2.0" -esmock@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/esmock/-/esmock-2.3.1.tgz#27a3afea73d7fb352f27c7ac04f66cfbd2c34316" - integrity sha512-ZxuxfhwGSlStiJFbw6Z+a70fB6SutTcUr0X8dhehx6aqiC5kgBvEYV4xNW94cKaD8gaqD7P00RjBH/pfao2CQA== +esmock@^2.5.0: + version "2.5.1" + resolved "https://registry.yarnpkg.com/esmock/-/esmock-2.5.1.tgz#cef05c9cd23c46edbfb2e0add34466f6c52e37f6" + integrity sha512-3pu+ri9kNrRjahR8c+FWXphK3xpKrgBwLHu+A+Xj3vw84fGsScWY3SWTH1v5nSiheYQAdlz5Ny+a319tlle1mA== espree@^9.6.0: version "9.6.0"