nostr-oer-client/generateKeys.js

17 lines
505 B
JavaScript
Raw Permalink Normal View History

2024-08-12 17:38:09 +00:00
/**
* 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);