Skip to content

Commit 670cb5e

Browse files
vveerrggclaude
andcommitted
feat: migrate from nostr-tools to nostr-crypto-utils@0.5.0
Replace nostr-tools dependency with nostr-crypto-utils for all Nostr cryptographic operations (NIP-04, NIP-44, NIP-49, NIP-19, key generation, event signing). Add esbuild plugin to stub Node.js built-in modules. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent de65292 commit 670cb5e

7 files changed

Lines changed: 202 additions & 142 deletions

File tree

build.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,25 @@ const chromeEntryPoints = {
3434

3535
const shared = {
3636
bundle: true,
37+
plugins: [{
38+
name: 'node-module-stubs',
39+
setup(build) {
40+
// Stub out Node.js built-in modules that crypto-browserify tries to import.
41+
// The extension runs in a browser context where window.crypto is always
42+
// available, so the crypto-browserify fallback path is never reached.
43+
const stubs = ['stream', 'crypto'];
44+
for (const mod of stubs) {
45+
build.onResolve({ filter: new RegExp(`^${mod}$`) }, () => ({
46+
path: mod,
47+
namespace: 'node-stub',
48+
}));
49+
}
50+
build.onLoad({ filter: /.*/, namespace: 'node-stub' }, () => ({
51+
contents: 'module.exports = {};',
52+
loader: 'js',
53+
}));
54+
},
55+
}],
3756
};
3857

3958
// Static assets shared by both Safari and Chrome builds

package-lock.json

Lines changed: 44 additions & 72 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nostrkey",
3-
"version": "1.2.2",
3+
"version": "1.4.0",
44
"description": "Nostr key manager and signer for web apps. Securely store your private keys and sign events without exposing them to websites.",
55
"source": [
66
"background.js",
@@ -23,10 +23,11 @@
2323
"author": "Humanjava Enterprises Inc",
2424
"license": "ISC",
2525
"dependencies": {
26+
"@scure/bip39": "^2.0.1",
2627
"async-mutex": "^0.5.0",
2728
"idb": "^8.0.0",
2829
"json-format-highlight": "^1.0.4",
29-
"nostr-tools": "^2.23.1",
30+
"nostr-crypto-utils": "^0.5.0",
3031
"qrcode": "^1.5.4"
3132
},
3233
"devDependencies": {

0 commit comments

Comments
 (0)