fix typescript types everywhere, delete pool.js and refactor relay.js to use event listeners everywhere.

This commit is contained in:
fiatjaf
2022-12-18 17:02:19 -03:00
parent 46a0a342db
commit de8bdd8370
16 changed files with 446 additions and 762 deletions

10
keys.ts Normal file
View 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')
}