use native base64url encoding instead of module
authorJustin Wind <justin.wind+git@gmail.com>
Thu, 1 Jun 2023 18:51:23 +0000 (11:51 -0700)
committerJustin Wind <justin.wind+git@gmail.com>
Thu, 1 Jun 2023 18:51:23 +0000 (11:51 -0700)
lib/communication.js
package-lock.json
package.json

index 4856985ce3f83c4373db7f0653d4064b453d10e2..82400c354e2864d5124b605fcaf965169188ecf8 100644 (file)
@@ -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);
 
index af7a1678c73bc0c11d49c00ef9c448109e863c48..3451428ddc7eff04dbf46b4d512420427e99c211 100644 (file)
       "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",
index 493cedb28382f3d0fa179abda21c053f978ccc7d..d36782aebf7afd51e5b2cd83fdd46aec1a9a6730 100644 (file)
     "url": "https://git.squeep.com/squeep-indieauth-helper/"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.18 || >=15.7"
   },
   "author": "Justin Wind <jwind-npm@squeep.com>",
   "license": "ISC",
   "dependencies": {
-    "@squeep/base64url": "^1.0.5",
     "@squeep/web-linking": "^1.0.7",
     "axios": "^1.3.3",
     "iconv": "^3.0.1",