mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-14 19:08:50 +00:00
11 lines
297 B
JavaScript
11 lines
297 B
JavaScript
import BigInteger from 'bigi'
|
|
import ecurve from 'ecurve'
|
|
|
|
const curve = ecurve.getCurveByName('secp256k1')
|
|
const G = curve.G
|
|
|
|
export function pubkeyFromPrivate(privateHex) {
|
|
const privKey = BigInteger.fromHex(privateHex)
|
|
return G.multiply(privKey).getEncoded(true).slice(1).toString('hex')
|
|
}
|