From fcfcd64d14e0eff314bd8c84fe59e4ee88306e24 Mon Sep 17 00:00:00 2001 From: Dagur Valberg Johannsson Date: Thu, 26 Mar 2026 08:46:26 +0100 Subject: [PATCH] Replace nostr-dev-kit -> nostr-tools The package nostr-dev-kit was using a dependency (tseep) which downstream would flag as not CSP-safe. Additionally nostr-tools footprint is much smaller. --- package-lock.json | 782 +----------------------------- packages/core/package.json | 2 +- packages/core/src/index.ts | 1 + packages/core/src/relay-client.ts | 295 +++++------ 4 files changed, 140 insertions(+), 940 deletions(-) diff --git a/package-lock.json b/package-lock.json index e41095b..5d7d429 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,30 +36,6 @@ "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/@codesandbox/nodebox": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/@codesandbox/nodebox/-/nodebox-0.1.8.tgz", - "integrity": "sha512-2VRS6JDSk+M+pg56GA6CryyUSGPjBEe8Pnae0QL3jJF1mJZJVMDKr93gJRtBbLkfZN6LD/DwMtf+2L0bpWrjqg==", - "license": "SEE LICENSE IN ./LICENSE", - "dependencies": { - "outvariant": "^1.4.0", - "strict-event-emitter": "^0.4.3" - } - }, - "node_modules/@codesandbox/sandpack-client": { - "version": "2.19.8", - "resolved": "https://registry.npmjs.org/@codesandbox/sandpack-client/-/sandpack-client-2.19.8.tgz", - "integrity": "sha512-CMV4nr1zgKzVpx4I3FYvGRM5YT0VaQhALMW9vy4wZRhEyWAtJITQIqZzrTGWqB1JvV7V72dVEUCUPLfYz5hgJQ==", - "license": "Apache-2.0", - "dependencies": { - "@codesandbox/nodebox": "0.1.8", - "buffer": "^6.0.3", - "dequal": "^2.0.2", - "mime-db": "^1.52.0", - "outvariant": "1.4.0", - "static-browser-server": "1.0.3" - } - }, "node_modules/@esbuild/aix-ppc64": { "version": "0.27.3", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", @@ -681,7 +657,6 @@ "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-2.1.1.tgz", "integrity": "sha512-bysYuiVfhxNJuldNXlFEitTVdNnYUc+XNJZd7Qm2a5j1vZHgY+fazadNFWFaMK/2vye0JVlxV3gHmC0WDfAOQw==", "license": "MIT", - "peer": true, "engines": { "node": ">= 20.19.0" }, @@ -689,72 +664,6 @@ "url": "https://paulmillr.com/funding/" } }, - "node_modules/@noble/curves": { - "version": "1.9.7", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz", - "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==", - "license": "MIT", - "dependencies": { - "@noble/hashes": "1.8.0" - }, - "engines": { - "node": "^14.21.3 || >=16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@noble/hashes": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", - "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", - "license": "MIT", - "engines": { - "node": "^14.21.3 || >=16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@noble/secp256k1": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-2.3.0.tgz", - "integrity": "sha512-0TQed2gcBbIrh7Ccyw+y/uZQvbJwm7Ao4scBUxqpBCcsOlZG0O4KGfjtNAy/li4W8n1xt3dxrwJ0beZ2h2G6Kw==", - "license": "MIT", - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@nostr-dev-kit/ndk": { - "version": "2.18.1", - "resolved": "https://registry.npmjs.org/@nostr-dev-kit/ndk/-/ndk-2.18.1.tgz", - "integrity": "sha512-LTXXheGfmyN1y8x+8v/Dmkx8YX7LqaoVk0DTSaigETB5RZsxw7dLBKK++kZd4DVIxtj0tRfmSOsTr1E+M4653Q==", - "license": "MIT", - "dependencies": { - "@codesandbox/sandpack-client": "^2.19.8", - "@noble/curves": "^1.6.0", - "@noble/hashes": "^1.5.0", - "@noble/secp256k1": "^2.1.0", - "@scure/base": "^1.1.9", - "debug": "^4.3.7", - "light-bolt11-decoder": "^3.2.0", - "shiki": "^3.13.0", - "tseep": "^1.3.1", - "typescript-lru-cache": "^2.0.0" - }, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "nostr-tools": "^2.17.0" - } - }, - "node_modules/@open-draft/deferred-promise": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz", - "integrity": "sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==", - "license": "MIT" - }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.59.0", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", @@ -1105,21 +1014,11 @@ "win32" ] }, - "node_modules/@scure/base": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", - "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", - "license": "MIT", - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "node_modules/@scure/bip32": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-2.0.1.tgz", "integrity": "sha512-4Md1NI5BzoVP+bhyJaY3K6yMesEFzNS1sE/cP+9nuvE7p/b0kx9XbpDHHFl8dHtufcbdHRUUQdRqLIPHN/s7yA==", "license": "MIT", - "peer": true, "dependencies": { "@noble/curves": "2.0.1", "@noble/hashes": "2.0.1", @@ -1134,7 +1033,6 @@ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-2.0.1.tgz", "integrity": "sha512-vs1Az2OOTBiP4q0pwjW5aF0xp9n4MxVrmkFBxc6EKZc6ddYx5gaZiAsZoq0uRRXWbi3AT/sBqn05eRPtn1JCPw==", "license": "MIT", - "peer": true, "dependencies": { "@noble/hashes": "2.0.1" }, @@ -1150,7 +1048,6 @@ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.0.1.tgz", "integrity": "sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw==", "license": "MIT", - "peer": true, "engines": { "node": ">= 20.19.0" }, @@ -1163,7 +1060,6 @@ "resolved": "https://registry.npmjs.org/@scure/base/-/base-2.0.0.tgz", "integrity": "sha512-3E1kpuZginKkek01ovG8krQ0Z44E3DHPjc5S2rjJw9lZn3KSQOs8S7wqikF/AH7iRanHypj85uGyxk0XAyC37w==", "license": "MIT", - "peer": true, "funding": { "url": "https://paulmillr.com/funding/" } @@ -1173,7 +1069,6 @@ "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-2.0.1.tgz", "integrity": "sha512-PsxdFj/d2AcJcZDX1FXN3dDgitDDTmwf78rKZq1a6c1P1Nan1X/Sxc7667zU3U+AN60g7SxxP0YCVw2H/hBycg==", "license": "MIT", - "peer": true, "dependencies": { "@noble/hashes": "2.0.1", "@scure/base": "2.0.0" @@ -1187,7 +1082,6 @@ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.0.1.tgz", "integrity": "sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw==", "license": "MIT", - "peer": true, "engines": { "node": ">= 20.19.0" }, @@ -1200,78 +1094,10 @@ "resolved": "https://registry.npmjs.org/@scure/base/-/base-2.0.0.tgz", "integrity": "sha512-3E1kpuZginKkek01ovG8krQ0Z44E3DHPjc5S2rjJw9lZn3KSQOs8S7wqikF/AH7iRanHypj85uGyxk0XAyC37w==", "license": "MIT", - "peer": true, "funding": { "url": "https://paulmillr.com/funding/" } }, - "node_modules/@shikijs/core": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.23.0.tgz", - "integrity": "sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "3.23.0", - "@shikijs/vscode-textmate": "^10.0.2", - "@types/hast": "^3.0.4", - "hast-util-to-html": "^9.0.5" - } - }, - "node_modules/@shikijs/engine-javascript": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.23.0.tgz", - "integrity": "sha512-aHt9eiGFobmWR5uqJUViySI1bHMqrAgamWE1TYSUoftkAeCCAiGawPMwM+VCadylQtF4V3VNOZ5LmfItH5f3yA==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "3.23.0", - "@shikijs/vscode-textmate": "^10.0.2", - "oniguruma-to-es": "^4.3.4" - } - }, - "node_modules/@shikijs/engine-oniguruma": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.23.0.tgz", - "integrity": "sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "3.23.0", - "@shikijs/vscode-textmate": "^10.0.2" - } - }, - "node_modules/@shikijs/langs": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.23.0.tgz", - "integrity": "sha512-2Ep4W3Re5aB1/62RSYQInK9mM3HsLeB91cHqznAJMuylqjzNVAVCMnNWRHFtcNHXsoNRayP9z1qj4Sq3nMqYXg==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "3.23.0" - } - }, - "node_modules/@shikijs/themes": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.23.0.tgz", - "integrity": "sha512-5qySYa1ZgAT18HR/ypENL9cUSGOeI2x+4IvYJu4JgVJdizn6kG4ia5Q1jDEOi7gTbN4RbuYtmHh0W3eccOrjMA==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "3.23.0" - } - }, - "node_modules/@shikijs/types": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.23.0.tgz", - "integrity": "sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ==", - "license": "MIT", - "dependencies": { - "@shikijs/vscode-textmate": "^10.0.2", - "@types/hast": "^3.0.4" - } - }, - "node_modules/@shikijs/vscode-textmate": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", - "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", - "license": "MIT" - }, "node_modules/@types/chai": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", @@ -1304,15 +1130,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/hast": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", - "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", - "license": "MIT", - "dependencies": { - "@types/unist": "*" - } - }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -1320,15 +1137,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/mdast": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", - "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", - "license": "MIT", - "dependencies": { - "@types/unist": "*" - } - }, "node_modules/@types/node": { "version": "20.19.37", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", @@ -1367,12 +1175,6 @@ "@types/react": "^18.0.0" } }, - "node_modules/@types/unist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", - "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", - "license": "MIT" - }, "node_modules/@types/whatwg-mimetype": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/whatwg-mimetype/-/whatwg-mimetype-3.0.2.tgz", @@ -1623,12 +1425,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/@ungap/structured-clone": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", - "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", - "license": "ISC" - }, "node_modules/@vitest/expect": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.4.tgz", @@ -1836,26 +1632,6 @@ "node": "18 || 20 || >=22" } }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/brace-expansion": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", @@ -1869,30 +1645,6 @@ "node": "18 || 20 || >=22" } }, - "node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "node_modules/cac": { "version": "6.7.14", "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", @@ -1903,16 +1655,6 @@ "node": ">=8" } }, - "node_modules/ccount": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", - "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/chai": { "version": "5.3.3", "resolved": "https://registry.npmjs.org/chai/-/chai-5.3.3.tgz", @@ -1942,26 +1684,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/character-entities-html4": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", - "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/character-entities-legacy": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", - "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/check-error": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.3.tgz", @@ -1999,16 +1721,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/comma-separated-tokens": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", - "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/commander": { "version": "12.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", @@ -2044,6 +1756,7 @@ "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, "license": "MIT", "dependencies": { "ms": "^2.1.3" @@ -2074,40 +1787,6 @@ "dev": true, "license": "MIT" }, - "node_modules/dequal": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", - "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/devlop": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", - "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", - "license": "MIT", - "dependencies": { - "dequal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/dotenv": { - "version": "16.6.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", - "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://dotenvx.com" - } - }, "node_modules/emoji-regex": { "version": "10.6.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", @@ -2577,72 +2256,6 @@ "node": ">=20.0.0" } }, - "node_modules/hast-util-to-html": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.5.tgz", - "integrity": "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "ccount": "^2.0.0", - "comma-separated-tokens": "^2.0.0", - "hast-util-whitespace": "^3.0.0", - "html-void-elements": "^3.0.0", - "mdast-util-to-hast": "^13.0.0", - "property-information": "^7.0.0", - "space-separated-tokens": "^2.0.0", - "stringify-entities": "^4.0.0", - "zwitch": "^2.0.4" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-whitespace": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", - "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/html-void-elements": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", - "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "BSD-3-Clause" - }, "node_modules/ignore": { "version": "7.0.5", "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", @@ -2778,27 +2391,6 @@ "node": ">= 0.8.0" } }, - "node_modules/light-bolt11-decoder": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/light-bolt11-decoder/-/light-bolt11-decoder-3.2.0.tgz", - "integrity": "sha512-3QEofgiBOP4Ehs9BI+RkZdXZNtSys0nsJ6fyGeSiAGCBsMwHGUDS/JQlY/sTnWs91A2Nh0S9XXfA8Sy9g6QpuQ==", - "license": "MIT", - "dependencies": { - "@scure/base": "1.1.1" - } - }, - "node_modules/light-bolt11-decoder/node_modules/@scure/base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", - "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "license": "MIT" - }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -2886,125 +2478,6 @@ "@jridgewell/sourcemap-codec": "^1.5.5" } }, - "node_modules/mdast-util-to-hast": { - "version": "13.2.1", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", - "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "@ungap/structured-clone": "^1.0.0", - "devlop": "^1.0.0", - "micromark-util-sanitize-uri": "^2.0.0", - "trim-lines": "^3.0.0", - "unist-util-position": "^5.0.0", - "unist-util-visit": "^5.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-util-character": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", - "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-encode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", - "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT" - }, - "node_modules/micromark-util-sanitize-uri": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", - "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-character": "^2.0.0", - "micromark-util-encode": "^2.0.0", - "micromark-util-symbol": "^2.0.0" - } - }, - "node_modules/micromark-util-symbol": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", - "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT" - }, - "node_modules/micromark-util-types": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", - "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT" - }, - "node_modules/mime-db": { - "version": "1.54.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", - "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/mimic-function": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", @@ -3037,6 +2510,7 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, "license": "MIT" }, "node_modules/nanoid": { @@ -3070,7 +2544,6 @@ "resolved": "https://registry.npmjs.org/nostr-tools/-/nostr-tools-2.23.1.tgz", "integrity": "sha512-Q5SJ1omrseBFXtLwqDhufpFLA6vX3rS/IuBCc974qaYX6YKGwEPxa/ZsyxruUOr+b+5EpWL2hFmCB5AueYrfBw==", "license": "Unlicense", - "peer": true, "dependencies": { "@noble/ciphers": "2.1.1", "@noble/curves": "2.0.1", @@ -3094,7 +2567,6 @@ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-2.0.1.tgz", "integrity": "sha512-vs1Az2OOTBiP4q0pwjW5aF0xp9n4MxVrmkFBxc6EKZc6ddYx5gaZiAsZoq0uRRXWbi3AT/sBqn05eRPtn1JCPw==", "license": "MIT", - "peer": true, "dependencies": { "@noble/hashes": "2.0.1" }, @@ -3110,7 +2582,6 @@ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.0.1.tgz", "integrity": "sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw==", "license": "MIT", - "peer": true, "engines": { "node": ">= 20.19.0" }, @@ -3123,7 +2594,6 @@ "resolved": "https://registry.npmjs.org/@scure/base/-/base-2.0.0.tgz", "integrity": "sha512-3E1kpuZginKkek01ovG8krQ0Z44E3DHPjc5S2rjJw9lZn3KSQOs8S7wqikF/AH7iRanHypj85uGyxk0XAyC37w==", "license": "MIT", - "peer": true, "funding": { "url": "https://paulmillr.com/funding/" } @@ -3132,8 +2602,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/nostr-wasm/-/nostr-wasm-0.1.0.tgz", "integrity": "sha512-78BTryCLcLYv96ONU8Ws3Q1JzjlAt+43pWQhIl86xZmWeegYCNLPml7yQ+gG3vR6V5h4XGj+TxO+SS5dsThQIA==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/onetime": { "version": "7.0.0", @@ -3150,23 +2619,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/oniguruma-parser": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.1.tgz", - "integrity": "sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==", - "license": "MIT" - }, - "node_modules/oniguruma-to-es": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.4.tgz", - "integrity": "sha512-3VhUGN3w2eYxnTzHn+ikMI+fp/96KoRSVK9/kMTcFqj1NRDh2IhQCKvYxDnWePKRXY/AqH+Fuiyb7VHSzBjHfA==", - "license": "MIT", - "dependencies": { - "oniguruma-parser": "^0.12.1", - "regex": "^6.0.1", - "regex-recursion": "^6.0.2" - } - }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -3208,12 +2660,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/outvariant": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/outvariant/-/outvariant-1.4.0.tgz", - "integrity": "sha512-AlWY719RF02ujitly7Kk/0QlV+pXGFDHrHf9O2OKqyqgBieaPOIeuSkL8sRK6j2WK+/ZAURq2kZsY0d8JapUiw==", - "license": "MIT" - }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -3358,16 +2804,6 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/property-information": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", - "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -3411,30 +2847,6 @@ "react": "^18.3.1" } }, - "node_modules/regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/regex/-/regex-6.1.0.tgz", - "integrity": "sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==", - "license": "MIT", - "dependencies": { - "regex-utilities": "^2.3.0" - } - }, - "node_modules/regex-recursion": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-6.0.2.tgz", - "integrity": "sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==", - "license": "MIT", - "dependencies": { - "regex-utilities": "^2.3.0" - } - }, - "node_modules/regex-utilities": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz", - "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==", - "license": "MIT" - }, "node_modules/resolve-pkg-maps": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", @@ -3552,22 +2964,6 @@ "node": ">=8" } }, - "node_modules/shiki": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-3.23.0.tgz", - "integrity": "sha512-55Dj73uq9ZXL5zyeRPzHQsK7Nbyt6Y10k5s7OjuFZGMhpp4r/rsLBH0o/0fstIzX1Lep9VxefWljK/SKCzygIA==", - "license": "MIT", - "dependencies": { - "@shikijs/core": "3.23.0", - "@shikijs/engine-javascript": "3.23.0", - "@shikijs/engine-oniguruma": "3.23.0", - "@shikijs/langs": "3.23.0", - "@shikijs/themes": "3.23.0", - "@shikijs/types": "3.23.0", - "@shikijs/vscode-textmate": "^10.0.2", - "@types/hast": "^3.0.4" - } - }, "node_modules/siginfo": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", @@ -3597,16 +2993,6 @@ "node": ">=0.10.0" } }, - "node_modules/space-separated-tokens": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", - "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/stackback": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", @@ -3614,18 +3000,6 @@ "dev": true, "license": "MIT" }, - "node_modules/static-browser-server": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/static-browser-server/-/static-browser-server-1.0.3.tgz", - "integrity": "sha512-ZUyfgGDdFRbZGGJQ1YhiM930Yczz5VlbJObrQLlk24+qNHVQx4OlLcYswEUo3bIyNAbQUIUR9Yr5/Hqjzqb4zA==", - "license": "Apache-2.0", - "dependencies": { - "@open-draft/deferred-promise": "^2.1.0", - "dotenv": "^16.0.3", - "mime-db": "^1.52.0", - "outvariant": "^1.3.0" - } - }, "node_modules/std-env": { "version": "3.10.0", "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz", @@ -3645,12 +3019,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/strict-event-emitter": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.4.6.tgz", - "integrity": "sha512-12KWeb+wixJohmnwNFerbyiBrAlq5qJLwIt38etRtKtmmHyDSoGlIqFE9wx+4IwG0aDjI7GV8tc8ZccjWZZtTg==", - "license": "MIT" - }, "node_modules/string-width": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", @@ -3668,20 +3036,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/stringify-entities": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", - "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", - "license": "MIT", - "dependencies": { - "character-entities-html4": "^2.0.0", - "character-entities-legacy": "^3.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/strip-ansi": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", @@ -3771,16 +3125,6 @@ "node": ">=14.0.0" } }, - "node_modules/trim-lines": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", - "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/ts-api-utils": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.4.0.tgz", @@ -3794,12 +3138,6 @@ "typescript": ">=4.8.4" } }, - "node_modules/tseep": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/tseep/-/tseep-1.3.1.tgz", - "integrity": "sha512-ZPtfk1tQnZVyr7BPtbJ93qaAh2lZuIOpTMjhrYa4XctT8xe7t4SAW9LIxrySDuYMsfNNayE51E/WNGrNVgVicQ==", - "license": "MIT" - }, "node_modules/tsx": { "version": "4.21.0", "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", @@ -3871,12 +3209,6 @@ "typescript": ">=4.8.4 <6.0.0" } }, - "node_modules/typescript-lru-cache": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/typescript-lru-cache/-/typescript-lru-cache-2.0.0.tgz", - "integrity": "sha512-Jp57Qyy8wXeMkdNuZiglE6v2Cypg13eDA1chHwDG6kq51X7gk4K7P7HaDdzZKCxkegXkVHNcPD0n5aW6OZH3aA==", - "license": "MIT" - }, "node_modules/undici-types": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", @@ -3884,74 +3216,6 @@ "dev": true, "license": "MIT" }, - "node_modules/unist-util-is": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz", - "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-position": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", - "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-stringify-position": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", - "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-visit": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.1.0.tgz", - "integrity": "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-is": "^6.0.0", - "unist-util-visit-parents": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-visit-parents": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz", - "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-is": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -3962,34 +3226,6 @@ "punycode": "^2.1.0" } }, - "node_modules/vfile": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", - "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-message": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz", - "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-stringify-position": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/vite": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz", @@ -4248,26 +3484,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/zwitch": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", - "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "packages/core": { "name": "@wizardconnect/core", "version": "0.1.2", "dependencies": { "@bch-wc2/interfaces": "^0.0.8", "@bitauth/libauth": "^3.1.0-next.2", - "@nostr-dev-kit/ndk": "^2.18.1", "eventemitter3": "^5.0.1", "isomorphic-ws": "^5.0.0", "lossless-json": "^4.3.0", + "nostr-tools": "^2.23.0", "ws": "^8.18.0" }, "devDependencies": { diff --git a/packages/core/package.json b/packages/core/package.json index b7591c9..f608080 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -35,7 +35,7 @@ }, "dependencies": { "@bch-wc2/interfaces": "^0.0.8", - "@nostr-dev-kit/ndk": "^2.18.1", + "nostr-tools": "^2.23.0", "@bitauth/libauth": "^3.1.0-next.2", "eventemitter3": "^5.0.1", "isomorphic-ws": "^5.0.0", diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 25c2584..407532c 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -4,6 +4,7 @@ export { RelayClient } from "./relay-client.js"; export type { RelayClientConfig } from "./relay-client.js"; +export { SimplePool } from "nostr-tools/pool"; export { RelayStatus, initiateRelay } from "./relay-handler.js"; export type { RelayUpdatePayload, diff --git a/packages/core/src/relay-client.ts b/packages/core/src/relay-client.ts index c0c43e9..b2e604a 100644 --- a/packages/core/src/relay-client.ts +++ b/packages/core/src/relay-client.ts @@ -3,15 +3,14 @@ // A copy of the license can be found in the LICENSE file or at https://www.gnu.org/licenses/lgpl-3.0.html import { throwUnless, unwrap } from "./primitives.js"; -import NDK, { - NDKPrivateKeySigner, - NDKUser, - NDKEvent, - NDKKind, - giftWrap, - giftUnwrap, - NDKSubscription, -} from "@nostr-dev-kit/ndk"; +import { + SimplePool, + useWebSocketImplementation, + type SubCloser, +} from "nostr-tools/pool"; +import { wrapEvent, unwrapEvent } from "nostr-tools/nip59"; +import type { NostrEvent } from "nostr-tools/core"; +import WebSocket from "isomorphic-ws"; import { binToHex, hash256, secp256k1 } from "@bitauth/libauth"; import { EventEmitter } from "eventemitter3"; import { @@ -23,6 +22,11 @@ import { deriveNostrPublicKey } from "./utilnostr.js"; import { MessageQueue } from "./message-queue.js"; import { debug, error as logError, Scope } from "./log.js"; +useWebSocketImplementation(WebSocket); + +const KIND_GIFT_WRAP = 1059; +const KIND_PRIVATE_DIRECT_MESSAGE = 14; + export interface RelayClientConfig { explicitRelayUrls: string[]; signerPrivateKey: Uint8Array; @@ -31,14 +35,16 @@ export interface RelayClientConfig { } export class RelayClient extends EventEmitter { - private ndk: NDK; - private paired: NDKUser; + private pool: SimplePool; + private sharedPool: boolean; + private pairedPubkeyHex: string; private config: RelayClientConfig; - private messageSubscription: NDKSubscription | null = null; + private subscription: SubCloser | null = null; private myPubkey: Uint8Array; private myPubkeyHex: string; private lastProcessedTimestamp: number = 0; private messageQueue: MessageQueue; + private readyTimeoutId: ReturnType | null = null; private sequence: number = Math.floor( Math.random() * (Number.MAX_SAFE_INTEGER - 500_000), @@ -60,18 +66,14 @@ export class RelayClient extends EventEmitter { } >(); - constructor(config: RelayClientConfig) { + constructor(config: RelayClientConfig, pool?: SimplePool) { super(); this.config = { logNetworkActivity: true, ...config, }; - this.ndk = new NDK({ - explicitRelayUrls: this.config.explicitRelayUrls, - signer: new NDKPrivateKeySigner(this.config.signerPrivateKey), - enableOutboxModel: false, - autoConnectUserRelays: false, - }); + this.pool = pool ?? new SimplePool(); + this.sharedPool = pool !== undefined; this.messageQueue = new MessageQueue({ logActivity: this.config.logNetworkActivity, @@ -87,9 +89,9 @@ export class RelayClient extends EventEmitter { this.config.pairedPublicKey.length === 33 ? this.config.pairedPublicKey.slice(1) : this.config.pairedPublicKey; - this.paired = new NDKUser({ pubkey: binToHex(pairedNostrPubkey) }); + this.pairedPubkeyHex = binToHex(pairedNostrPubkey); } else { - this.paired = new NDKUser({ pubkey: "" }); + this.pairedPubkeyHex = ""; } } @@ -99,7 +101,7 @@ export class RelayClient extends EventEmitter { pairedPublicKey.length === 33 ? pairedPublicKey.slice(1) : pairedPublicKey; - this.paired = new NDKUser({ pubkey: binToHex(pairedNostrPubkey) }); + this.pairedPubkeyHex = binToHex(pairedNostrPubkey); this.emit("paired"); } @@ -128,119 +130,49 @@ export class RelayClient extends EventEmitter { } try { - await this.ndk.connect(); - - if (this.config.logNetworkActivity) { - debug(Scope.Relay, `NDK connect() resolved`); - } - - this.messageSubscription = this.ndk.subscribe( + this.subscription = this.pool.subscribeMany( + this.config.explicitRelayUrls, + { kinds: [KIND_GIFT_WRAP], "#p": [this.myPubkeyHex] }, { - kinds: [NDKKind.GiftWrap], - "#p": [this.myPubkeyHex], + onevent: (event: NostrEvent) => this.handleWrappedEvent(event), + oneose: () => { + if (this.readyTimeoutId) { + clearTimeout(this.readyTimeoutId); + this.readyTimeoutId = null; + } + if (this.config.logNetworkActivity) { + debug(Scope.Relay, `EOSE received, relay connected`); + } + this.messageQueue.setReady((msg) => this.publishMessage(msg)); + this.emit("connection"); + }, + onclose: (reasons: string[]) => { + if (this.config.logNetworkActivity) { + debug(Scope.Relay, `Subscription closed: ${reasons.join(", ")}`); + } + this.emit("disconnect", new Error("Subscription closed")); + }, }, - { closeOnEose: false }, ); - this.messageSubscription.on("event", async (wrappedEvent: NDKEvent) => { - try { - const signer = this.ndk.signer; - if (!signer) { - throw new Error("No signer available"); - } - - const rumor = await giftUnwrap(wrappedEvent, undefined, signer); - - if (rumor.kind === NDKKind.PrivateDirectMessage) { - let payload: ProtocolMessage; - try { - payload = JSON.parse(rumor.content); - } catch (e) { - if (this.config.logNetworkActivity) { - logError( - Scope.Relay, - "Failed to parse message content as JSON:", - e, - ); - } - return; - } - - if ( - !payload.time || - (this.lastProcessedTimestamp > 0 && - payload.time < this.lastProcessedTimestamp) - ) { - if (this.config.logNetworkActivity) { - debug( - Scope.Relay, - `Ignoring already-processed message (time: ${payload.time}, action: ${payload.action}, last processed: ${this.lastProcessedTimestamp})`, - ); - } - return; - } - - // wallet_ready carries the key exchange data (public_key + secret) so it - // must bypass the peer filter — the dapp doesn't know the wallet's pubkey yet. - const isKeyExchangeMessage = - payload.action === RelayMsgAction.WalletReady; - - if (!isKeyExchangeMessage && this.config.pairedPublicKey) { - const pairedNostrPubkey = - this.config.pairedPublicKey.length === 33 - ? binToHex(this.config.pairedPublicKey.slice(1)) - : binToHex(this.config.pairedPublicKey); - if (rumor.pubkey !== pairedNostrPubkey) { - if (this.config.logNetworkActivity) { - debug( - Scope.Relay, - `Ignoring '${payload.action}' message from unknown peer: ${rumor.pubkey} (expected: ${pairedNostrPubkey})`, - ); - } - return; - } - } - - if (this.config.logNetworkActivity) { - debug( - Scope.Relay, - `Received message ${payload.action} from relay`, - ); - } - this.handleRelayMessage(payload); - } else { - if (this.config.logNetworkActivity) { - debug( - Scope.Relay, - `Ignoring non-PrivateDirectMessage, kind: ${rumor.kind}`, - ); - } - } - } catch (error) { + // Fallback: if EOSE doesn't arrive within 5 seconds, assume ready + this.readyTimeoutId = setTimeout(() => { + if (!this.messageQueue.getReady()) { if (this.config.logNetworkActivity) { - logError(Scope.Relay, "Error handling incoming message:", error); + debug(Scope.Relay, `EOSE timeout, assuming ready`); } - this.emitError(error as Error); + this.messageQueue.setReady((msg) => this.publishMessage(msg)); + this.emit("connection"); } - }); - - this.messageSubscription.on("close", () => { - if (this.config.logNetworkActivity) { - debug(Scope.Relay, "Subscription closed, connection may be stale"); - } - this.emit("disconnect", new Error("Subscription closed")); - }); - - this.waitForRelaysReady(); + this.readyTimeoutId = null; + }, 5000); if (this.config.logNetworkActivity) { debug( Scope.Relay, - `Subscription created and handler set up, emitting connection event`, + `Subscription created, waiting for relay connection`, ); } - - this.emit("connection"); } catch (error) { if (this.config.logNetworkActivity) { logError(Scope.Relay, `Connection failed:`, error); @@ -253,9 +185,18 @@ export class RelayClient extends EventEmitter { this.lastProcessedTimestamp = Math.floor(Date.now() / 1000); this.messageQueue.setNotReady(); - if (this.messageSubscription) { - this.messageSubscription.stop(); - this.messageSubscription = null; + if (this.readyTimeoutId) { + clearTimeout(this.readyTimeoutId); + this.readyTimeoutId = null; + } + + if (this.subscription) { + this.subscription.close(); + this.subscription = null; + } + + if (!this.sharedPool) { + this.pool.close(this.config.explicitRelayUrls); } } @@ -284,21 +225,21 @@ export class RelayClient extends EventEmitter { private async publishMessage(message: ProtocolMessage): Promise { this.netlog("send", message.action); - const signer = this.ndk.signer; - if (!signer) { - throw new Error("No signer available"); - } - - const rumor = new NDKEvent(this.ndk); - rumor.kind = NDKKind.PrivateDirectMessage; - rumor.content = JSON.stringify(message); - rumor.created_at = Math.floor(Date.now() / 1000); - rumor.tags = [["p", this.paired.pubkey]]; - - const wrappedEvent = await giftWrap(rumor, this.paired, signer); + const wrapped = wrapEvent( + { + kind: KIND_PRIVATE_DIRECT_MESSAGE, + content: JSON.stringify(message), + created_at: Math.floor(Date.now() / 1000), + tags: [["p", this.pairedPubkeyHex]], + }, + this.config.signerPrivateKey, + this.pairedPubkeyHex, + ); try { - await wrappedEvent.publish(); + await Promise.any( + this.pool.publish(this.config.explicitRelayUrls, wrapped), + ); if (this.config.logNetworkActivity) { debug(Scope.Relay, `Published message ${message.action} to relay`); } @@ -314,46 +255,78 @@ export class RelayClient extends EventEmitter { } } - private async waitForRelaysReady(): Promise { - const maxWaitTime = 5000; - const checkInterval = 100; - const startTime = Date.now(); + private handleWrappedEvent(wrappedEvent: NostrEvent): void { + try { + const rumor = unwrapEvent(wrappedEvent, this.config.signerPrivateKey); - const checkRelays = async (): Promise => { - const pool = (this.ndk as any).pool; - if (pool) { - const relays = pool.relays || []; - // NDKRelayStatus: DISCONNECTED=1, CONNECTED=5, AUTHENTICATED=8 - const connectedRelays = Array.from(relays.values()).filter( - (relay: any) => relay.status >= 5, - ); + if (rumor.kind === KIND_PRIVATE_DIRECT_MESSAGE) { + let payload: ProtocolMessage; + try { + payload = JSON.parse(rumor.content); + } catch (e) { + if (this.config.logNetworkActivity) { + logError( + Scope.Relay, + "Failed to parse message content as JSON:", + e, + ); + } + return; + } - if (connectedRelays.length > 0) { + if ( + !payload.time || + (this.lastProcessedTimestamp > 0 && + payload.time < this.lastProcessedTimestamp) + ) { if (this.config.logNetworkActivity) { debug( Scope.Relay, - `Relays ready (${connectedRelays.length} connected), processing queued messages`, + `Ignoring already-processed message (time: ${payload.time}, action: ${payload.action}, last processed: ${this.lastProcessedTimestamp})`, ); } - await this.messageQueue.setReady((msg) => this.publishMessage(msg)); return; } - } - if (Date.now() - startTime < maxWaitTime) { - setTimeout(checkRelays, checkInterval); + // wallet_ready carries the key exchange data (public_key + secret) so it + // must bypass the peer filter — the dapp doesn't know the wallet's pubkey yet. + const isKeyExchangeMessage = + payload.action === RelayMsgAction.WalletReady; + + if (!isKeyExchangeMessage && this.config.pairedPublicKey) { + const pairedNostrPubkey = + this.config.pairedPublicKey.length === 33 + ? binToHex(this.config.pairedPublicKey.slice(1)) + : binToHex(this.config.pairedPublicKey); + if (rumor.pubkey !== pairedNostrPubkey) { + if (this.config.logNetworkActivity) { + debug( + Scope.Relay, + `Ignoring '${payload.action}' message from unknown peer: ${rumor.pubkey} (expected: ${pairedNostrPubkey})`, + ); + } + return; + } + } + + if (this.config.logNetworkActivity) { + debug(Scope.Relay, `Received message ${payload.action} from relay`); + } + this.handleRelayMessage(payload); } else { if (this.config.logNetworkActivity) { debug( Scope.Relay, - "Relay ready check timeout, assuming ready and processing queued messages", + `Ignoring non-PrivateDirectMessage, kind: ${rumor.kind}`, ); } - await this.messageQueue.setReady((msg) => this.publishMessage(msg)); } - }; - - setTimeout(checkRelays, 200); + } catch (error) { + if (this.config.logNetworkActivity) { + logError(Scope.Relay, "Error handling incoming message:", error); + } + this.emitError(error as Error); + } } isConnected(): boolean {