From f08e1a47ea3817aa8b4275817548c9b6cd13db27 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Wed, 28 Jun 2023 14:36:51 +0800 Subject: [PATCH] Revert "Nostr dm notifications (#3051)" (#3325) This reverts commit b8bcb6f13acef9d56fd99485617e9f295ed49d0d. --- package-lock.json | 290 +------------------------ package.json | 4 +- server/notification-providers/nostr.js | 101 --------- server/notification.js | 2 - src/components/NotificationDialog.vue | 1 - src/components/notifications/Nostr.vue | 26 --- src/components/notifications/index.js | 2 - src/lang/en.json | 7 +- 8 files changed, 6 insertions(+), 427 deletions(-) delete mode 100644 server/notification-providers/nostr.js delete mode 100644 src/components/notifications/Nostr.vue diff --git a/package-lock.json b/package-lock.json index 1a03c80cb4f..f3bc2faec0a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,7 +49,6 @@ "node-cloudflared-tunnel": "~1.0.9", "node-radius-client": "~1.0.0", "nodemailer": "~6.6.5", - "nostr-tools": "^1.8.1", "notp": "~2.0.3", "password-hash": "~1.2.2", "pg": "~8.8.0", @@ -66,8 +65,7 @@ "socks-proxy-agent": "6.1.1", "tar": "~6.1.11", "tcp-ping": "~0.1.1", - "thirty-two": "~1.0.2", - "websocket-polyfill": "^0.0.3" + "thirty-two": "~1.0.2" }, "devDependencies": { "@actions/github": "~5.0.1", @@ -4578,47 +4576,6 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, - "node_modules/@noble/curves": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-0.8.3.tgz", - "integrity": "sha512-OqaOf4RWDaCRuBKJLDURrgVxjLmneGsiCXGuzYB5y95YithZMA6w4uk34DHSm0rKMrrYiaeZj48/81EvaAScLQ==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "@noble/hashes": "1.3.0" - } - }, - "node_modules/@noble/curves/node_modules/@noble/hashes": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz", - "integrity": "sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@noble/hashes": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.0.0.tgz", - "integrity": "sha512-DZVbtY62kc3kkBtMHqwCOfXrT/hnoORy5BJ4+HU1IR59X0KWAOqsfzQPcUl/lQLlG7qXbe/fZ3r/emxtAl+sqg==" - }, - "node_modules/@noble/secp256k1": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", - "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -4953,70 +4910,6 @@ "@redis/client": "^1.0.0" } }, - "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/" - } - ] - }, - "node_modules/@scure/bip32": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.2.0.tgz", - "integrity": "sha512-O+vT/hBVk+ag2i6j2CDemwd1E1MtGt+7O1KzrPNsaNvSsiEK55MyPIxJIMI2PS8Ijj464B2VbQlpRoQXxw1uHg==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "@noble/curves": "~0.8.3", - "@noble/hashes": "~1.3.0", - "@scure/base": "~1.1.0" - } - }, - "node_modules/@scure/bip32/node_modules/@noble/hashes": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz", - "integrity": "sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@scure/bip39": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.0.tgz", - "integrity": "sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "@noble/hashes": "~1.3.0", - "@scure/base": "~1.1.0" - } - }, - "node_modules/@scure/bip39/node_modules/@noble/hashes": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz", - "integrity": "sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, "node_modules/@sideway/address": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", @@ -6696,18 +6589,6 @@ "node": ">=4" } }, - "node_modules/bufferutil": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", - "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", - "hasInstallScript": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/buildcheck": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/buildcheck/-/buildcheck-0.0.6.tgz", @@ -7949,15 +7830,6 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "node_modules/d": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", - "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", - "dependencies": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" - } - }, "node_modules/dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -8685,39 +8557,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es5-ext": { - "version": "0.10.62", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", - "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", - "hasInstallScript": true, - "dependencies": { - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.3", - "next-tick": "^1.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", - "dependencies": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, - "node_modules/es6-symbol": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", - "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", - "dependencies": { - "d": "^1.0.1", - "ext": "^1.1.2" - } - }, "node_modules/esbuild": { "version": "0.15.18", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.18.tgz", @@ -9772,19 +9611,6 @@ } ] }, - "node_modules/ext": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", - "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", - "dependencies": { - "type": "^2.7.2" - } - }, - "node_modules/ext/node_modules/type": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", - "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==" - }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -11446,7 +11272,8 @@ "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", + "dev": true }, "node_modules/is-unicode-supported": { "version": "0.1.0", @@ -14916,11 +14743,6 @@ "node": ">= 0.6" } }, - "node_modules/next-tick": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", - "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" - }, "node_modules/node-abort-controller": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.1.1.tgz", @@ -15001,16 +14823,6 @@ "node": ">= 10.12.0" } }, - "node_modules/node-gyp-build": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", - "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, "node_modules/node-gyp/node_modules/are-we-there-yet": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", @@ -15225,19 +15037,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/nostr-tools": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/nostr-tools/-/nostr-tools-1.8.1.tgz", - "integrity": "sha512-/2IUe5xINUYT5hYBoEz51dfRaodbRHnyF8n+ZbKWCoh0ZRX6AL88OoDNrWaWWo7tP5j5OyzSL9g/z4TP7bshEA==", - "dependencies": { - "@noble/hashes": "1.0.0", - "@noble/secp256k1": "^1.7.1", - "@scure/base": "^1.1.1", - "@scure/bip32": "^1.1.5", - "@scure/bip39": "^1.1.1", - "prettier": "^2.8.4" - } - }, "node_modules/notp": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/notp/-/notp-2.0.3.tgz", @@ -15975,20 +15774,6 @@ "node": ">= 0.8.0" } }, - "node_modules/prettier": { - "version": "2.8.7", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz", - "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==", - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, "node_modules/pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", @@ -18484,11 +18269,6 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==" }, - "node_modules/tstl": { - "version": "2.5.13", - "resolved": "https://registry.npmjs.org/tstl/-/tstl-2.5.13.tgz", - "integrity": "sha512-h9wayHHFI5+yqt8iau0vqH96cTNhezhZ/Fk/hrIdpfkiMu3lg9nzyvMfs5bIdX51IVzZO6DudLqhkL/rVXpT6g==" - }, "node_modules/tunnel": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", @@ -18516,11 +18296,6 @@ "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", "dev": true }, - "node_modules/type": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", - "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -18588,6 +18363,7 @@ "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, "dependencies": { "is-typedarray": "^1.0.0" } @@ -18758,18 +18534,6 @@ "requires-port": "^1.0.0" } }, - "node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "hasInstallScript": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -19368,44 +19132,6 @@ "node": ">=10.4" } }, - "node_modules/websocket": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz", - "integrity": "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==", - "dependencies": { - "bufferutil": "^4.0.1", - "debug": "^2.2.0", - "es5-ext": "^0.10.50", - "typedarray-to-buffer": "^3.1.5", - "utf-8-validate": "^5.0.2", - "yaeti": "^0.0.6" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/websocket-polyfill": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/websocket-polyfill/-/websocket-polyfill-0.0.3.tgz", - "integrity": "sha512-pF3kR8Uaoau78MpUmFfzbIRxXj9PeQrCuPepGE6JIsfsJ/o/iXr07Q2iQNzKSSblQJ0FiGWlS64N4pVSm+O3Dg==", - "dependencies": { - "tstl": "^2.0.7", - "websocket": "^1.0.28" - } - }, - "node_modules/websocket/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/websocket/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, "node_modules/whatwg-encoding": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", @@ -19713,14 +19439,6 @@ "node": ">=10" } }, - "node_modules/yaeti": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", - "integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==", - "engines": { - "node": ">=0.10.32" - } - }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", diff --git a/package.json b/package.json index 03c65f58958..1ca874aff32 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,6 @@ "node-cloudflared-tunnel": "~1.0.9", "node-radius-client": "~1.0.0", "nodemailer": "~6.6.5", - "nostr-tools": "^1.8.1", "notp": "~2.0.3", "password-hash": "~1.2.2", "pg": "~8.8.0", @@ -125,8 +124,7 @@ "socks-proxy-agent": "6.1.1", "tar": "~6.1.11", "tcp-ping": "~0.1.1", - "thirty-two": "~1.0.2", - "websocket-polyfill": "^0.0.3" + "thirty-two": "~1.0.2" }, "devDependencies": { "@actions/github": "~5.0.1", diff --git a/server/notification-providers/nostr.js b/server/notification-providers/nostr.js deleted file mode 100644 index 1377edd513f..00000000000 --- a/server/notification-providers/nostr.js +++ /dev/null @@ -1,101 +0,0 @@ -const NotificationProvider = require("./notification-provider"); -// polyfill for node <= 18 -global.crypto = require("crypto"); -const { - relayInit, - getPublicKey, - getEventHash, - signEvent, - nip04, - nip19 -} = require("nostr-tools"); -// polyfill for node <= 18 -require("websocket-polyfill"); - -class Nostr extends NotificationProvider { - name = "nostr"; - - async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - // All DMs should have same timestamp - const createdAt = Math.floor(Date.now() / 1000); - - const senderPrivateKey = await this.getPrivateKey(notification.sender); - const senderPublicKey = getPublicKey(senderPrivateKey); - const recipientsPublicKeys = await this.getPublicKeys(notification.recipients); - - // Create NIP-04 encrypted direct message event for each recipient - const events = []; - for (const recipientPublicKey of recipientsPublicKeys) { - const ciphertext = await nip04.encrypt(senderPrivateKey, recipientPublicKey, msg); - let event = { - kind: 4, - pubkey: senderPublicKey, - created_at: createdAt, - tags: [[ "p", recipientPublicKey ]], - content: ciphertext, - }; - event.id = getEventHash(event); - event.sig = signEvent(event, senderPrivateKey); - events.push(event); - } - - // Publish events to each relay - const relays = notification.relays.split("\n"); - let successfulRelays = 0; - - // Connect to each relay - for (const relayUrl of relays) { - const relay = relayInit(relayUrl); - try { - await relay.connect(); - successfulRelays++; - - // Publish events - for (const event of events) { - relay.publish(event); - } - } catch (error) { - continue; - } finally { - relay.close(); - } - } - - // Report success or failure - if (successfulRelays === 0) { - throw Error("Failed to connect to any relays."); - } - return `${successfulRelays}/${relays.length} relays connected.`; - } - - async getPrivateKey(sender) { - try { - const senderDecodeResult = await nip19.decode(sender); - const { data } = senderDecodeResult; - return data; - } catch (error) { - throw new Error(`Failed to get private key: ${error.message}`); - } - } - - async getPublicKeys(recipients) { - const recipientsList = recipients.split("\n"); - const publicKeys = []; - for (const recipient of recipientsList) { - try { - const recipientDecodeResult = await nip19.decode(recipient); - const { type, data } = recipientDecodeResult; - if (type === "npub") { - publicKeys.push(data); - } else { - throw new Error("not an npub"); - } - } catch (error) { - throw new Error(`Error decoding recipient: ${error}`); - } - } - return publicKeys; - } -} - -module.exports = Nostr; diff --git a/server/notification.js b/server/notification.js index 5c33fc43513..9bfa371d957 100644 --- a/server/notification.js +++ b/server/notification.js @@ -20,7 +20,6 @@ const LineNotify = require("./notification-providers/linenotify"); const LunaSea = require("./notification-providers/lunasea"); const Matrix = require("./notification-providers/matrix"); const Mattermost = require("./notification-providers/mattermost"); -const Nostr = require("./notification-providers/nostr"); const Ntfy = require("./notification-providers/ntfy"); const Octopush = require("./notification-providers/octopush"); const OneBot = require("./notification-providers/onebot"); @@ -83,7 +82,6 @@ class Notification { new LunaSea(), new Matrix(), new Mattermost(), - new Nostr(), new Ntfy(), new Octopush(), new OneBot(), diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 538975f3498..856d6f5373e 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -126,7 +126,6 @@ export default { "lunasea": "LunaSea", "matrix": "Matrix", "mattermost": "Mattermost", - "nostr": "Nostr", "ntfy": "Ntfy", "octopush": "Octopush", "OneBot": "OneBot", diff --git a/src/components/notifications/Nostr.vue b/src/components/notifications/Nostr.vue deleted file mode 100644 index 83f84b080d1..00000000000 --- a/src/components/notifications/Nostr.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index 103097190b6..7b5e6b6c716 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -18,7 +18,6 @@ import LineNotify from "./LineNotify.vue"; import LunaSea from "./LunaSea.vue"; import Matrix from "./Matrix.vue"; import Mattermost from "./Mattermost.vue"; -import Nostr from "./Nostr.vue"; import Ntfy from "./Ntfy.vue"; import Octopush from "./Octopush.vue"; import OneBot from "./OneBot.vue"; @@ -76,7 +75,6 @@ const NotificationFormList = { "lunasea": LunaSea, "matrix": Matrix, "mattermost": Mattermost, - "nostr": Nostr, "ntfy": Ntfy, "octopush": Octopush, "OneBot": OneBot, diff --git a/src/lang/en.json b/src/lang/en.json index aa5e4434b94..39d02a3e12c 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -755,10 +755,5 @@ "Group": "Group", "Monitor Group": "Monitor Group", "noGroupMonitorMsg": "Not Available. Create a Group Monitor First.", - "Close": "Close", - "nostrRelays": "Nostr relays", - "nostrRelaysHelp": "One relay URL per line", - "nostrSender": "Sender Private Key (nsec)", - "nostrRecipients": "Recipients Public Keys (npub)", - "nostrRecipientsHelp": "npub format, one per line" + "Close": "Close" }