17 lines
505 B
JavaScript
17 lines
505 B
JavaScript
|
/**
|
||
|
* This script generates a secret key and a public key.
|
||
|
* to run this script, use the following command: node generateKeys.js
|
||
|
*/
|
||
|
import { bytesToHex, hexToBytes } from '@noble/hashes/utils'
|
||
|
import { generateSecretKey, getPublicKey } from 'nostr-tools/pure'
|
||
|
|
||
|
const secretKey = generateSecretKey();
|
||
|
const publicKey = getPublicKey(secretKey);
|
||
|
|
||
|
|
||
|
let skHex = bytesToHex(secretKey)
|
||
|
let backToBytes = hexToBytes(skHex)
|
||
|
|
||
|
console.log('your sekret key:', skHex)
|
||
|
console.log('your public key = ', publicKey);
|