nostr-oer-client/generateKeys.js
2024-08-12 19:38:09 +02:00

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);