Merge branch 'nsec-script' into 'main'

feat: script to generate an nsec

Closes #85

See merge request soapbox-pub/ditto!122
This commit is contained in:
Alex Gleason 2024-03-30 23:11:06 +00:00
commit fef1cf258d
3 changed files with 9 additions and 2 deletions

View File

@ -48,7 +48,7 @@ TODO
3. Download [Soapbox](https://dl.soapbox.pub/) or another web-based Mastodon client of your choice.
4. Put the frontend files inside the `public` directory.
5. Create an `.env` file.
6. Define `DITTO_NSEC=<value>` in your .env file. You can generate an nsec by installing [nak](https://github.com/fiatjaf/nak) and running `nak key generate | nak encode nsec`.
6. Define `DITTO_NSEC=<value>` in your .env file. You can generate an nsec by running `deno task nsec`.
7. Run `deno task dev`.
## License

View File

@ -7,7 +7,8 @@
"debug": "deno run -A --unstable-ffi --inspect src/server.ts",
"test": "DB_PATH=\":memory:\" deno test -A --unstable-ffi",
"check": "deno check src/server.ts",
"relays:sync": "deno run -A --unstable-ffi scripts/relays.ts sync"
"relays:sync": "deno run -A --unstable-ffi scripts/relays.ts sync",
"nsec": "deno run scripts/nsec.ts"
},
"exclude": ["./public"],
"imports": { "@/": "./src/", "@soapbox/nspec": "jsr:@soapbox/nspec@^0.8.1", "~/fixtures/": "./fixtures/" },

6
scripts/nsec.ts Normal file
View File

@ -0,0 +1,6 @@
import { generateSecretKey, nip19 } from 'npm:nostr-tools';
const sk = generateSecretKey();
const nsec = nip19.nsecEncode(sk);
console.log(nsec);