import secp256k1 from "@node-lightning/secp256k1" ; param publicKey param privateKey returns export function ecdh ( publicKey , privateKey ) { return Buffer . from ( secp256k1 . ecdh ( publicKey , privateKey ) ) ; } param secret param tweak returns export function privateKeyMul ( secret , tweak ) { return Buffer . from ( secp256k1 . privateKeyTweakMul ( Buffer . from ( secret ) , tweak ) ) ; } param msg param privateKey returns export function sign ( msg , privateKey ) { const { signature } = secp256k1 . ecdsaSign ( msg , privateKey ) ; secp256k1 . signatureNormalize ( signature ) ; return Buffer . from ( signature ) ; } param msg param privateKey export function signWithRecovery ( msg , privateKey ) { const { signature , recid } = secp256k1 . ecdsaSign ( msg , privateKey ) ; return { signature : Buffer . from ( signature ) , recovery : recid , } ; } param sig export function sigToDER ( sig ) { return Buffer . from ( secp256k1 . signatureExport ( sig ) ) ; } param msg param sig param pubkey returns export function verifySig ( msg , sig , pubkey ) { return secp256k1 . ecdsaVerify ( sig , msg , pubkey ) ; } param sig export function isDERSig ( sig ) { try { secp256k1 . signatureImport ( sig ) ; return true ; } catch ( ex ) { return false ; } } param signature param recovery param message param compressed export function recoverPubKey ( signature , recovery , message , compressed = true ) { const result = secp256k1 . ecdsaRecover ( signature , recovery , message , compressed ) ; return Buffer . from ( result ) ; } param publicKey param tweak param compressed returns export function publicKeyTweakAdd ( publicKey , tweak , compressed = true ) { return Buffer . from ( secp256k1 . publicKeyTweakAdd ( publicKey , tweak , compressed ) ) ; } param publicKey param tweak param compressed returns export function publicKeyTweakMul ( publicKey , tweak , compressed = true ) { return Buffer . from ( secp256k1 . publicKeyTweakMul ( publicKey , tweak , compressed ) ) ; } param pubkeys param compressed returns export function publicKeyCombine ( pubkeys , compressed = true ) { return Buffer . from ( secp256k1 . publicKeyCombine ( pubkeys , compressed ) ) ; } param privateKey param tweak export function privateKeyTweakAdd ( privateKey , tweak ) { return Buffer . from ( secp256k1 . privateKeyTweakAdd ( Buffer . from ( privateKey ) , tweak ) ) ; } param privateKey param tweak export function privateKeyTweakMul ( privateKey , tweak ) { return Buffer . from ( secp256k1 . privateKeyTweakMul ( Buffer . from ( privateKey ) , tweak ) ) ; }