mirror of
https://github.com/aljazceru/ditto.git
synced 2026-02-23 14:06:58 +01:00
feat: script to generate an nsec
This fixes: https://gitlab.com/soapbox-pub/ditto/-/issues/85
This commit is contained in:
16
scripts/nsec.ts
Normal file
16
scripts/nsec.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { generateSecretKey, nip19 } from '@/deps.ts';
|
||||
|
||||
switch (Deno.args[0]) {
|
||||
default: {
|
||||
const encodedNsec = generateEncodedPrivateKey();
|
||||
console.log(encodedNsec);
|
||||
Deno.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
function generateEncodedPrivateKey(): string {
|
||||
const sk = generateSecretKey();
|
||||
const nsec = nip19.nsecEncode(sk);
|
||||
|
||||
return nsec;
|
||||
}
|
||||
Reference in New Issue
Block a user