{"_id":"nostr-wasm","_rev":"3-6be25ff7906ff1694983e38148d1d9ed","name":"nostr-wasm","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.1":{"name":"nostr-wasm","description":"nostr stuff in wasm","version":"0.0.1","type":"module","main":"dist/main.js","exports":{".":"./dist/main.js","./headless":"./dist/headless.js","./gzipped":"./dist/gzipped.js"},"author":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"license":"MIT","dependencies":{},"devDependencies":{"@blake.regalia/tsconfig":"^0.1.2","@rollup/plugin-typescript":"^11.1.5","@rollup/plugin-wasm":"^6.2.2","@rollup/pluginutils":"^5.0.5","@types/node":"^20.8.10","@types/web":"^0.0.119","@typescript-eslint/eslint-plugin":"^6.13.2","@typescript-eslint/parser":"^6.13.2","acorn":"^8.11.2","eslint":"^8.52.0","eslint-plugin-unused-imports":"^3.0.0","rollup":"^4.2.0","typescript":"^5.2.2"},"publishConfig":{"access":"public"},"_id":"nostr-wasm@0.0.1","gitHead":"9fd60527fdf5db93bc6b7303fc79a2e33a1f59f6","types":"./dist/main.d.ts","_nodeVersion":"21.2.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-dbOoU3OnGix6yajx+/lvJ8NQTzED8yFZ6qX91SbLe/VJzadRsUlRFW7NkmgfRYLy4ziNH4/EREaSbE4LNS34KQ==","shasum":"6dc9bcdca86a3d402e4073030a4899418711b758","tarball":"https://registry.npmjs.org/nostr-wasm/-/nostr-wasm-0.0.1.tgz","fileCount":17,"unpackedSize":466279,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF+Yd12fyOkHAYboLZD6y7uLUzRiRXz4+eH3d1FJkzaMAiBSXiAEuiyH5KnDQGoLEHNY+OXcmGalLtoiyF6pRt8Fkg=="}]},"_npmUser":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"directories":{},"maintainers":[{"name":"fiatjaf","email":"fiatjaf@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nostr-wasm_0.0.1_1702690974469_0.8081546279495837"},"_hasShrinkwrap":false},"0.0.2":{"name":"nostr-wasm","description":"nostr stuff in wasm","version":"0.0.2","type":"module","main":"dist/main.js","exports":{".":"./dist/main.js","./headless":"./dist/headless.js","./gzipped":"./dist/gzipped.js"},"author":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"license":"MIT","dependencies":{},"devDependencies":{"@blake.regalia/tsconfig":"^0.1.2","@rollup/plugin-typescript":"^11.1.5","@rollup/plugin-wasm":"^6.2.2","@rollup/pluginutils":"^5.0.5","@types/node":"^20.8.10","@types/web":"^0.0.119","@typescript-eslint/eslint-plugin":"^6.13.2","@typescript-eslint/parser":"^6.13.2","acorn":"^8.11.2","eslint":"^8.52.0","eslint-plugin-unused-imports":"^3.0.0","rollup":"^4.2.0","typescript":"^5.2.2"},"publishConfig":{"access":"public"},"_id":"nostr-wasm@0.0.2","gitHead":"d3618b8a5430b2b04afe6fa82e927b63b39e9bfc","types":"./dist/main.d.ts","_nodeVersion":"21.2.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-To9KRPXGE9bWNy6WNrMfLRKD35YzOpbBju7Aw2bid6xCS5DM9cDt0BJaI2l0UJUtt4ZFF/7pz417/Lx1aikP3g==","shasum":"04903e16ca5a5879c2cb96b150add9d019f0b592","tarball":"https://registry.npmjs.org/nostr-wasm/-/nostr-wasm-0.0.2.tgz","fileCount":19,"unpackedSize":688024,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF+ni65sAEpigiQqe/bBNuAhdBvai//44lScLIT7UuKPAiBVzl6zXByMD76DZg/EOFJO02rFjISWIg6S9ZseF0gFGw=="}]},"_npmUser":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"directories":{},"maintainers":[{"name":"fiatjaf","email":"fiatjaf@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nostr-wasm_0.0.2_1702691391309_0.9518931186766177"},"_hasShrinkwrap":false},"0.0.3":{"name":"nostr-wasm","description":"nostr stuff in wasm","version":"0.0.3","type":"module","main":"dist/main.js","exports":{".":"./dist/main.js","./headless":"./dist/headless.js","./gzipped":"./dist/gzipped.js"},"author":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"license":"MIT","dependencies":{},"devDependencies":{"@blake.regalia/tsconfig":"^0.1.2","@rollup/plugin-typescript":"^11.1.5","@rollup/plugin-wasm":"^6.2.2","@rollup/pluginutils":"^5.0.5","@types/node":"^20.8.10","@types/web":"^0.0.119","@typescript-eslint/eslint-plugin":"^6.13.2","@typescript-eslint/parser":"^6.13.2","acorn":"^8.11.2","eslint":"^8.52.0","eslint-plugin-unused-imports":"^3.0.0","rollup":"^4.2.0","typescript":"^5.2.2"},"publishConfig":{"access":"public"},"_id":"nostr-wasm@0.0.3","gitHead":"6e81f5277bd95cd9b5ba0df84f40f42849decc39","types":"./dist/main.d.ts","_nodeVersion":"21.2.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-zz5INXiuya10s+zsNmW2k4xH47j+Ikgxn5SL8xt/quGBNWn/A6+blVqT3J6yjkZim/gyVC/9GXd0jH4w3w1HZA==","shasum":"79e2aed39d440fc54232e27fb37e92d560e76639","tarball":"https://registry.npmjs.org/nostr-wasm/-/nostr-wasm-0.0.3.tgz","fileCount":19,"unpackedSize":688100,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDcejkaSq8JNbYo6fLR9aTcy0VRgSNm4FfihOs5n0RU+wIhAMBsrTfV4iRpHAAZiZo8GoYY4f7neU329w6b0gPnQKj9"}]},"_npmUser":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"directories":{},"maintainers":[{"name":"fiatjaf","email":"fiatjaf@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nostr-wasm_0.0.3_1702993325925_0.3360332451241972"},"_hasShrinkwrap":false},"0.1.0":{"name":"nostr-wasm","description":"nostr stuff in wasm","version":"0.1.0","type":"module","main":"dist/main.js","exports":{".":"./dist/main.js","./headless":"./dist/headless.js","./gzipped":"./dist/gzipped.js"},"author":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"license":"MIT","dependencies":{},"devDependencies":{"@blake.regalia/tsconfig":"^0.1.2","@rollup/plugin-typescript":"^11.1.5","@rollup/plugin-wasm":"^6.2.2","@rollup/pluginutils":"^5.0.5","@types/node":"^20.8.10","@types/web":"^0.0.119","@typescript-eslint/eslint-plugin":"^6.13.2","@typescript-eslint/parser":"^6.13.2","acorn":"^8.11.2","eslint":"^8.52.0","eslint-plugin-unused-imports":"^3.0.0","rollup":"^4.2.0","typescript":"^5.2.2"},"publishConfig":{"access":"public"},"_id":"nostr-wasm@0.1.0","gitHead":"8c65c3e1a2e5d7615f23727a882d3285c767c313","types":"./dist/main.d.ts","_nodeVersion":"21.2.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-78BTryCLcLYv96ONU8Ws3Q1JzjlAt+43pWQhIl86xZmWeegYCNLPml7yQ+gG3vR6V5h4XGj+TxO+SS5dsThQIA==","shasum":"17af486745feb2b7dd29503fdd81613a24058d94","tarball":"https://registry.npmjs.org/nostr-wasm/-/nostr-wasm-0.1.0.tgz","fileCount":20,"unpackedSize":688309,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCWPlMF2J/q2evsgKW5rS5nsp/7T83+zjL3P/F5bRLqQwIgCkEZmTAFBSLXKYJFcMRgTNsEKUaivVA/HF8lvxIG15E="}]},"_npmUser":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"directories":{},"maintainers":[{"name":"fiatjaf","email":"fiatjaf@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nostr-wasm_0.1.0_1703253094914_0.5492657059073196"},"_hasShrinkwrap":false}},"time":{"created":"2023-12-16T01:42:54.345Z","0.0.1":"2023-12-16T01:42:54.726Z","modified":"2023-12-22T13:51:35.368Z","0.0.2":"2023-12-16T01:49:51.584Z","0.0.3":"2023-12-19T13:42:06.324Z","0.1.0":"2023-12-22T13:51:35.208Z"},"maintainers":[{"name":"fiatjaf","email":"fiatjaf@gmail.com"}],"description":"nostr stuff in wasm","author":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"license":"MIT","readme":"# nostr-wasm\n\nNostr signature stuff in WASM based on libsecp256k1.\n\n## Install\n\n```sh\nyarn install\n```\n\n## Demo\n\nA demo application using this package is available at https://nostr-wasm-demo.pages.dev/.\n\n## Usage\n\nFirst, choose which import method suites your needs:\n\n#### Default\n\nImport with the WASM binary preloaded and uncompressed. No need to perform `fetch`, but bundle will be larger (+332 KiB).\n\n```ts\nimport {initNostrWasm} from 'nostr-wasm'\nconst nw = await initNostrWasm()\n```\n\n#### Compressed\n\nImport with the WASM binary preloaded and gzipped (requires access to `globalThis.DecompressionSteam`). No need to perform `fetch`, but bundle will be still be a bit larger (+175 KiB).\n\n```ts\nimport {initNostrWasm} from 'nostr-wasm/gzipped'\nconst nw = await initNostrWasm()\n```\n\n#### Headless\n\nImport without the WASM binary. Produces the smallest bundle size but requires fetching the binary yourself.\n\n```ts\nimport {NostrWasm} from 'nostr-wasm/headless'\n\n// provide the binary (the constructor also accepts raw bytes)\nconst nw = await NostrWasm(await fetch('secp256k1.wasm'))\n```\n\n### Using the instance:\n\n```ts\n// generate a random private key\nconst sec = nw.generateSecretKey()\n\n// get its corresponding public key\nconst pubkey = nw.getPublicKey(sec)\n\n// finalize a nostr event in-place, filling it with id, pubkey and sig\nnw.finalizeEvent(event, sec)\n\n// verify a nostr event checking its id and its signature against the given pubkey\ntry {\n nw.verifyEvent(event)\n} catch (err) {\n console.log(err)\n}\n```\n\nCaller is responsible for zero-ing out private keys in the Uint8Array it passes. Library only zeroes out the bytes in the copies it makes.\n\n## Is libsecp256k1 modified?\n\nNo, the library is imported as a git submodule directly from upstream.\n\n## Building from source\n\nPrerequisites:\n\n- [Podman](https://podman.io/)\n- [Bun](https://bun.sh/)\n- [Just](https://just.systems/)\n\n```sh\ngit clone --recurse-submodules https://github.com/fiatjaf/nostr-wasm\ncd nostr-wasm\nbun install\njust\n```\n\nThe WASM binary will be output to `public/out/secp256k1.wasm`.\n\nThe Emscripten-generated js file at `public/out/secp256k1.js` is not needed for production if you are using the provided wrapper.\n","readmeFilename":"README.md"}