From 786217e7862a4d956c6510c6a171c86ab160fda6 Mon Sep 17 00:00:00 2001 From: Justin Wind Date: Thu, 1 Jun 2023 11:51:23 -0700 Subject: [PATCH] use native base64url encoding instead of module --- lib/communication.js | 5 ++--- package-lock.json | 8 -------- package.json | 3 +-- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/communication.js b/lib/communication.js index 4856985..82400c3 100644 --- a/lib/communication.js +++ b/lib/communication.js @@ -2,7 +2,6 @@ const axios = require('axios'); const { mf2 } = require('microformats-parser'); -const { base64ToBase64URL } = require('@squeep/base64url'); const { parse: parseLinkHeader } = require('@squeep/web-linking'); const { Iconv } = require('iconv'); const { version: packageVersion, name: packageName } = require('../package.json'); @@ -61,7 +60,7 @@ class Communication { static _challengeFromVerifier(verifier) { const hash = createHash('sha256'); hash.update(verifier); - return base64ToBase64URL(hash.digest('base64')); + return hash.digest('base64url'); } @@ -83,7 +82,7 @@ class Communication { const bufferLength = Math.floor(length * 3 / 4); const randomBuffer = await randomBytesAsync(bufferLength); - const verifier = base64ToBase64URL(randomBuffer.toString('base64')); + const verifier = randomBuffer.toString('base64url'); const challenge = Communication._challengeFromVerifier(verifier); diff --git a/package-lock.json b/package-lock.json index af7a167..3451428 100644 --- a/package-lock.json +++ b/package-lock.json @@ -714,14 +714,6 @@ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", "dev": true }, - "node_modules/@squeep/base64url": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@squeep/base64url/-/base64url-1.0.5.tgz", - "integrity": "sha512-J1UBXYQ4tBuHGnFfg0MdmxCP3oEti7jJWK/qBsg520d8tZd10sL6TXiMDGdBiH9GD3OtlfSYf6wWIN4QfdW21A==", - "engines": { - "node": ">=14" - } - }, "node_modules/@squeep/web-linking": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/@squeep/web-linking/-/web-linking-1.0.7.tgz", diff --git a/package.json b/package.json index 493cedb..d36782a 100644 --- a/package.json +++ b/package.json @@ -20,12 +20,11 @@ "url": "https://git.squeep.com/squeep-indieauth-helper/" }, "engines": { - "node": ">=14" + "node": ">=14.18 || >=15.7" }, "author": "Justin Wind ", "license": "ISC", "dependencies": { - "@squeep/base64url": "^1.0.5", "@squeep/web-linking": "^1.0.7", "axios": "^1.3.3", "iconv": "^3.0.1", -- 2.43.2