Switch from noble-secp256k1 to noble-curves

This commit is contained in:
Paul Miller
2023-04-14 16:26:33 +00:00
committed by fiatjaf_
parent f17ab41d72
commit 204ae0eff1
10 changed files with 648 additions and 804 deletions

View File

@@ -1,9 +1,10 @@
import * as secp256k1 from '@noble/secp256k1'
import {schnorr} from '@noble/curves/secp256k1'
import {bytesToHex} from '@noble/hashes/utils'
export function generatePrivateKey(): string {
return secp256k1.utils.bytesToHex(secp256k1.utils.randomPrivateKey())
return bytesToHex(schnorr.utils.randomPrivateKey())
}
export function getPublicKey(privateKey: string): string {
return secp256k1.utils.bytesToHex(secp256k1.schnorr.getPublicKey(privateKey))
return bytesToHex(schnorr.getPublicKey(privateKey))
}