commit 8f6e410dbc13a8cc089ff5d9c9af00cc2e4f553f
Author: William Casarin <jb55@jb55.com>
Date: Fri, 18 Nov 2022 08:59:37 -0800
initial commit
Diffstat:
5 files changed, 462 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/README.md b/README.md
@@ -0,0 +1,14 @@
+
+# nostr-delegate-signer
+
+Sign nostr delegate tokens offline
+
+## Install
+
+ $ npm -g install nostr-delegate-signer
+
+## Usage
+
+ $ nostr-delegate-signer <secret key> 'nostr:delegation:...'
+
+
diff --git a/index.js b/index.js
@@ -0,0 +1,17 @@
+
+const {signDelegationToken} = require('nostr')
+
+function usage() {
+ console.log("usage: nostr-delegation-signer <sec-key> <delegation_token>")
+ process.exit(0)
+}
+
+const args = process.argv.slice(2)
+if (args.length !== 2)
+ usage()
+
+const [privkey, token] = args
+
+signDelegationToken(privkey, token).then(sig => {
+ console.log(sig)
+});
diff --git a/package-lock.json b/package-lock.json
@@ -0,0 +1,410 @@
+{
+ "name": "nostr-delegation-signer",
+ "version": "0.1.0",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "nostr-delegation-signer",
+ "version": "0.1.0",
+ "dependencies": {
+ "minimist": "^1.2.7",
+ "nostr": "^0.2.3"
+ },
+ "devDependencies": {
+ "tap": "~0.2.5"
+ }
+ },
+ "node_modules/abbrev": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
+ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
+ "dev": true
+ },
+ "node_modules/buffer-equal": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.2.tgz",
+ "integrity": "sha512-4hr0gS7+NK47X6WbA/okVFrN5qGh3WLT7N3hMRv7+hlkXnbUIdU2u05n6r0RQv6cq6xke06nVl70r0NW0WM2OQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/bunker": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/bunker/-/bunker-0.1.2.tgz",
+ "integrity": "sha512-YnahkcXBNT522S46k5LUA9P18lzvgkunbMl0qIJQ8oeRMQ+dAg3YI3k32q5TnO+AAUErFHO6R768To6jslgYmQ==",
+ "dev": true,
+ "dependencies": {
+ "burrito": ">=0.2.5 <0.3"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/burrito": {
+ "version": "0.2.12",
+ "resolved": "https://registry.npmjs.org/burrito/-/burrito-0.2.12.tgz",
+ "integrity": "sha512-ZhhT5iVTAgzQ+s8rily7m45Swxe/cU3dVCHTzqmHVWD/cc0Ds3W4Q4MExbkevY+fm0Me3lEwpehIy6TH7p+ehw==",
+ "dev": true,
+ "dependencies": {
+ "traverse": "~0.5.1",
+ "uglify-js": "~1.1.1"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/burrito/node_modules/traverse": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.5.2.tgz",
+ "integrity": "sha512-PUBVcfB3RqgLpzgTRGNiqK4duqrDbgGa1bobbUtzUwLiBNAjZ7vd5eCOdBxqZ/Fgezagr9o69IxP2fZp41RGFA==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/charm": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/charm/-/charm-0.1.2.tgz",
+ "integrity": "sha512-syedaZ9cPe7r3hoQA9twWYKu5AIyCswN5+szkmPBe9ccdLrj4bYaCnLVPTLd2kgVRc7+zoX4tyPgRnFKCj5YjQ==",
+ "dev": true
+ },
+ "node_modules/deep-equal": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.0.0.tgz",
+ "integrity": "sha512-p1bI/kkDPT6auUI0U+WLuIIrzmDIDo80I406J8tT4y6I4ZGtBuMeTudrKDtBdMJFAcxqrQdx27gosqPVyY3IvQ==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/deep-is": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+ "dev": true
+ },
+ "node_modules/difflet": {
+ "version": "0.2.6",
+ "resolved": "https://registry.npmjs.org/difflet/-/difflet-0.2.6.tgz",
+ "integrity": "sha512-ruldDDRmY1t678UOAJBng6sL77f62SqjHj0498YC0EJhxIe2yKkqJn2qEchwG3eU/dqJ/RxPZkAnYjePS4pDCw==",
+ "dev": true,
+ "dependencies": {
+ "charm": "0.1.x",
+ "deep-is": "0.1.x",
+ "traverse": "0.6.x"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/minimist": {
+ "version": "1.2.7",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
+ "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/mkdirp": {
+ "version": "0.3.5",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz",
+ "integrity": "sha512-8OCq0De/h9ZxseqzCH8Kw/Filf5pF/vMI6+BH7Lu0jXz2pqYCjTAQRolSxRIi+Ax+oCCjlxoJMP0YQ4XlrQNHg==",
+ "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)",
+ "dev": true
+ },
+ "node_modules/noble-secp256k1": {
+ "version": "1.2.14",
+ "resolved": "https://registry.npmjs.org/noble-secp256k1/-/noble-secp256k1-1.2.14.tgz",
+ "integrity": "sha512-GSCXyoZBUaaPwVWdYncMEmzlSUjF9J/YeEHpklYJCyg8wPuJP3NzDx0BkiwArzINkdX2HJHvUJhL6vVWPOQQcg==",
+ "deprecated": "Switch to namespaced @noble/secp256k1 for security and feature updates"
+ },
+ "node_modules/nopt": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-2.2.1.tgz",
+ "integrity": "sha512-gIOTA/uJuhPwFqp+spY7VQ1satbnGlD+iQVZxI18K6hs8Evq4sX81Ml7BB5byP/LsbR2yBVtmvdEmhi7evJ6Aw==",
+ "dev": true,
+ "dependencies": {
+ "abbrev": "1"
+ },
+ "bin": {
+ "nopt": "bin/nopt.js"
+ }
+ },
+ "node_modules/nostr": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/nostr/-/nostr-0.2.3.tgz",
+ "integrity": "sha512-+gT8V+jBoVlHGRJEyn5fkBSIF41xkQVc53FaX+7sQ+XAwhlj0/eSKp4HfsZvb326xSIT4RuyaTEJn+nTR4itwA==",
+ "dependencies": {
+ "noble-secp256k1": "^1.2.14",
+ "ws": "^8.8.1"
+ }
+ },
+ "node_modules/runforcover": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/runforcover/-/runforcover-0.0.2.tgz",
+ "integrity": "sha512-yarCIK2HcAOadqnKW419+FA38qpWDCKcOr5RZU+jnyLL/hn3No9BHZY+YJDEzvQ0k8Oyl7ffLjZv9ZUxvyKoLQ==",
+ "dev": true,
+ "dependencies": {
+ "bunker": "0.1.X"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/slide": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz",
+ "integrity": "sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/tap": {
+ "version": "0.2.6",
+ "resolved": "https://registry.npmjs.org/tap/-/tap-0.2.6.tgz",
+ "integrity": "sha512-uLvaKbh3+A4nh+P3SrfX52kWGkVvP37UYI7LxKjRkd6Bjdqbyc7MARaPFGl7SdwyNwWtZHlUxQX3w9pVNf3FKQ==",
+ "bundleDependencies": [
+ "inherits",
+ "tap-consumer",
+ "yamlish"
+ ],
+ "dev": true,
+ "dependencies": {
+ "buffer-equal": "~0.0.0",
+ "deep-equal": "~0.0.0",
+ "difflet": "~0.2.0",
+ "inherits": "*",
+ "mkdirp": "~0.3",
+ "nopt": "~2",
+ "runforcover": "~0.0.2",
+ "slide": "*",
+ "yamlish": "*"
+ },
+ "bin": {
+ "tap": "bin/tap.js"
+ }
+ },
+ "node_modules/tap/node_modules/inherits": {
+ "version": "1.0.0",
+ "dev": true,
+ "inBundle": true,
+ "license": "WTFPL2"
+ },
+ "node_modules/tap/node_modules/yamlish": {
+ "version": "0.0.5",
+ "dev": true,
+ "inBundle": true,
+ "license": "MIT"
+ },
+ "node_modules/traverse": {
+ "version": "0.6.7",
+ "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.7.tgz",
+ "integrity": "sha512-/y956gpUo9ZNCb99YjxG7OaslxZWHfCHAUUfshwqOXmxUIvqLjVO581BT+gM59+QV9tFe6/CGG53tsA1Y7RSdg==",
+ "dev": true,
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/uglify-js": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-1.1.1.tgz",
+ "integrity": "sha512-YYY9Dle1leC+btgrHnAR05eq0aRdcPJsXlYYD+SYw2lqc5HFuFNHg3wWEW4SNE0iXXEUl0fz43gTQ3r1YK76rg==",
+ "dev": true,
+ "bin": {
+ "uglifyjs": "bin/uglifyjs"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/ws": {
+ "version": "8.11.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz",
+ "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": "^5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ }
+ },
+ "dependencies": {
+ "abbrev": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
+ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
+ "dev": true
+ },
+ "buffer-equal": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.2.tgz",
+ "integrity": "sha512-4hr0gS7+NK47X6WbA/okVFrN5qGh3WLT7N3hMRv7+hlkXnbUIdU2u05n6r0RQv6cq6xke06nVl70r0NW0WM2OQ==",
+ "dev": true
+ },
+ "bunker": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/bunker/-/bunker-0.1.2.tgz",
+ "integrity": "sha512-YnahkcXBNT522S46k5LUA9P18lzvgkunbMl0qIJQ8oeRMQ+dAg3YI3k32q5TnO+AAUErFHO6R768To6jslgYmQ==",
+ "dev": true,
+ "requires": {
+ "burrito": ">=0.2.5 <0.3"
+ }
+ },
+ "burrito": {
+ "version": "0.2.12",
+ "resolved": "https://registry.npmjs.org/burrito/-/burrito-0.2.12.tgz",
+ "integrity": "sha512-ZhhT5iVTAgzQ+s8rily7m45Swxe/cU3dVCHTzqmHVWD/cc0Ds3W4Q4MExbkevY+fm0Me3lEwpehIy6TH7p+ehw==",
+ "dev": true,
+ "requires": {
+ "traverse": "~0.5.1",
+ "uglify-js": "~1.1.1"
+ },
+ "dependencies": {
+ "traverse": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.5.2.tgz",
+ "integrity": "sha512-PUBVcfB3RqgLpzgTRGNiqK4duqrDbgGa1bobbUtzUwLiBNAjZ7vd5eCOdBxqZ/Fgezagr9o69IxP2fZp41RGFA==",
+ "dev": true
+ }
+ }
+ },
+ "charm": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/charm/-/charm-0.1.2.tgz",
+ "integrity": "sha512-syedaZ9cPe7r3hoQA9twWYKu5AIyCswN5+szkmPBe9ccdLrj4bYaCnLVPTLd2kgVRc7+zoX4tyPgRnFKCj5YjQ==",
+ "dev": true
+ },
+ "deep-equal": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.0.0.tgz",
+ "integrity": "sha512-p1bI/kkDPT6auUI0U+WLuIIrzmDIDo80I406J8tT4y6I4ZGtBuMeTudrKDtBdMJFAcxqrQdx27gosqPVyY3IvQ==",
+ "dev": true
+ },
+ "deep-is": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+ "dev": true
+ },
+ "difflet": {
+ "version": "0.2.6",
+ "resolved": "https://registry.npmjs.org/difflet/-/difflet-0.2.6.tgz",
+ "integrity": "sha512-ruldDDRmY1t678UOAJBng6sL77f62SqjHj0498YC0EJhxIe2yKkqJn2qEchwG3eU/dqJ/RxPZkAnYjePS4pDCw==",
+ "dev": true,
+ "requires": {
+ "charm": "0.1.x",
+ "deep-is": "0.1.x",
+ "traverse": "0.6.x"
+ }
+ },
+ "minimist": {
+ "version": "1.2.7",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
+ "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g=="
+ },
+ "mkdirp": {
+ "version": "0.3.5",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz",
+ "integrity": "sha512-8OCq0De/h9ZxseqzCH8Kw/Filf5pF/vMI6+BH7Lu0jXz2pqYCjTAQRolSxRIi+Ax+oCCjlxoJMP0YQ4XlrQNHg==",
+ "dev": true
+ },
+ "noble-secp256k1": {
+ "version": "1.2.14",
+ "resolved": "https://registry.npmjs.org/noble-secp256k1/-/noble-secp256k1-1.2.14.tgz",
+ "integrity": "sha512-GSCXyoZBUaaPwVWdYncMEmzlSUjF9J/YeEHpklYJCyg8wPuJP3NzDx0BkiwArzINkdX2HJHvUJhL6vVWPOQQcg=="
+ },
+ "nopt": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-2.2.1.tgz",
+ "integrity": "sha512-gIOTA/uJuhPwFqp+spY7VQ1satbnGlD+iQVZxI18K6hs8Evq4sX81Ml7BB5byP/LsbR2yBVtmvdEmhi7evJ6Aw==",
+ "dev": true,
+ "requires": {
+ "abbrev": "1"
+ }
+ },
+ "nostr": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/nostr/-/nostr-0.2.3.tgz",
+ "integrity": "sha512-+gT8V+jBoVlHGRJEyn5fkBSIF41xkQVc53FaX+7sQ+XAwhlj0/eSKp4HfsZvb326xSIT4RuyaTEJn+nTR4itwA==",
+ "requires": {
+ "noble-secp256k1": "^1.2.14",
+ "ws": "^8.8.1"
+ }
+ },
+ "runforcover": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/runforcover/-/runforcover-0.0.2.tgz",
+ "integrity": "sha512-yarCIK2HcAOadqnKW419+FA38qpWDCKcOr5RZU+jnyLL/hn3No9BHZY+YJDEzvQ0k8Oyl7ffLjZv9ZUxvyKoLQ==",
+ "dev": true,
+ "requires": {
+ "bunker": "0.1.X"
+ }
+ },
+ "slide": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz",
+ "integrity": "sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==",
+ "dev": true
+ },
+ "tap": {
+ "version": "0.2.6",
+ "resolved": "https://registry.npmjs.org/tap/-/tap-0.2.6.tgz",
+ "integrity": "sha512-uLvaKbh3+A4nh+P3SrfX52kWGkVvP37UYI7LxKjRkd6Bjdqbyc7MARaPFGl7SdwyNwWtZHlUxQX3w9pVNf3FKQ==",
+ "dev": true,
+ "requires": {
+ "buffer-equal": "~0.0.0",
+ "deep-equal": "~0.0.0",
+ "difflet": "~0.2.0",
+ "inherits": "*",
+ "mkdirp": "~0.3",
+ "nopt": "~2",
+ "runforcover": "~0.0.2",
+ "slide": "*",
+ "yamlish": "*"
+ },
+ "dependencies": {
+ "inherits": {
+ "version": "1.0.0",
+ "bundled": true,
+ "dev": true
+ },
+ "yamlish": {
+ "version": "0.0.5",
+ "bundled": true,
+ "dev": true
+ }
+ }
+ },
+ "traverse": {
+ "version": "0.6.7",
+ "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.7.tgz",
+ "integrity": "sha512-/y956gpUo9ZNCb99YjxG7OaslxZWHfCHAUUfshwqOXmxUIvqLjVO581BT+gM59+QV9tFe6/CGG53tsA1Y7RSdg==",
+ "dev": true
+ },
+ "uglify-js": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-1.1.1.tgz",
+ "integrity": "sha512-YYY9Dle1leC+btgrHnAR05eq0aRdcPJsXlYYD+SYw2lqc5HFuFNHg3wWEW4SNE0iXXEUl0fz43gTQ3r1YK76rg==",
+ "dev": true
+ },
+ "ws": {
+ "version": "8.11.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz",
+ "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
+ "requires": {}
+ }
+ }
+}
diff --git a/package.json b/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "nostr-delegation-signer",
+ "description": "Sign nostr delegation tokens",
+ "version": "0.1.0",
+ "repository": {
+ "url": "http://git.jb55.com/nostr-delegation-signer"
+ },
+ "bin": {
+ "nostr-delegation-signer": "./index.js"
+ },
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "dependencies": {
+ "nostr": "^0.2.3"
+ },
+ "devDependencies": {
+ "tap": "~0.2.5"
+ }
+}