From 494193020ee6d3939cac7c14e9eb4b8cffd5fb30 Mon Sep 17 00:00:00 2001 From: "P. Reis" Date: Sat, 30 Mar 2024 18:09:37 -0300 Subject: [PATCH] refactor/docs: include nsec script in README and generate nsec directly --- README.md | 2 +- scripts/nsec.ts | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ae5828e..73fc4e4 100644 --- a/README.md +++ b/README.md @@ -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=` 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=` in your .env file. You can generate an nsec by running `deno task nsec`. 7. Run `deno task dev`. ## License diff --git a/scripts/nsec.ts b/scripts/nsec.ts index dcfa926..b0da325 100644 --- a/scripts/nsec.ts +++ b/scripts/nsec.ts @@ -1,11 +1,6 @@ import { generateSecretKey, nip19 } from 'npm:nostr-tools'; -const encodedNsec = generateEncodedPrivateKey(); -console.log(encodedNsec); +const sk = generateSecretKey(); +const nsec = nip19.nsecEncode(sk); -function generateEncodedPrivateKey(): string { - const sk = generateSecretKey(); - const nsec = nip19.nsecEncode(sk); - - return nsec; -} +console.log(nsec);