mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 00:28:51 +00:00
fix typescript types everywhere, delete pool.js and refactor relay.js to use event listeners everywhere.
This commit is contained in:
10
keys.ts
Normal file
10
keys.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import * as secp256k1 from '@noble/secp256k1'
|
||||
import {Buffer} from 'buffer'
|
||||
|
||||
export function generatePrivateKey(): string {
|
||||
return Buffer.from(secp256k1.utils.randomPrivateKey()).toString('hex')
|
||||
}
|
||||
|
||||
export function getPublicKey(privateKey: string): string {
|
||||
return Buffer.from(secp256k1.schnorr.getPublicKey(privateKey)).toString('hex')
|
||||
}
|
||||
Reference in New Issue
Block a user